From: Marius Gavrilescu Date: Sun, 25 Jan 2015 12:08:40 +0000 (+0200) Subject: Convert all test programs from CPP to C X-Git-Tag: 5999.000_005~80 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=889e6e2800565514064d59087dedfb640863ef55;p=gruntmaster-daemon.git Convert all test programs from CPP to C --- diff --git a/MANIFEST b/MANIFEST index 8ba39c9..5c441b2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -35,10 +35,10 @@ t/problems/aminusb/4.in t/problems/aminusb/5.in t/problems/aminusb/meta.yml t/problems/aminusb/tests/ac/meta.yml -t/problems/aminusb/tests/ac/prog.cpp +t/problems/aminusb/tests/ac/prog.c t/problems/aminusb/tests/wa/meta.yml -t/problems/aminusb/tests/wa/prog.cpp -t/problems/aminusb/ver.cpp +t/problems/aminusb/tests/wa/prog.c +t/problems/aminusb/ver.c t/problems/aplusb/1.in t/problems/aplusb/1.ok t/problems/aplusb/2.in @@ -53,19 +53,19 @@ t/problems/aplusb/6.in t/problems/aplusb/6.ok t/problems/aplusb/meta.yml t/problems/aplusb/tests/40/meta.yml -t/problems/aplusb/tests/40/prog.cpp +t/problems/aplusb/tests/40/prog.c t/problems/aplusb/tests/ac/meta.yml -t/problems/aplusb/tests/ac/prog.cpp +t/problems/aplusb/tests/ac/prog.c t/problems/aplusb/tests/compile-error/meta.yml -t/problems/aplusb/tests/compile-error/prog.cpp +t/problems/aplusb/tests/compile-error/prog.c t/problems/aplusb/tests/mle/meta.yml -t/problems/aplusb/tests/mle/prog.cpp +t/problems/aplusb/tests/mle/prog.c t/problems/aplusb/tests/nzx/meta.yml -t/problems/aplusb/tests/nzx/prog.cpp +t/problems/aplusb/tests/nzx/prog.c t/problems/aplusb/tests/ole/meta.yml -t/problems/aplusb/tests/ole/prog.cpp +t/problems/aplusb/tests/ole/prog.c t/problems/aplusb/tests/tle/meta.yml -t/problems/aplusb/tests/tle/prog.cpp +t/problems/aplusb/tests/tle/prog.c t/problems/double/1.in t/problems/double/1.ok t/problems/double/10.in @@ -88,13 +88,13 @@ t/problems/double/9.in t/problems/double/9.ok t/problems/double/meta.yml t/problems/double/tests/wa/meta.yml -t/problems/double/tests/wa/prog.cpp -t/problems/increment/ver.cpp +t/problems/double/tests/wa/prog.c +t/problems/increment/ver.c t/problems/increment/meta.yml t/problems/increment/tests/ac/meta.yml -t/problems/increment/tests/ac/prog.cpp -t/problems/square/gen.cpp +t/problems/increment/tests/ac/prog.c +t/problems/square/gen.c t/problems/square/meta.yml t/problems/square/tests/ac/meta.yml -t/problems/square/tests/ac/prog.cpp -t/problems/square/ver.cpp +t/problems/square/tests/ac/prog.c +t/problems/square/ver.c diff --git a/t/problems/aminusb/meta.yml b/t/problems/aminusb/meta.yml index 69bcc74..5906488 100644 --- a/t/problems/aminusb/meta.yml +++ b/t/problems/aminusb/meta.yml @@ -10,5 +10,5 @@ olimit: 100 description: The A-B problem, with a verifier files: ver: - format: CPP - name: ver.cpp + format: C + name: ver.c diff --git a/t/problems/aminusb/tests/ac/meta.yml b/t/problems/aminusb/tests/ac/meta.yml index faec381..82086ad 100644 --- a/t/problems/aminusb/tests/ac/meta.yml +++ b/t/problems/aminusb/tests/ac/meta.yml @@ -21,5 +21,5 @@ expected_results: result_text: 20 files: prog: - format: CPP - name: prog.cpp + format: C + name: prog.c diff --git a/t/problems/aminusb/tests/ac/prog.c b/t/problems/aminusb/tests/ac/prog.c new file mode 100644 index 0000000..371c59a --- /dev/null +++ b/t/problems/aminusb/tests/ac/prog.c @@ -0,0 +1,8 @@ +#include +int main() +{ + int a,b; + scanf ("%d%d",&a,&b); + printf ("%d",a-b); + return 0; +} diff --git a/t/problems/aminusb/tests/ac/prog.cpp b/t/problems/aminusb/tests/ac/prog.cpp deleted file mode 100644 index 298dd43..0000000 --- a/t/problems/aminusb/tests/ac/prog.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include -int main() -{ - int a,b; - scanf ("%d%d",&a,&b); - printf ("%d",a-b); - return 0; -} diff --git a/t/problems/aminusb/tests/wa/meta.yml b/t/problems/aminusb/tests/wa/meta.yml index 87d6d0e..145e8ec 100644 --- a/t/problems/aminusb/tests/wa/meta.yml +++ b/t/problems/aminusb/tests/wa/meta.yml @@ -21,5 +21,5 @@ expected_results: result_text: Wrong answer files: prog: - format: CPP - name: prog.cpp + format: C + name: prog.c diff --git a/t/problems/aminusb/tests/wa/prog.c b/t/problems/aminusb/tests/wa/prog.c new file mode 100644 index 0000000..76e8197 --- /dev/null +++ b/t/problems/aminusb/tests/wa/prog.c @@ -0,0 +1 @@ +int main() { return 0; } diff --git a/t/problems/aminusb/tests/wa/prog.cpp b/t/problems/aminusb/tests/wa/prog.cpp deleted file mode 100644 index 76e8197..0000000 --- a/t/problems/aminusb/tests/wa/prog.cpp +++ /dev/null @@ -1 +0,0 @@ -int main() { return 0; } diff --git a/t/problems/aminusb/ver.c b/t/problems/aminusb/ver.c new file mode 100644 index 0000000..3c0c239 --- /dev/null +++ b/t/problems/aminusb/ver.c @@ -0,0 +1,14 @@ +#include + +int main(void){ + FILE *output = fdopen(3, "r"); + int a, b, ret; + scanf("%d%d", &a, &b); + fscanf(output, "%d", &ret); + if(a-b == ret){ + printf("20"); + return 0; + } else + return 1; +} + diff --git a/t/problems/aminusb/ver.cpp b/t/problems/aminusb/ver.cpp deleted file mode 100644 index 87cc931..0000000 --- a/t/problems/aminusb/ver.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int main(void){ - FILE *output = fdopen(3, "r"); - int a, b, ret; - scanf("%d%d", &a, &b); - fscanf(output, "%d", &ret); - if(a-b == ret){ - printf("20"); - return 0; - } else - return 1; -} - diff --git a/t/problems/aplusb/tests/40/meta.yml b/t/problems/aplusb/tests/40/meta.yml index 80180bd..d9f6509 100644 --- a/t/problems/aplusb/tests/40/meta.yml +++ b/t/problems/aplusb/tests/40/meta.yml @@ -24,5 +24,5 @@ expected_results: result_text: 10 files: prog: - format: CPP - name: prog.cpp + format: C + name: prog.c diff --git a/t/problems/aplusb/tests/40/prog.c b/t/problems/aplusb/tests/40/prog.c new file mode 100644 index 0000000..5a41733 --- /dev/null +++ b/t/problems/aplusb/tests/40/prog.c @@ -0,0 +1,7 @@ +#include +int main(void){ + short a,b; + scanf("%hd%hd", &a, &b); + printf("%hd", a+b); + return 0; +} diff --git a/t/problems/aplusb/tests/40/prog.cpp b/t/problems/aplusb/tests/40/prog.cpp deleted file mode 100644 index 5a41733..0000000 --- a/t/problems/aplusb/tests/40/prog.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include -int main(void){ - short a,b; - scanf("%hd%hd", &a, &b); - printf("%hd", a+b); - return 0; -} diff --git a/t/problems/aplusb/tests/ac/meta.yml b/t/problems/aplusb/tests/ac/meta.yml index e5fa091..2527e65 100644 --- a/t/problems/aplusb/tests/ac/meta.yml +++ b/t/problems/aplusb/tests/ac/meta.yml @@ -24,5 +24,5 @@ expected_results: result_text: 10 files: prog: - format: CPP - name: prog.cpp + format: C + name: prog.c diff --git a/t/problems/aplusb/tests/ac/prog.c b/t/problems/aplusb/tests/ac/prog.c new file mode 100644 index 0000000..69f4bc5 --- /dev/null +++ b/t/problems/aplusb/tests/ac/prog.c @@ -0,0 +1,8 @@ +#include +int main() +{ + int a,b; + scanf ("%d%d",&a,&b); + printf ("%d",a+b); + return 0; +} diff --git a/t/problems/aplusb/tests/ac/prog.cpp b/t/problems/aplusb/tests/ac/prog.cpp deleted file mode 100644 index f8a683a..0000000 --- a/t/problems/aplusb/tests/ac/prog.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include -int main() -{ - int a,b; - scanf ("%d%d",&a,&b); - printf ("%d",a+b); - return 0; -} diff --git a/t/problems/aplusb/tests/compile-error/meta.yml b/t/problems/aplusb/tests/compile-error/meta.yml index d994edb..1ae5db3 100644 --- a/t/problems/aplusb/tests/compile-error/meta.yml +++ b/t/problems/aplusb/tests/compile-error/meta.yml @@ -5,5 +5,5 @@ expected_result: -1 expected_result_text: Compile error files: prog: - format: CPP - name: prog.cpp + format: C + name: prog.c diff --git a/t/problems/aplusb/tests/compile-error/prog.c b/t/problems/aplusb/tests/compile-error/prog.c new file mode 100644 index 0000000..b5287f3 --- /dev/null +++ b/t/problems/aplusb/tests/compile-error/prog.c @@ -0,0 +1 @@ +int diff --git a/t/problems/aplusb/tests/compile-error/prog.cpp b/t/problems/aplusb/tests/compile-error/prog.cpp deleted file mode 100644 index b5287f3..0000000 --- a/t/problems/aplusb/tests/compile-error/prog.cpp +++ /dev/null @@ -1 +0,0 @@ -int diff --git a/t/problems/aplusb/tests/mle/meta.yml b/t/problems/aplusb/tests/mle/meta.yml index 3228dd4..5a1e58a 100644 --- a/t/problems/aplusb/tests/mle/meta.yml +++ b/t/problems/aplusb/tests/mle/meta.yml @@ -24,5 +24,5 @@ expected_results: result_text: Crash (SIGKILL) files: prog: - format: CPP - name: prog.cpp + format: C + name: prog.c diff --git a/t/problems/aplusb/tests/mle/prog.c b/t/problems/aplusb/tests/mle/prog.c new file mode 100644 index 0000000..049ae69 --- /dev/null +++ b/t/problems/aplusb/tests/mle/prog.c @@ -0,0 +1,3 @@ +int v[1005][1005][20]; +int main(void){ +} diff --git a/t/problems/aplusb/tests/mle/prog.cpp b/t/problems/aplusb/tests/mle/prog.cpp deleted file mode 100644 index 049ae69..0000000 --- a/t/problems/aplusb/tests/mle/prog.cpp +++ /dev/null @@ -1,3 +0,0 @@ -int v[1005][1005][20]; -int main(void){ -} diff --git a/t/problems/aplusb/tests/nzx/meta.yml b/t/problems/aplusb/tests/nzx/meta.yml index 1d5241b..ccaf4c1 100644 --- a/t/problems/aplusb/tests/nzx/meta.yml +++ b/t/problems/aplusb/tests/nzx/meta.yml @@ -24,5 +24,5 @@ expected_results: result_text: 'Non-zero exit status: 42' files: prog: - format: CPP - name: prog.cpp + format: C + name: prog.c diff --git a/t/problems/aplusb/tests/nzx/prog.c b/t/problems/aplusb/tests/nzx/prog.c new file mode 100644 index 0000000..4a70c11 --- /dev/null +++ b/t/problems/aplusb/tests/nzx/prog.c @@ -0,0 +1,3 @@ +int main(void){ + return 42; +} diff --git a/t/problems/aplusb/tests/nzx/prog.cpp b/t/problems/aplusb/tests/nzx/prog.cpp deleted file mode 100644 index 4a70c11..0000000 --- a/t/problems/aplusb/tests/nzx/prog.cpp +++ /dev/null @@ -1,3 +0,0 @@ -int main(void){ - return 42; -} diff --git a/t/problems/aplusb/tests/ole/meta.yml b/t/problems/aplusb/tests/ole/meta.yml index 15f8430..b05d98c 100644 --- a/t/problems/aplusb/tests/ole/meta.yml +++ b/t/problems/aplusb/tests/ole/meta.yml @@ -24,5 +24,5 @@ expected_results: result_text: Output Limit Exceeded files: prog: - format: CPP - name: prog.cpp + format: C + name: prog.c diff --git a/t/problems/aplusb/tests/ole/prog.c b/t/problems/aplusb/tests/ole/prog.c new file mode 100644 index 0000000..197df17 --- /dev/null +++ b/t/problems/aplusb/tests/ole/prog.c @@ -0,0 +1,6 @@ +#include + +int main(void){ + for(int i=0;i<100;i++) + puts("asdasdasd"); +} diff --git a/t/problems/aplusb/tests/ole/prog.cpp b/t/problems/aplusb/tests/ole/prog.cpp deleted file mode 100644 index 92fffb1..0000000 --- a/t/problems/aplusb/tests/ole/prog.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void){ - for(int i=0;i<100;i++) - puts("asdasdasd"); -} diff --git a/t/problems/aplusb/tests/tle/meta.yml b/t/problems/aplusb/tests/tle/meta.yml index 0abafd3..b66b40e 100644 --- a/t/problems/aplusb/tests/tle/meta.yml +++ b/t/problems/aplusb/tests/tle/meta.yml @@ -24,5 +24,5 @@ expected_results: result_text: Time Limit Exceeded files: prog: - format: CPP - name: prog.cpp + format: C + name: prog.c diff --git a/t/problems/aplusb/tests/tle/prog.c b/t/problems/aplusb/tests/tle/prog.c new file mode 100644 index 0000000..a35c303 --- /dev/null +++ b/t/problems/aplusb/tests/tle/prog.c @@ -0,0 +1,3 @@ +int main(void){ + while(1); +} diff --git a/t/problems/aplusb/tests/tle/prog.cpp b/t/problems/aplusb/tests/tle/prog.cpp deleted file mode 100644 index a35c303..0000000 --- a/t/problems/aplusb/tests/tle/prog.cpp +++ /dev/null @@ -1,3 +0,0 @@ -int main(void){ - while(1); -} diff --git a/t/problems/double/tests/wa/meta.yml b/t/problems/double/tests/wa/meta.yml index 286a611..1000f53 100644 --- a/t/problems/double/tests/wa/meta.yml +++ b/t/problems/double/tests/wa/meta.yml @@ -18,5 +18,5 @@ expected_results: result_text: Wrong answer files: prog: - format: CPP - name: prog.cpp + format: C + name: prog.c diff --git a/t/problems/double/tests/wa/prog.c b/t/problems/double/tests/wa/prog.c new file mode 100644 index 0000000..524d8c9 --- /dev/null +++ b/t/problems/double/tests/wa/prog.c @@ -0,0 +1,8 @@ +#include + +int main(void){ + char x; + scanf("%d", &x); + printf("%d", 2*x); + return 0; +} diff --git a/t/problems/double/tests/wa/prog.cpp b/t/problems/double/tests/wa/prog.cpp deleted file mode 100644 index 8dd19c7..0000000 --- a/t/problems/double/tests/wa/prog.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main(void){ - char x; - scanf("%d", &x); - printf("%d", 2*x); - return 0; -} diff --git a/t/problems/increment/meta.yml b/t/problems/increment/meta.yml index eb1fa5a..c35e45e 100644 --- a/t/problems/increment/meta.yml +++ b/t/problems/increment/meta.yml @@ -9,5 +9,5 @@ mlimit: 20971520 description: A trivial interactive problem files: ver: - format: CPP - name: ver.cpp + format: C + name: ver.c diff --git a/t/problems/increment/tests/ac/meta.yml b/t/problems/increment/tests/ac/meta.yml index 37dd268..2660535 100644 --- a/t/problems/increment/tests/ac/meta.yml +++ b/t/problems/increment/tests/ac/meta.yml @@ -21,5 +21,5 @@ expected_results: result_text: 20 files: prog: - format: CPP - name: prog.cpp + format: C + name: prog.c diff --git a/t/problems/increment/tests/ac/prog.c b/t/problems/increment/tests/ac/prog.c new file mode 100644 index 0000000..156da0c --- /dev/null +++ b/t/problems/increment/tests/ac/prog.c @@ -0,0 +1,12 @@ +#include + +int main(void){ + for(int i=0;i<100;i++){ + int x; + scanf("%d", &x); + printf("%d\n", x + 1); + fflush(stdout); + } + + return 0; +} diff --git a/t/problems/increment/tests/ac/prog.cpp b/t/problems/increment/tests/ac/prog.cpp deleted file mode 100644 index da549a7..0000000 --- a/t/problems/increment/tests/ac/prog.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main(void){ - for(int i=0;i<100;i++){ - int x; - scanf("%d", &x); - printf("%d\n", x + 1); - fflush(stdout); - } - - return 0; -} diff --git a/t/problems/increment/ver.c b/t/problems/increment/ver.c new file mode 100644 index 0000000..bdd5820 --- /dev/null +++ b/t/problems/increment/ver.c @@ -0,0 +1,23 @@ +#include +#include +#include +#include + +int main(void){ + srand(time(NULL)); + for(int i=0;i<100;i++){ + int nr = rand() % 100; + printf("%d\n", nr); + fflush(stdout); + int ret; + scanf("%d", &ret); + if(ret != nr + 1){ + fprintf(stderr, "bad ret: %d instead of %d", ret, nr + 1); + return 1; + } + } + + if(write(4, "20", 2) == -1) + perror("write"); + return 0; +} diff --git a/t/problems/increment/ver.cpp b/t/problems/increment/ver.cpp deleted file mode 100644 index 3b89262..0000000 --- a/t/problems/increment/ver.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include -#include - -int main(void){ - srand(time(NULL)); - for(int i=0;i<100;i++){ - int nr = rand() % 100; - printf("%d\n", nr); - fflush(stdout); - int ret; - scanf("%d", &ret); - if(ret != nr + 1){ - fprintf(stderr, "bad ret: %d instead of %d", ret, nr + 1); - return 1; - } - } - - if(write(4, "20", 2) == -1) - perror("write"); - return 0; -} diff --git a/t/problems/square/gen.c b/t/problems/square/gen.c new file mode 100644 index 0000000..324e0c1 --- /dev/null +++ b/t/problems/square/gen.c @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char **argv){ + int testnum = atoi(argv[0]); + printf("%d", testnum); + return 0; +} diff --git a/t/problems/square/gen.cpp b/t/problems/square/gen.cpp deleted file mode 100644 index f5fe75b..0000000 --- a/t/problems/square/gen.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include - -int main(int argc, char **argv){ - int testnum = atoi(argv[0]); - printf("%d", testnum); - return 0; -} diff --git a/t/problems/square/meta.yml b/t/problems/square/meta.yml index 330ea65..72f5069 100644 --- a/t/problems/square/meta.yml +++ b/t/problems/square/meta.yml @@ -10,8 +10,8 @@ olimit: 100 description: The X^2 problem files: ver: - format: CPP - name: ver.cpp + format: C + name: ver.c gen: - format: CPP - name: gen.cpp + format: C + name: gen.c diff --git a/t/problems/square/tests/ac/meta.yml b/t/problems/square/tests/ac/meta.yml index 04437d6..e218ef8 100644 --- a/t/problems/square/tests/ac/meta.yml +++ b/t/problems/square/tests/ac/meta.yml @@ -36,5 +36,5 @@ expected_results: result_text: 10 files: prog: - format: CPP - name: prog.cpp + format: C + name: prog.c diff --git a/t/problems/square/tests/ac/prog.c b/t/problems/square/tests/ac/prog.c new file mode 100644 index 0000000..041dcc1 --- /dev/null +++ b/t/problems/square/tests/ac/prog.c @@ -0,0 +1,8 @@ +#include + +int main(void){ + int x; + scanf("%d", &x); + printf("%d", x*x); + return 0; +} diff --git a/t/problems/square/tests/ac/prog.cpp b/t/problems/square/tests/ac/prog.cpp deleted file mode 100644 index 0a66015..0000000 --- a/t/problems/square/tests/ac/prog.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main(void){ - int x; - scanf("%d", &x); - printf("%d", x*x); - return 0; -} diff --git a/t/problems/square/ver.c b/t/problems/square/ver.c new file mode 100644 index 0000000..0f5008c --- /dev/null +++ b/t/problems/square/ver.c @@ -0,0 +1,14 @@ +#include + +int main(void){ + FILE *output = fdopen(3, "r"); + int x, ret; + scanf("%d", &x); + fscanf(output, "%d", &ret); + if(x*x == ret){ + printf("10"); + return 0; + } else + return 1; +} + diff --git a/t/problems/square/ver.cpp b/t/problems/square/ver.cpp deleted file mode 100644 index cb4d031..0000000 --- a/t/problems/square/ver.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int main(void){ - FILE *output = fdopen(3, "r"); - int x, ret; - scanf("%d", &x); - fscanf(output, "%d", &ret); - if(x*x == ret){ - printf("10"); - return 0; - } else - return 1; -} -