增加output_limit的测试

This commit is contained in:
LiYang 2016-10-23 01:56:53 +08:00
parent b71625bedb
commit 9e290f6db6
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,15 @@
#include <stdio.h>
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;
}

View File

@ -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)