diff --git a/tests/testcase/integration/output_size.c b/tests/testcase/integration/output_size.c new file mode 100644 index 0000000..cbf27cc --- /dev/null +++ b/tests/testcase/integration/output_size.c @@ -0,0 +1,15 @@ +#include +int main() { + FILE *f = fopen("/tmp/fsize_test", "w"); + if(f == NULL) { + return 1; + } + int i; + for(i = 0;i < 10000; i++) { + if (fprintf(f, "%s", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") <= 0) { + return 2; + } + } + fclose(f); + return 0; +} \ No newline at end of file diff --git a/tests/testcase/integration/test.py b/tests/testcase/integration/test.py index d20c7fc..ac7a660 100644 --- a/tests/testcase/integration/test.py +++ b/tests/testcase/integration/test.py @@ -271,3 +271,10 @@ class IntegrationTest(base.BaseTestCase): self.assertEqual(result["result"], _judger.RESULT_CPU_TIME_LIMIT_EXCEEDED) self.assertTrue(result["cpu_time"] >= 1950) self.assertTrue(result["real_time"] >= 1950) + + def test_output_size(self): + config = self.config + config["exe_path"] = self._compile_c("output_size.c") + config["max_output_size"] = 1000 * 10 + result = _judger.run(**config) + self.assertEqual(result["exit_code"], 2)