mirror of
https://github.com/QingdaoU/Judger.git
synced 2024-12-29 16:31:42 +00:00
增加output_limit的测试
This commit is contained in:
parent
b71625bedb
commit
9e290f6db6
15
tests/testcase/integration/output_size.c
Normal file
15
tests/testcase/integration/output_size.c
Normal 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;
|
||||||
|
}
|
@ -271,3 +271,10 @@ class IntegrationTest(base.BaseTestCase):
|
|||||||
self.assertEqual(result["result"], _judger.RESULT_CPU_TIME_LIMIT_EXCEEDED)
|
self.assertEqual(result["result"], _judger.RESULT_CPU_TIME_LIMIT_EXCEEDED)
|
||||||
self.assertTrue(result["cpu_time"] >= 1950)
|
self.assertTrue(result["cpu_time"] >= 1950)
|
||||||
self.assertTrue(result["real_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)
|
||||||
|
Loading…
Reference in New Issue
Block a user