[hackers] [scc] [test] Move all the tests to execute || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 12 Jan 2017 12:03:34 +0100 (CET)

commit 7b5e51fae035c6e8c2ca62be07ba3a31e38a4593
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Jan 12 11:59:30 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Jan 12 11:59:30 2017 +0100

    [test] Move all the tests to execute

diff --git a/tests/0001-sanity.c b/tests/0001-sanity.c
deleted file mode 100644
index d659c45..0000000
--- a/tests/0001-sanity.c
+++ /dev/null
_AT_@ -1,6 +0,0 @@
-
-int
-main()
-{
- return 0;
-}
diff --git a/tests/0002-expr.c b/tests/0002-expr.c
deleted file mode 100644
index 75b8616..0000000
--- a/tests/0002-expr.c
+++ /dev/null
_AT_@ -1,6 +0,0 @@
-
-int
-main()
-{
- return 3-3;
-}
diff --git a/tests/0003-local.c b/tests/0003-local.c
deleted file mode 100644
index 894d770..0000000
--- a/tests/0003-local.c
+++ /dev/null
_AT_@ -1,10 +0,0 @@
-
-
-int
-main()
-{
- int x;
-
- x = 4;
- return x - 4;
-}
diff --git a/tests/0004-pointer.c b/tests/0004-pointer.c
deleted file mode 100644
index d5d471a..0000000
--- a/tests/0004-pointer.c
+++ /dev/null
_AT_@ -1,14 +0,0 @@
-
-
-int
-main()
-{
- int x;
- int *p;
-
- x = 4;
- p = &x;
- *p = 0;
-
- return *p;
-}
diff --git a/tests/0005-ifstmt.c b/tests/0005-ifstmt.c
deleted file mode 100644
index 2122c45..0000000
--- a/tests/0005-ifstmt.c
+++ /dev/null
_AT_@ -1,24 +0,0 @@
-
-int
-main()
-{
- int x;
- int *p;
- int **pp;
-
- x = 0;
- p = &x;
- pp = &p;
-
- if(*p)
- return 1;
- if(**pp)
- return 1;
- else
- **pp = 1;
-
- if(x)
- return 0;
- else
- return 1;
-}
diff --git a/tests/0006-whilestmt.c b/tests/0006-whilestmt.c
deleted file mode 100644
index bc2068e..0000000
--- a/tests/0006-whilestmt.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-
-int
-main()
-{
- int x;
-
- x = 50;
- while (x)
- x = x - 1;
- return x;
-}
diff --git a/tests/0007-forstmt.c b/tests/0007-forstmt.c
deleted file mode 100644
index 99466ef..0000000
--- a/tests/0007-forstmt.c
+++ /dev/null
_AT_@ -1,16 +0,0 @@
-
-int
-main()
-{
- int x;
-
- x = 1;
- for(x = 10; x; x = x - 1)
- ;
- if(x)
- return 1;
- x = 10;
- for (;x;)
- x = x - 1;
- return x;
-}
diff --git a/tests/0008-dowhilestmt.c b/tests/0008-dowhilestmt.c
deleted file mode 100644
index ecde256..0000000
--- a/tests/0008-dowhilestmt.c
+++ /dev/null
_AT_@ -1,12 +0,0 @@
-
-int
-main()
-{
- int x;
-
- x = 50;
- do
- x = x - 1;
- while(x);
- return x;
-}
diff --git a/tests/0009-expr.c b/tests/0009-expr.c
deleted file mode 100644
index f9a3509..0000000
--- a/tests/0009-expr.c
+++ /dev/null
_AT_@ -1,12 +0,0 @@
-
-int
-main()
-{
- int x;
-
- x = 1;
- x = x * 10;
- x = x / 2;
- x = x % 3;
- return x - 2;
-}
diff --git a/tests/0010-goto.c b/tests/0010-goto.c
deleted file mode 100644
index d5bfbbf..0000000
--- a/tests/0010-goto.c
+++ /dev/null
_AT_@ -1,13 +0,0 @@
-int
-main()
-{
- start:
- goto next;
- return 1;
- success:
- return 0;
- next:
- foo:
- goto success;
- return 1;
-}
diff --git a/tests/0011-assign.c b/tests/0011-assign.c
deleted file mode 100644
index 831ebeb..0000000
--- a/tests/0011-assign.c
+++ /dev/null
_AT_@ -1,9 +0,0 @@
-
-int
-main()
-{
- int x;
- int y;
- x = y = 0;
- return x;
-}
diff --git a/tests/0012-expr.c b/tests/0012-expr.c
deleted file mode 100644
index 654dc11..0000000
--- a/tests/0012-expr.c
+++ /dev/null
_AT_@ -1,6 +0,0 @@
-
-int
-main()
-{
- return (2 + 2) * 2 - 8;
-}
diff --git a/tests/0013-addridx.c b/tests/0013-addridx.c
deleted file mode 100644
index 1e51a0e..0000000
--- a/tests/0013-addridx.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-
-int
-main()
-{
- int x;
- int *p;
-
- x = 0;
- p = &x;
- return p[0];
-}
diff --git a/tests/0014-assignidx.c b/tests/0014-assignidx.c
deleted file mode 100644
index 3b11891..0000000
--- a/tests/0014-assignidx.c
+++ /dev/null
_AT_@ -1,12 +0,0 @@
-
-int
-main()
-{
- int x;
- int *p;
-
- x = 1;
- p = &x;
- p[0] = 0;
- return x;
-}
diff --git a/tests/0015-localarray.c b/tests/0015-localarray.c
deleted file mode 100644
index fef1794..0000000
--- a/tests/0015-localarray.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-
-int
-main()
-{
- int arr[2];
-
- arr[0] = 1;
- arr[1] = 2;
-
- return arr[0] + arr[1] - 3;
-}
diff --git a/tests/0016-addrarray.c b/tests/0016-addrarray.c
deleted file mode 100644
index 9db7edb..0000000
--- a/tests/0016-addrarray.c
+++ /dev/null
_AT_@ -1,10 +0,0 @@
-int
-main()
-{
- int arr[2];
- int *p;
-
- p = &arr[1];
- *p = 0;
- return arr[1];
-}
diff --git a/tests/0017-struct.c b/tests/0017-struct.c
deleted file mode 100644
index d74481b..0000000
--- a/tests/0017-struct.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-
-
-int
-main()
-{
- struct { int x; int y; } s;
-
- s.x = 3;
- s.y = 5;
- return s.y - s.x - 2;
-}
diff --git a/tests/0018-structptr.c b/tests/0018-structptr.c
deleted file mode 100644
index 58b6b5d..0000000
--- a/tests/0018-structptr.c
+++ /dev/null
_AT_@ -1,15 +0,0 @@
-
-
-int
-main()
-{
-
- struct S { int x; int y; } s;
- struct S *p;
-
- p = &s;
- s.x = 1;
- p->y = 2;
- return p->y + p->x - 3;
-}
-
diff --git a/tests/0019-selfrefstruct.c b/tests/0019-selfrefstruct.c
deleted file mode 100644
index 768c36f..0000000
--- a/tests/0019-selfrefstruct.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-
-int
-main()
-{
- struct S { struct S *p; int x; } s;
-
- s.x = 0;
- s.p = &s;
- return s.p->p->p->p->p->x;
-}
-
diff --git a/tests/0020-ptrptr.c b/tests/0020-ptrptr.c
deleted file mode 100644
index 4209c90..0000000
--- a/tests/0020-ptrptr.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-
-int
-main()
-{
- int x, *p, **pp;
-
- x = 0;
- p = &x;
- pp = &p;
- return **pp;
-}
diff --git a/tests/0021-intfunc.c b/tests/0021-intfunc.c
deleted file mode 100644
index 9633851..0000000
--- a/tests/0021-intfunc.c
+++ /dev/null
_AT_@ -1,13 +0,0 @@
-
-int
-foo(int a, int b)
-{
- return 2 + a - b;
-}
-
-int
-main()
-{
- return foo(1, 3);
-}
-
diff --git a/tests/0022-typedef.c b/tests/0022-typedef.c
deleted file mode 100644
index 81fd3b1..0000000
--- a/tests/0022-typedef.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-
-typedef int x;
-
-int
-main()
-{
- x v;
- v = 0;
- return v;
-}
-
diff --git a/tests/0023-global.c b/tests/0023-global.c
deleted file mode 100644
index f058f49..0000000
--- a/tests/0023-global.c
+++ /dev/null
_AT_@ -1,10 +0,0 @@
-
-int x;
-
-int
-main()
-{
- x = 0;
- return x;
-}
-
diff --git a/tests/0024-typedefstruct.c b/tests/0024-typedefstruct.c
deleted file mode 100644
index 67e6ed8..0000000
--- a/tests/0024-typedefstruct.c
+++ /dev/null
_AT_@ -1,13 +0,0 @@
-
-typedef struct { int x; int y; } s;
-
-s v;
-
-int
-main()
-{
- v.x = 1;
- v.y = 2;
- return 3 - v.x - v.y;
-}
-
diff --git a/tests/0025-string.c b/tests/0025-string.c
deleted file mode 100644
index 4b2ae82..0000000
--- a/tests/0025-string.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-
-int strlen(char *);
-
-int
-main()
-{
- char *p;
-
- p = "hello";
- return strlen(p) - 5;
-}
diff --git a/tests/0026-implicitret.c b/tests/0026-implicitret.c
deleted file mode 100644
index 0867241..0000000
--- a/tests/0026-implicitret.c
+++ /dev/null
_AT_@ -1,6 +0,0 @@
-
-main()
-{
- return 0;
-}
-
diff --git a/tests/0027-charval.c b/tests/0027-charval.c
deleted file mode 100644
index 2f6d40a..0000000
--- a/tests/0027-charval.c
+++ /dev/null
_AT_@ -1,9 +0,0 @@
-
-int
-main()
-{
- char *p;
-
- p = "hello";
- return p[0] - 104;
-}
diff --git a/tests/0028-bor.c b/tests/0028-bor.c
deleted file mode 100644
index 92beb1f..0000000
--- a/tests/0028-bor.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-
-int
-main()
-{
- int x;
-
- x = 1;
- x = x | 4;
- return x - 5;
-}
-
diff --git a/tests/0029-band.c b/tests/0029-band.c
deleted file mode 100644
index 53e264e..0000000
--- a/tests/0029-band.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-
-int
-main()
-{
- int x;
-
- x = 1;
- x = x & 3;
- return x - 1;
-}
-
diff --git a/tests/0030-bxor.c b/tests/0030-bxor.c
deleted file mode 100644
index 238955a..0000000
--- a/tests/0030-bxor.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-
-int
-main()
-{
- int x;
-
- x = 1;
- x = x ^ 3;
- return x - 2;
-}
-
diff --git a/tests/0031-relop.c b/tests/0031-relop.c
deleted file mode 100644
index 643d130..0000000
--- a/tests/0031-relop.c
+++ /dev/null
_AT_@ -1,25 +0,0 @@
-
-int
-f()
-{
- return 100;
-}
-
-int
-main()
-{
- if (f() > 1000)
- return 1;
- if (f() >= 1000)
- return 1;
- if (1000 < f())
- return 1;
- if (1000 <= f())
- return 1;
- if (1000 == f())
- return 1;
- if (100 != f())
- return 1;
- return 0;
-}
-
diff --git a/tests/0032-indec.c b/tests/0032-indec.c
deleted file mode 100644
index 45748eb..0000000
--- a/tests/0032-indec.c
+++ /dev/null
_AT_@ -1,49 +0,0 @@
-
-int
-zero()
-{
- return 0;
-}
-
-int
-one()
-{
- return 1;
-}
-
-int
-main()
-{
- int x;
- int y;
-
- x = zero();
- y = ++x;
- if (x != 1)
- return 1;
- if (y != 1)
- return 1;
-
- x = one();
- y = --x;
- if (x != 0)
- return 1;
- if (y != 0)
- return 1;
-
- x = zero();
- y = x++;
- if (x != 1)
- return 1;
- if (y != 0)
- return 1;
-
- x = one();
- y = x--;
- if (x != 0)
- return 1;
- if (y != 1)
- return 1;
-
- return 0;
-}
diff --git a/tests/0033-ptrindec.c b/tests/0033-ptrindec.c
deleted file mode 100644
index 30d4271..0000000
--- a/tests/0033-ptrindec.c
+++ /dev/null
_AT_@ -1,32 +0,0 @@
-
-
-int
-main()
-{
- int arr[2];
- int *p;
-
- arr[0] = 2;
- arr[1] = 3;
- p = &arr[0];
- if(*(p++) != 2)
- return 1;
- if(*(p++) != 3)
- return 2;
-
- p = &arr[1];
- if(*(p--) != 3)
- return 1;
- if(*(p--) != 2)
- return 2;
-
- p = &arr[0];
- if(*(++p) != 3)
- return 1;
-
- p = &arr[1];
- if(*(--p) != 2)
- return 1;
-
- return 0;
-}
diff --git a/tests/0034-logandor.c b/tests/0034-logandor.c
deleted file mode 100644
index 5371622..0000000
--- a/tests/0034-logandor.c
+++ /dev/null
_AT_@ -1,46 +0,0 @@
-
-int g;
-
-int
-effect()
-{
- g = 1;
- return 1;
-}
-
-int
-main()
-{
- int x;
-
- g = 0;
- x = 0;
- if(x && effect())
- return 1;
- if(g)
- return 2;
- x = 1;
- if(x && effect()) {
- if(g != 1)
- return 3;
- } else {
- return 4;
- }
- g = 0;
- x = 1;
- if(x || effect()) {
- if(g)
- return 5;
- } else {
- return 6;
- }
- x = 0;
- if(x || effect()) {
- if(g != 1)
- return 7;
- } else {
- return 8;
- }
- return 0;
-}
-
diff --git a/tests/0035-breakcont.c b/tests/0035-breakcont.c
deleted file mode 100644
index a25ddd4..0000000
--- a/tests/0035-breakcont.c
+++ /dev/null
_AT_@ -1,33 +0,0 @@
-
-int
-main()
-{
- int x;
-
- x = 0;
- while(1)
- break;
- while(1) {
- if (x == 5) {
- break;
- }
- x = x + 1;
- continue;
- }
- for (;;) {
- if (x == 10) {
- break;
- }
- x = x + 1;
- continue;
- }
- do {
- if (x == 15) {
- break;
- }
- x = x + 1;
- continue;
- } while(1);
- return x - 15;
-}
-
diff --git a/tests/0036-notneg.c b/tests/0036-notneg.c
deleted file mode 100644
index e8bf709..0000000
--- a/tests/0036-notneg.c
+++ /dev/null
_AT_@ -1,15 +0,0 @@
-int
-main()
-{
- int x;
-
- x = 4;
- if(!x != 0)
- return 1;
- if(!!x != 1)
- return 1;
- if(-x != 0 - 4)
- return 1;
- return 0;
-}
-
diff --git a/tests/0037-assignop.c b/tests/0037-assignop.c
deleted file mode 100644
index df5cb89..0000000
--- a/tests/0037-assignop.c
+++ /dev/null
_AT_@ -1,17 +0,0 @@
-
-int
-main()
-{
- int x;
-
- x = 0;
- x += 2;
- x += 2;
- if (x != 4)
- return 1;
- x -= 3;
- if (x != 1)
- return 2;
-
- return 0;
-}
diff --git a/tests/0038-ptradd.c b/tests/0038-ptradd.c
deleted file mode 100644
index a353946..0000000
--- a/tests/0038-ptradd.c
+++ /dev/null
_AT_@ -1,17 +0,0 @@
-int
-main()
-{
- int x[2];
- int *p;
-
- x[1] = 7;
- p = &x[0];
- p = p + 1;
-
- if(*p != 7)
- return 1;
- if(&x[1] - &x[0] != 1)
- return 1;
-
- return 0;
-}
diff --git a/tests/0039-sizeof.c b/tests/0039-sizeof.c
deleted file mode 100644
index 86cbd6f..0000000
--- a/tests/0039-sizeof.c
+++ /dev/null
_AT_@ -1,10 +0,0 @@
-int
-main()
-{
- int x;
- if((sizeof (int) - 4))
- return 1;
- if((sizeof (&x) - 8))
- return 1;
- return 0;
-}
diff --git a/tests/0040-cast.c b/tests/0040-cast.c
deleted file mode 100644
index a2ebba3..0000000
--- a/tests/0040-cast.c
+++ /dev/null
_AT_@ -1,14 +0,0 @@
-
-int
-main()
-{
- void *p;
- int x;
-
- x = 2;
- p = &x;
-
- if(*((int*)p) != 2)
- return 1;
- return 0;
-}
diff --git a/tests/0041-queen.c b/tests/0041-queen.c
deleted file mode 100644
index 32e1c4c..0000000
--- a/tests/0041-queen.c
+++ /dev/null
_AT_@ -1,56 +0,0 @@
-
-int *calloc(int, int);
-
-int N;
-int *t;
-
-int
-chk(int x, int y)
-{
- int i;
- int r;
-
- for (r=i=0; i<8; i++) {
- r = r + t[x + 8*i];
- r = r + t[i + 8*y];
- if (x+i < 8 & y+i < 8)
- r = r + t[x+i + 8*(y+i)];
- if (x+i < 8 & y-i >= 0)
- r = r + t[x+i + 8*(y-i)];
- if (x-i >= 0 & y+i < 8)
- r = r + t[x-i + 8*(y+i)];
- if (x-i >= 0 & y-i >= 0)
- r = r + t[x-i + 8*(y-i)];
- }
- return r;
-}
-
-int
-go(int n, int x, int y)
-{
- if (n == 8) {
- N++;
- return 0;
- }
- for (; y<8; y++) {
- for (; x<8; x++)
- if (chk(x, y) == 0) {
- t[x + 8*y]++;
- go(n+1, x, y);
- t[x + 8*y]--;
- }
- x = 0;
- }
- return 0;
-}
-
-int
-main()
-{
- t = calloc(64, sizeof(int));
- go(0, 0, 0);
- if(N != 92)
- return 1;
- return 0;
-}
-
diff --git a/tests/0042-prime.c b/tests/0042-prime.c
deleted file mode 100644
index 75f2c6b..0000000
--- a/tests/0042-prime.c
+++ /dev/null
_AT_@ -1,27 +0,0 @@
-
-int
-main() {
- int n;
- int t;
- int c;
- int p;
-
- c = 0;
- n = 2;
- while (n < 5000) {
- t = 2;
- p = 1;
- while (t*t <= n) {
- if (n % t == 0)
- p = 0;
- t++;
- }
- n++;
- if (p)
- c++;
- }
- if (c != 669)
- return 1;
- return 0;
-}
-
diff --git a/tests/0043-union.c b/tests/0043-union.c
deleted file mode 100644
index c43cff2..0000000
--- a/tests/0043-union.c
+++ /dev/null
_AT_@ -1,14 +0,0 @@
-
-
-
-int
-main()
-{
- union { int a; int b; } u;
- u.a = 1;
- u.b = 3;
-
- if (u.a != 3 || u.b != 3)
- return 1;
- return 0;
-}
diff --git a/tests/0044-struct.c b/tests/0044-struct.c
deleted file mode 100644
index 895e55b..0000000
--- a/tests/0044-struct.c
+++ /dev/null
_AT_@ -1,19 +0,0 @@
-struct s {
- int x;
- struct {
- int y;
- int z;
- } nest;
-};
-
-int
-main() {
- struct s v;
- v.x = 1;
- v.nest.y = 2;
- v.nest.z = 3;
- if (v.x + v.nest.y + v.nest.z != 6)
- return 1;
- return 0;
-}
-
diff --git a/tests/0045-struct.c b/tests/0045-struct.c
deleted file mode 100644
index 418a4a1..0000000
--- a/tests/0045-struct.c
+++ /dev/null
_AT_@ -1,16 +0,0 @@
-struct T;
-
-struct T {
- int x;
-};
-
-int
-main()
-{
- struct T v;
- { struct T { int z; }; }
- v.x = 2;
- if(v.x != 2)
- return 1;
- return 0;
-}
diff --git a/tests/0046-inits.c b/tests/0046-inits.c
deleted file mode 100644
index 8949f87..0000000
--- a/tests/0046-inits.c
+++ /dev/null
_AT_@ -1,17 +0,0 @@
-
-int x = 5;
-long y = 6;
-int *p = &x;
-
-int
-main()
-{
- if (x != 5)
- return 1;
- if (y != 6)
- return 2;
- if (*p != 5)
- return 3;
- return 0;
-}
-
diff --git a/tests/0047-anonexport.c b/tests/0047-anonexport.c
deleted file mode 100644
index 2631df2..0000000
--- a/tests/0047-anonexport.c
+++ /dev/null
_AT_@ -1,35 +0,0 @@
-
-typedef struct {
- int a;
- union {
- int b1;
- int b2;
- };
- struct { union { struct { int c; }; struct {}; }; };
- struct {};
- struct {
- int d;
- };
-} s;
-
-int
-main()
-{
- s v;
-
- v.a = 1;
- v.b1 = 2;
- v.c = 3;
- v.d = 4;
-
- if (v.a != 1)
- return 1;
- if (v.b1 != 2 && v.b2 != 2)
- return 2;
- if (v.c != 3)
- return 3;
- if (v.d != 4)
- return 4;
-
- return 0;
-}
diff --git a/tests/0048-inits.c b/tests/0048-inits.c
deleted file mode 100644
index c0208c0..0000000
--- a/tests/0048-inits.c
+++ /dev/null
_AT_@ -1,15 +0,0 @@
-
-struct { int a; int b; int c; } s = {1, 2, 3};
-
-int
-main()
-{
- if (s.a != 1)
- return 1;
- if (s.b != 2)
- return 2;
- if (s.c != 3)
- return 3;
-
- return 0;
-}
diff --git a/tests/0049-inits.c b/tests/0049-inits.c
deleted file mode 100644
index eda8dcf..0000000
--- a/tests/0049-inits.c
+++ /dev/null
_AT_@ -1,14 +0,0 @@
-
-
-struct S {int a; int b;};
-struct S s = { .b = 2, .a = 1};
-
-int
-main()
-{
- if(s.a != 1)
- return 1;
- if(s.b != 2)
- return 2;
- return 0;
-}
diff --git a/tests/0050-inits.c b/tests/0050-inits.c
deleted file mode 100644
index 0206352..0000000
--- a/tests/0050-inits.c
+++ /dev/null
_AT_@ -1,16 +0,0 @@
-
-
-int x = 10;
-
-struct S {int a; int *p;};
-struct S s = { .p = &x, .a = 1};
-
-int
-main()
-{
- if(s.a != 1)
- return 1;
- if(*s.p != 10)
- return 2;
- return 0;
-}
diff --git a/tests/0051-inits.c b/tests/0051-inits.c
deleted file mode 100644
index face064..0000000
--- a/tests/0051-inits.c
+++ /dev/null
_AT_@ -1,34 +0,0 @@
-
-struct S1 {
- int a;
- int b;
-};
-
-struct S2 {
- int a;
- int b;
- union {
- int c;
- int d;
- };
- struct S1 s;
-};
-
-struct S2 v = {1, 2, 3, {4, 5}};
-
-int
-main()
-{
- if(v.a != 1)
- return 1;
- if(v.b != 2)
- return 2;
- if(v.c != 3 || v.d != 3)
- return 3;
- if(v.s.a != 4)
- return 4;
- if(v.s.b != 5)
- return 5;
-
- return 0;
-}
diff --git a/tests/0052-switch.c b/tests/0052-switch.c
deleted file mode 100644
index 8168ab4..0000000
--- a/tests/0052-switch.c
+++ /dev/null
_AT_@ -1,38 +0,0 @@
-int x = 0;
-
-int
-main()
-{
- switch(x)
- case 0:
- ;
- switch(x)
- case 0:
- switch(x) {
- case 0:
- goto next;
- default:
- return 1;
- }
- return 1;
- next:
- switch(x)
- case 1:
- return 1;
- switch(x) {
- {
- x = 1 + 1;
- foo:
- case 1:
- return 1;
- }
- }
- switch(x) {
- case 0:
- return x;
- case 1:
- return 1;
- default:
- return 1;
- }
-}
diff --git a/tests/0053-struct.c b/tests/0053-struct.c
deleted file mode 100644
index 912bcb6..0000000
--- a/tests/0053-struct.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-
-int
-main()
-{
- struct T { int x; };
- {
- struct T s;
- s.x = 0;
- return s.x;
- }
-}
diff --git a/tests/0054-struct.c b/tests/0054-struct.c
deleted file mode 100644
index df418eb..0000000
--- a/tests/0054-struct.c
+++ /dev/null
_AT_@ -1,14 +0,0 @@
-
-int
-main()
-{
- struct T { int x; } s1;
- s1.x = 1;
- {
- struct T { int y; } s2;
- s2.y = 1;
- if (s1.x - s2.y != 0)
- return 1;
- }
- return 0;
-}
diff --git a/tests/0055-enum.c b/tests/0055-enum.c
deleted file mode 100644
index c35a63d..0000000
--- a/tests/0055-enum.c
+++ /dev/null
_AT_@ -1,23 +0,0 @@
-
-enum E {
- x,
- y,
- z,
-};
-
-int
-main()
-{
- enum E e;
-
- if(x != 0)
- return 1;
- if(y != 1)
- return 2;
- if(z != 2)
- return 3;
-
- e = x;
- return e;
-}
-
diff --git a/tests/0056-enum.c b/tests/0056-enum.c
deleted file mode 100644
index 2cb7b2a..0000000
--- a/tests/0056-enum.c
+++ /dev/null
_AT_@ -1,23 +0,0 @@
-
-enum E {
- x,
- y = 2,
- z,
-};
-
-int
-main()
-{
- enum E e;
-
- if(x != 0)
- return 1;
- if(y != 2)
- return 2;
- if(z != 3)
- return 3;
-
- e = x;
- return e;
-}
-
diff --git a/tests/0057-duff.c b/tests/0057-duff.c
deleted file mode 100644
index 6b9aae1..0000000
--- a/tests/0057-duff.c
+++ /dev/null
_AT_@ -1,31 +0,0 @@
-
-int main()
-{
- int count, n;
- char *from, *to;
- char a[39], b[39];
-
- for(n = 0; n < 39; n++) {
- a[n] = n;
- b[n] = 0;
- }
- from = a;
- to = b;
- count = 39;
- n = (count + 7) / 8;
- switch (count % 8) {
- case 0: do { *to++ = *from++;
- case 7: *to++ = *from++;
- case 6: *to++ = *from++;
- case 5: *to++ = *from++;
- case 4: *to++ = *from++;
- case 3: *to++ = *from++;
- case 2: *to++ = *from++;
- case 1: *to++ = *from++;
- } while (--n > 0);
- }
- for(n = 0; n < 39; n++)
- if(a[n] != b[n])
- return 1;
- return 0;
-}
diff --git a/tests/0058-bug.c b/tests/0058-bug.c
deleted file mode 100644
index 8eb87cf..0000000
--- a/tests/0058-bug.c
+++ /dev/null
_AT_@ -1,10 +0,0 @@
-
-int
-main()
-{
- char a[16], b[16];
-
- if(sizeof(a) != sizeof(b))
- return 1;
- return 0;
-}
diff --git a/tests/0059-multistring.c b/tests/0059-multistring.c
deleted file mode 100644
index d0d2638..0000000
--- a/tests/0059-multistring.c
+++ /dev/null
_AT_@ -1,18 +0,0 @@
-
-
-
-int main()
-{
- char * s;
-
- s = "abc" "def";
- if(s[0] != 'a') return 1;
- if(s[1] != 'b') return 2;
- if(s[2] != 'c') return 3;
- if(s[3] != 'd') return 4;
- if(s[4] != 'e') return 5;
- if(s[5] != 'f') return 6;
- if(s[6] != 0) return 7;
-
- return 0;
-}
diff --git a/tests/0060-charlit.c b/tests/0060-charlit.c
deleted file mode 100644
index 869c531..0000000
--- a/tests/0060-charlit.c
+++ /dev/null
_AT_@ -1,9 +0,0 @@
-
-int
-main()
-{
- if ('a' != 97)
- return 1;
-
- return 0;
-}
diff --git a/tests/0061-comments.c b/tests/0061-comments.c
deleted file mode 100644
index d2f5060..0000000
--- a/tests/0061-comments.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-// line comment
-
-int
-main()
-{
- /*
- multiline
- comment
- */
- return 0;
-}
diff --git a/tests/0062-include.c b/tests/0062-include.c
deleted file mode 100644
index 12877fd..0000000
--- a/tests/0062-include.c
+++ /dev/null
_AT_@ -1,4 +0,0 @@
-#include \
-"0062-include.h"
- return 0;
-}
diff --git a/tests/0062-include.h b/tests/0062-include.h
deleted file mode 100644
index a4d76de..0000000
--- a/tests/0062-include.h
+++ /dev/null
_AT_@ -1,3 +0,0 @@
-int
-main()
-{
diff --git a/tests/0063-define.c b/tests/0063-define.c
deleted file mode 100644
index c3abf01..0000000
--- a/tests/0063-define.c
+++ /dev/null
_AT_@ -1,7 +0,0 @@
-#define FOO 0
-
-int main()
-{
- return FOO;
-}
-
diff --git a/tests/0064-sysinclude.c b/tests/0064-sysinclude.c
deleted file mode 100644
index 51ab801..0000000
--- a/tests/0064-sysinclude.c
+++ /dev/null
_AT_@ -1,7 +0,0 @@
-#include <0064-sysinclude.h>
-
-int
-main()
-{
- return x;
-}
diff --git a/tests/0065-ifdef.c b/tests/0065-ifdef.c
deleted file mode 100644
index be3665e..0000000
--- a/tests/0065-ifdef.c
+++ /dev/null
_AT_@ -1,26 +0,0 @@
-
-#ifdef FOO
- XXX
-#ifdef BAR
- XXX
-#endif
- XXX
-#endif
-
-#define FOO 1
-
-#ifdef FOO
-
-#ifdef FOO
-int x = 0;
-#endif
-
-int
-main()
-{
- return x;
-}
-#endif
-
-
-
diff --git a/tests/0066-cppelse.c b/tests/0066-cppelse.c
deleted file mode 100644
index 5020fb2..0000000
--- a/tests/0066-cppelse.c
+++ /dev/null
_AT_@ -1,20 +0,0 @@
-#define BAR 0
-#ifdef BAR
- #ifdef FOO
- XXX
- #ifdef FOO
- XXX
- #endif
- #else
- #define FOO
- #ifdef FOO
- int x = BAR;
- #endif
- #endif
-#endif
-
-int
-main()
-{
- return BAR;
-}
diff --git a/tests/0067-define.c b/tests/0067-define.c
deleted file mode 100644
index 2b3d701..0000000
--- a/tests/0067-define.c
+++ /dev/null
_AT_@ -1,7 +0,0 @@
-#define X 6 / 2
-
-int
-main()
-{
- return X - 3;
-}
diff --git a/tests/0068-funclikemacro.c b/tests/0068-funclikemacro.c
deleted file mode 100644
index 850b6ce..0000000
--- a/tests/0068-funclikemacro.c
+++ /dev/null
_AT_@ -1,8 +0,0 @@
-#define ADD(X, Y) (X + Y)
-
-
-int
-main()
-{
- return ADD(1, 2) - 3;
-}
diff --git a/tests/0069-funclikemacro.c b/tests/0069-funclikemacro.c
deleted file mode 100644
index f4f787c..0000000
--- a/tests/0069-funclikemacro.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-#define A 3
-#define FOO(X,Y,Z) X + Y + Z
-#define SEMI ;
-
-int
-main()
-{
- if(FOO(1, 2, A) != 6)
- return 1 SEMI
- return FOO(0,0,0);
-}
diff --git a/tests/0070-cppif.c b/tests/0070-cppif.c
deleted file mode 100644
index e4eef1f..0000000
--- a/tests/0070-cppif.c
+++ /dev/null
_AT_@ -1,19 +0,0 @@
-
-#if 1
-int x = 0;
-#endif
-
-#if 0
-int x = 1;
-#if 1
- X
-#endif
-#ifndef AAA
- X
-#endif
-#endif
-
-int main()
-{
- return x;
-}
diff --git a/tests/0071-cppelif.c b/tests/0071-cppelif.c
deleted file mode 100644
index 6355f47..0000000
--- a/tests/0071-cppelif.c
+++ /dev/null
_AT_@ -1,14 +0,0 @@
-
-#if 0
-X
-#elif 1
-int x = 0;
-#else
-X
-#endif
-
-int
-main()
-{
- return x;
-}
diff --git a/tests/0072-cppelif.c b/tests/0072-cppelif.c
deleted file mode 100644
index 71b351b..0000000
--- a/tests/0072-cppelif.c
+++ /dev/null
_AT_@ -1,14 +0,0 @@
-
-#if 0
-X
-#elif 0
-X
-#elif 1
-int x = 0;
-#endif
-
-int
-main()
-{
- return x;
-}
diff --git a/tests/0073-ifndef.c b/tests/0073-ifndef.c
deleted file mode 100644
index 5636dcd..0000000
--- a/tests/0073-ifndef.c
+++ /dev/null
_AT_@ -1,17 +0,0 @@
-
-
-#ifndef DEF
-int x = 0;
-#endif
-
-#define DEF
-
-#ifndef DEF
-X
-#endif
-
-int
-main()
-{
- return x;
-}
diff --git a/tests/0074-undef.c b/tests/0074-undef.c
deleted file mode 100644
index ac870e8..0000000
--- a/tests/0074-undef.c
+++ /dev/null
_AT_@ -1,13 +0,0 @@
-
-#define X 1
-#undef X
-
-#ifdef X
-FAIL
-#endif
-
-int
-main()
-{
- return 0;
-}
diff --git a/tests/0075-ptraddasn.c b/tests/0075-ptraddasn.c
deleted file mode 100644
index d3ec201..0000000
--- a/tests/0075-ptraddasn.c
+++ /dev/null
_AT_@ -1,15 +0,0 @@
-
-int
-main()
-{
- int arr[2];
- int *p;
-
- p = &arr[0];
- p += 1;
- *p = 123;
-
- if(arr[1] != 123)
- return 1;
- return 0;
-}
diff --git a/tests/0076-ptrsubasn.c b/tests/0076-ptrsubasn.c
deleted file mode 100644
index 45cb5da..0000000
--- a/tests/0076-ptrsubasn.c
+++ /dev/null
_AT_@ -1,15 +0,0 @@
-
-int
-main()
-{
- int arr[2];
- int *p;
-
- p = &arr[1];
- p -= 1;
- *p = 123;
-
- if(arr[0] != 123)
- return 1;
- return 0;
-}
diff --git a/tests/0077-defined.c b/tests/0077-defined.c
deleted file mode 100644
index 88fb17c..0000000
--- a/tests/0077-defined.c
+++ /dev/null
_AT_@ -1,33 +0,0 @@
-
-#if defined X
-X
-#endif
-
-#if defined(X)
-X
-#endif
-
-#if X
-X
-#endif
-
-#define X 0
-
-#if X
-X
-#endif
-
-#if defined(X)
-int x = 0;
-#endif
-
-#undef X
-#define X 1
-
-#if X
-int
-main()
-{
- return 0;
-}
-#endif
diff --git a/tests/0078-dirifexpr.c b/tests/0078-dirifexpr.c
deleted file mode 100644
index 9387dbf..0000000
--- a/tests/0078-dirifexpr.c
+++ /dev/null
_AT_@ -1,167 +0,0 @@
-
-#if (-2) != -2
-#error fail
-#endif
-
-#if (0 || 0) != 0
-#error fail
-#endif
-
-#if (1 || 0) != 1
-#error fail
-#endif
-
-#if (1 || 1) != 1
-#error fail
-#endif
-
-#if (0 && 0) != 0
-#error fail
-#endif
-
-#if (1 && 0) != 0
-#error fail
-#endif
-
-#if (0 && 1) != 0
-#error fail
-#endif
-
-#if (1 && 1) != 1
-#error fail
-#endif
-
-#if (0xf0 | 1) != 0xf1
-#error fail
-#endif
-
-#if (0xf0 & 1) != 0
-#error fail
-#endif
-
-#if (0xf0 & 0x1f) != 0x10
-#error fail
-#endif
-
-#if (1 ^ 1) != 0
-#error fail
-#endif
-
-#if (1 == 1) != 1
-#error fail
-#endif
-
-#if (1 == 0) != 0
-#error fail
-#endif
-
-#if (1 != 1) != 0
-#error fail
-#endif
-
-#if (0 != 1) != 1
-#error fail
-#endif
-
-#if (0 > 1) != 0
-#error fail
-#endif
-
-#if (0 < 1) != 1
-#error fail
-#endif
-
-#if (0 > -1) != 1
-#error fail
-#endif
-
-#if (0 < -1) != 0
-#error fail
-#endif
-
-#if (0 >= 1) != 0
-#error fail
-#endif
-
-#if (0 <= 1) != 1
-#error fail
-#endif
-
-#if (0 >= -1) != 1
-#error fail
-#endif
-
-#if (0 <= -1) != 0
-#error fail
-#endif
-
-#if (0 < 0) != 0
-#error fail
-#endif
-
-#if (0 <= 0) != 1
-#error fail
-#endif
-
-#if (0 > 0) != 0
-#error fail
-#endif
-
-#if (0 >= 0) != 1
-#error fail
-#endif
-
-#if (1 << 1) != 2
-#error fail
-#endif
-
-#if (2 >> 1) != 1
-#error fail
-#endif
-
-#if (2 + 1) != 3
-#error fail
-#endif
-
-#if (2 - 3) != -1
-#error fail
-#endif
-
-#if (2 * 3) != 6
-#error fail
-#endif
-
-#if (6 / 3) != 2
-#error fail
-#endif
-
-#if (7 % 3) != 1
-#error fail
-#endif
-
-#if (2+2*3+2) != 10
-#error fail
-#endif
-
-#if ((2+2)*(3+2)) != 20
-#error fail
-#endif
-
-#if (2 + 2 + 2 + 2 == 2 + 2 * 3) != 1
-#error fail
-#endif
-
-#if (0 ? 1 : 3) != 3
-#error fail
-#endif
-
-#if (1 ? 3 : 1) != 3
-#error fail
-#endif
-
-int
-main()
-{
- return 0;
-}
-
diff --git a/tests/0079-cond.c b/tests/0079-cond.c
deleted file mode 100644
index 1b1a329..0000000
--- a/tests/0079-cond.c
+++ /dev/null
_AT_@ -1,10 +0,0 @@
-
-int
-main()
-{
- if(0 ? 1 : 0)
- return 1;
- if(1 ? 0 : 1)
- return 2;
- return 0;
-}
diff --git a/tests/0080-arrays.c b/tests/0080-arrays.c
deleted file mode 100644
index 6d11cd3..0000000
--- a/tests/0080-arrays.c
+++ /dev/null
_AT_@ -1,49 +0,0 @@
-
-int
-foo(int x[100])
-{
- int y[100];
- int *p;
-
- y[0] = 2000;
-
- if(x[0] != 1000)
- {
- return 1;
- }
-
- p = x;
-
- if(p[0] != 1000)
- {
- return 2;
- }
-
- p = y;
-
- if(p[0] != 2000)
- {
- return 3;
- }
-
- if(sizeof(x) != sizeof(void*))
- {
- return 4;
- }
-
- if(sizeof(y) <= sizeof(x))
- {
- return 5;
- }
-
- return 0;
-}
-
-int
-main()
-{
- int x[100];
- x[0] = 1000;
-
- return foo(x);
-}
diff --git a/tests/0081-calls.c b/tests/0081-calls.c
deleted file mode 100644
index 64425f5..0000000
--- a/tests/0081-calls.c
+++ /dev/null
_AT_@ -1,18 +0,0 @@
-
-int
-f1(char *p)
-{
- return *p+1;
-}
-
-int
-main()
-{
- char s = 1;
- int v[1000];
- int f1(char *);
-
- if (f1(&s) != 2)
- return 1;
- return 0;
-}
diff --git a/tests/0082-bug.c b/tests/0082-bug.c
deleted file mode 100644
index ad0af76..0000000
--- a/tests/0082-bug.c
+++ /dev/null
_AT_@ -1,17 +0,0 @@
-#define x(y) ((y) + 1)
-
-int
-main()
-{
- int x;
- int y;
-
- y = 0;
- x = x(y);
-
- if(x != 1)
- return 1;
-
- return 0;
-}
-
diff --git a/tests/0083-voidret.c b/tests/0083-voidret.c
deleted file mode 100644
index e2c4ff4..0000000
--- a/tests/0083-voidret.c
+++ /dev/null
_AT_@ -1,13 +0,0 @@
-
-void
-voidfn()
-{
- return;
-}
-
-int
-main()
-{
- voidfn();
- return 0;
-}
diff --git a/tests/0084-longlong.c b/tests/0084-longlong.c
deleted file mode 100644
index a2b8580..0000000
--- a/tests/0084-longlong.c
+++ /dev/null
_AT_@ -1,12 +0,0 @@
-
-int
-main()
-{
- long long x;
-
- x = 0;
- x = x + 1;
- if (x != 1)
- return 1;
- return 0;
-}
diff --git a/tests/0085-ulonglong.c b/tests/0085-ulonglong.c
deleted file mode 100644
index dc3e356..0000000
--- a/tests/0085-ulonglong.c
+++ /dev/null
_AT_@ -1,12 +0,0 @@
-
-int
-main()
-{
- unsigned long long x;
-
- x = 0;
- x = x + 1;
- if (x != 1)
- return 1;
- return 0;
-}
diff --git a/tests/0086-variadic.c b/tests/0086-variadic.c
deleted file mode 100644
index cb05002..0000000
--- a/tests/0086-variadic.c
+++ /dev/null
_AT_@ -1,55 +0,0 @@
-#define CALL(FUN, ...) FUN(__VA_ARGS__)
-
-int
-none()
-{
- return 0;
-}
-
-int
-one(int a)
-{
- if (a != 1)
- return 1;
-
- return 0;
-}
-
-int
-two(int a, int b)
-{
- if (a != 1)
- return 1;
- if (b != 2)
- return 1;
-
- return 0;
-}
-
-int
-three(int a, int b, int c)
-{
- if (a != 1)
- return 1;
- if (b != 2)
- return 1;
- if (c != 3)
- return 1;
-
- return 0;
-}
-
-int
-main()
-{
- if (CALL(none))
- return 1;
- if (CALL(one, 1))
- return 2;
- if (CALL(two, 1, 2))
- return 3;
- if (CALL(three, 1, 2, 3))
- return 4;
-
- return 0;
-}
diff --git a/tests/0087-variadic.c b/tests/0087-variadic.c
deleted file mode 100644
index cfd0fac..0000000
--- a/tests/0087-variadic.c
+++ /dev/null
_AT_@ -1,54 +0,0 @@
-#define ARGS(...) __VA_ARGS__
-
-int
-none()
-{
- return 0;
-}
-
-int
-one(int a)
-{
- if (a != 1)
- return 1;
-
- return 0;
-}
-
-int
-two(int a, int b)
-{
- if (a != 1)
- return 1;
- if (b != 2)
- return 1;
-
- return 0;
-}
-
-int
-three(int a, int b, int c)
-{
- if (a != 1)
- return 1;
- if (b != 2)
- return 1;
- if (c != 3)
- return 1;
-
- return 0;
-}
-
-int
-main()
-{
- if (none(ARGS()))
- return 1;
- if (one(ARGS(1)))
- return 2;
- if (two(ARGS(1, 2)))
- return 3;
- if (three(ARGS(1, 2, 3)))
- return 4;
- return 0;
-}
diff --git a/tests/0088-macros.c b/tests/0088-macros.c
deleted file mode 100644
index 65d678b..0000000
--- a/tests/0088-macros.c
+++ /dev/null
_AT_@ -1,30 +0,0 @@
-#define ZERO_0() 0
-#define ZERO_1(A) 0
-#define ZERO_2(A, B) 0
-#define ZERO_VAR(...) 0
-#define ZERO_1_VAR(A, ...) 0
-
-int
-main()
-{
- if (ZERO_0())
- return 1;
- if (ZERO_1(1))
- return 1;
- if (ZERO_2(1, 2))
- return 1;
- if (ZERO_VAR())
- return 1;
- if (ZERO_VAR(1))
- return 1;
- if (ZERO_VAR(1, 2))
- return 1;
- if (ZERO_1_VAR(1))
- return 1;
- if (ZERO_1_VAR(1, 2))
- return 1;
- if (ZERO_1_VAR(1, 2, 3))
- return 1;
-
- return 0;
-}
diff --git a/tests/0089-short.c b/tests/0089-short.c
deleted file mode 100644
index 4dce16f..0000000
--- a/tests/0089-short.c
+++ /dev/null
_AT_@ -1,12 +0,0 @@
-
-int
-main()
-{
- short x;
-
- x = 0;
- x = x + 1;
- if (x != 1)
- return 1;
- return 0;
-}
diff --git a/tests/0090-fptr.c b/tests/0090-fptr.c
deleted file mode 100644
index e30edfa..0000000
--- a/tests/0090-fptr.c
+++ /dev/null
_AT_@ -1,21 +0,0 @@
-
-struct S
-{
- int (*fptr)();
-};
-
-int
-foo()
-{
- return 0;
-}
-
-int
-main()
-{
- struct S v;
-
- v.fptr = foo;
- return v.fptr();
-}
-
diff --git a/tests/0091-fptr.c b/tests/0091-fptr.c
deleted file mode 100644
index f0cf00f..0000000
--- a/tests/0091-fptr.c
+++ /dev/null
_AT_@ -1,12 +0,0 @@
-
-int (*fptr)() = 0;
-
-
-int
-main()
-{
- if (fptr)
- return 1;
- return 0;
-}
-
diff --git a/tests/0092-fptr.c b/tests/0092-fptr.c
deleted file mode 100644
index ab6b5ef..0000000
--- a/tests/0092-fptr.c
+++ /dev/null
_AT_@ -1,31 +0,0 @@
-
-int
-zero()
-{
- return 0;
-}
-
-struct S
-{
- int (*zerofunc)();
-} s = { &zero };
-
-struct S *
-anon()
-{
- return &s;
-}
-
-typedef struct S * (*fty)();
-
-fty
-go()
-{
- return &anon;
-}
-
-int
-main()
-{
- return go()()->zerofunc();
-}
diff --git a/tests/0093-arrayinit.c b/tests/0093-arrayinit.c
deleted file mode 100644
index 21f7118..0000000
--- a/tests/0093-arrayinit.c
+++ /dev/null
_AT_@ -1,15 +0,0 @@
-
-int a[3] = {0, 1, 2};
-
-int
-main()
-{
- if (a[0] != 0)
- return 1;
- if (a[1] != 1)
- return 2;
- if (a[2] != 2)
- return 3;
-
- return 0;
-}
diff --git a/tests/0094-arrayinit.c b/tests/0094-arrayinit.c
deleted file mode 100644
index e90d5f3..0000000
--- a/tests/0094-arrayinit.c
+++ /dev/null
_AT_@ -1,20 +0,0 @@
-
-typedef struct {
- int v;
- int sub[2];
-} S;
-
-S a[1] = {{1, {2, 3}}};
-
-int
-main()
-{
- if (a[0].v != 1)
- return 1;
- if (a[0].sub[0] != 2)
- return 2;
- if (a[0].sub[1] != 3)
- return 3;
-
- return 0;
-}
diff --git a/tests/0095-arrayselector.c b/tests/0095-arrayselector.c
deleted file mode 100644
index 19341f2..0000000
--- a/tests/0095-arrayselector.c
+++ /dev/null
_AT_@ -1,23 +0,0 @@
-
-
-
-
-int a[] = {5, [2] = 2, 3};
-
-int
-main()
-{
- if (sizeof(a) != 4*sizeof(int))
- return 1;
-
- if (a[0] != 5)
- return 2;
- if (a[1] != 0)
- return 3;
- if (a[2] != 2)
- return 4;
- if (a[3] != 3)
- return 5;
-
- return 0;
-}
diff --git a/tests/0096-inferredarraysize.c b/tests/0096-inferredarraysize.c
deleted file mode 100644
index 31758d8..0000000
--- a/tests/0096-inferredarraysize.c
+++ /dev/null
_AT_@ -1,12 +0,0 @@
-
-
-int a[] = {1, 2, 3, 4};
-
-int
-main()
-{
- if (sizeof(a) != 4*sizeof(int))
- return 1;
-
- return 0;
-}
diff --git a/tests/0097-extern.c b/tests/0097-extern.c
deleted file mode 100644
index b71ada8..0000000
--- a/tests/0097-extern.c
+++ /dev/null
_AT_@ -1,6 +0,0 @@
-extern int x;
-
-int main()
-{
- return 0;
-}
diff --git a/tests/0098-tentative.c b/tests/0098-tentative.c
deleted file mode 100644
index 1184b85..0000000
--- a/tests/0098-tentative.c
+++ /dev/null
_AT_@ -1,23 +0,0 @@
-
-int x;
-int x = 3;
-int x;
-
-int main();
-
-void *
-foo()
-{
- return &main;
-}
-
-int
-main()
-{
- if (x != 3)
- return 0;
-
- x = 0;
- return x;
-}
-
diff --git a/tests/0099-tentative.c b/tests/0099-tentative.c
deleted file mode 100644
index 37165a8..0000000
--- a/tests/0099-tentative.c
+++ /dev/null
_AT_@ -1,13 +0,0 @@
-
-int x, x = 3, x;
-
-int
-main()
-{
- if (x != 3)
- return 0;
-
- x = 0;
- return x;
-}
-
diff --git a/tests/0100-redeclaremacro.c b/tests/0100-redeclaremacro.c
deleted file mode 100644
index cf94041..0000000
--- a/tests/0100-redeclaremacro.c
+++ /dev/null
_AT_@ -1,15 +0,0 @@
-
-#define NULL ((void*)0)
-#define NULL ((void*)0)
-
-#define FOO(X, Y) (X + Y + Z)
-#define FOO(X, Y) (X + Y + Z)
-
-#define BAR(X, Y, ...) (X + Y + Z)
-#define BAR(X, Y, ...) (X + Y + Z)
-
-int
-main()
-{
- return 0;
-}
diff --git a/tests/0101-wcharlit.c b/tests/0101-wcharlit.c
deleted file mode 100644
index 194db7b..0000000
--- a/tests/0101-wcharlit.c
+++ /dev/null
_AT_@ -1,6 +0,0 @@
-
-int
-main()
-{
- return L'\0';
-}
diff --git a/tests/0102-bug.c b/tests/0102-bug.c
deleted file mode 100644
index 06c77bd..0000000
--- a/tests/0102-bug.c
+++ /dev/null
_AT_@ -1,14 +0,0 @@
-// This wouldn't compile
-
-typedef struct { } Vec;
-
-static void
-vecresize(Vec *v, int cap)
-{
- return;
-}
-
-int main()
-{
- return 0;
-}
diff --git a/tests/0103-voidparm.c b/tests/0103-voidparm.c
deleted file mode 100644
index c67452a..0000000
--- a/tests/0103-voidparm.c
+++ /dev/null
_AT_@ -1,12 +0,0 @@
-
-int
-foo(void)
-{
- return 0;
-}
-
-int
-main()
-{
- return foo();
-}
diff --git a/tests/0104-voidparm.c b/tests/0104-voidparm.c
deleted file mode 100644
index 633b86f..0000000
--- a/tests/0104-voidparm.c
+++ /dev/null
_AT_@ -1,11 +0,0 @@
-
-int
-main()
-{
- int c;
- c = 0;
- do
- ;
- while (0);
- return c;
-}
diff --git a/tests/0105-shl.c b/tests/0105-shl.c
deleted file mode 100644
index 53c2faf..0000000
--- a/tests/0105-shl.c
+++ /dev/null
_AT_@ -1,12 +0,0 @@
-
-int
-main()
-{
- int x;
-
- x = 1;
- if ((x << 1) != 2)
- return 1;
-
- return 0;
-}
diff --git a/tests/0106-ppcast.c b/tests/0106-ppcast.c
deleted file mode 100644
index 9fc1478..0000000
--- a/tests/0106-ppcast.c
+++ /dev/null
_AT_@ -1,15 +0,0 @@
-
-int
-main()
-{
- int x;
- void *foo;
- void **bar;
-
- x = 0;
-
- foo = (void*)&x;
- bar = &foo;
-
- return **(int**)bar;
-}
diff --git a/tests/0107-bnot.c b/tests/0107-bnot.c
deleted file mode 100644
index 464e7f2..0000000
--- a/tests/0107-bnot.c
+++ /dev/null
_AT_@ -1,22 +0,0 @@
-
-
-int
-main()
-{
- int x;
- long long l;
-
- x = 0;
- l = 0;
-
- x = ~x;
- if (x != 0xffffffff)
- return 1;
-
- l = ~l;
- if (x != 0xffffffffffffffff)
- return 2;
-
-
- return 0;
-}
diff --git a/tests/0108-bug.c b/tests/0108-bug.c
deleted file mode 100644
index 34d9f97..0000000
--- a/tests/0108-bug.c
+++ /dev/null
_AT_@ -1,13 +0,0 @@
-
-
-int
-main()
-{
- int i;
-
- for(i = 0; i < 10; i++)
- if (!i)
- continue;
-
- return 0;
-}
diff --git a/tests/README b/tests/README
deleted file mode 100644
index aca0de8..0000000
--- a/tests/README
+++ /dev/null
_AT_@ -1,2 +0,0 @@
-These tests are taken from https://github.com/andrewchambers/qc.
-All the credits for this test suite are for Andrew Chambers.
diff --git a/tests/chktest.sh b/tests/chktest.sh
deleted file mode 100755
index 950e31d..0000000
--- a/tests/chktest.sh
+++ /dev/null
_AT_@ -1,12 +0,0 @@
-#!/bin/sh
-
-trap 'tabs -8;rm -f a.out' 0 1 2 3 15
-tabs 40
-ulimit -c 0
-
-for i in $_AT_
-do
- printf "%s\t" $i
- rm -f a.out
- (scc -Iinclude -m qbe "$i" && ./a.out) 2>/dev/null && echo [OK] || echo [FAILED]
-done
diff --git a/tests/compose.sh b/tests/compose.sh
deleted file mode 100755
index 0492fbb..0000000
--- a/tests/compose.sh
+++ /dev/null
_AT_@ -1,23 +0,0 @@
-#!/bin/sh
-
-rm -f tmp_test.c
-rm -f tests.h
-rm -f tmp_*.c
-
-(echo '#include "tests.h"'
-echo 'int main()'
-echo '{'
-
-for i in *-*.c
-do
- n=`echo $i | sed 's/\(.*\)-.*\.c/\1/'`
- sed s/main/main_$n/ < $i > tmp_$n.c
- echo "int main_$n();" >> tests.h
- echo "main_$n();"
-
-done
-
-echo 'return 0;'
-echo '}'
-) > tmp_test.c
-
diff --git a/tests/execute/0001-sanity.c b/tests/execute/0001-sanity.c
new file mode 100644
index 0000000..d659c45
--- /dev/null
+++ b/tests/execute/0001-sanity.c
_AT_@ -0,0 +1,6 @@
+
+int
+main()
+{
+ return 0;
+}
diff --git a/tests/execute/0002-expr.c b/tests/execute/0002-expr.c
new file mode 100644
index 0000000..75b8616
--- /dev/null
+++ b/tests/execute/0002-expr.c
_AT_@ -0,0 +1,6 @@
+
+int
+main()
+{
+ return 3-3;
+}
diff --git a/tests/execute/0003-local.c b/tests/execute/0003-local.c
new file mode 100644
index 0000000..894d770
--- /dev/null
+++ b/tests/execute/0003-local.c
_AT_@ -0,0 +1,10 @@
+
+
+int
+main()
+{
+ int x;
+
+ x = 4;
+ return x - 4;
+}
diff --git a/tests/execute/0004-pointer.c b/tests/execute/0004-pointer.c
new file mode 100644
index 0000000..d5d471a
--- /dev/null
+++ b/tests/execute/0004-pointer.c
_AT_@ -0,0 +1,14 @@
+
+
+int
+main()
+{
+ int x;
+ int *p;
+
+ x = 4;
+ p = &x;
+ *p = 0;
+
+ return *p;
+}
diff --git a/tests/execute/0005-ifstmt.c b/tests/execute/0005-ifstmt.c
new file mode 100644
index 0000000..2122c45
--- /dev/null
+++ b/tests/execute/0005-ifstmt.c
_AT_@ -0,0 +1,24 @@
+
+int
+main()
+{
+ int x;
+ int *p;
+ int **pp;
+
+ x = 0;
+ p = &x;
+ pp = &p;
+
+ if(*p)
+ return 1;
+ if(**pp)
+ return 1;
+ else
+ **pp = 1;
+
+ if(x)
+ return 0;
+ else
+ return 1;
+}
diff --git a/tests/execute/0006-whilestmt.c b/tests/execute/0006-whilestmt.c
new file mode 100644
index 0000000..bc2068e
--- /dev/null
+++ b/tests/execute/0006-whilestmt.c
_AT_@ -0,0 +1,11 @@
+
+int
+main()
+{
+ int x;
+
+ x = 50;
+ while (x)
+ x = x - 1;
+ return x;
+}
diff --git a/tests/execute/0007-forstmt.c b/tests/execute/0007-forstmt.c
new file mode 100644
index 0000000..99466ef
--- /dev/null
+++ b/tests/execute/0007-forstmt.c
_AT_@ -0,0 +1,16 @@
+
+int
+main()
+{
+ int x;
+
+ x = 1;
+ for(x = 10; x; x = x - 1)
+ ;
+ if(x)
+ return 1;
+ x = 10;
+ for (;x;)
+ x = x - 1;
+ return x;
+}
diff --git a/tests/execute/0008-dowhilestmt.c b/tests/execute/0008-dowhilestmt.c
new file mode 100644
index 0000000..ecde256
--- /dev/null
+++ b/tests/execute/0008-dowhilestmt.c
_AT_@ -0,0 +1,12 @@
+
+int
+main()
+{
+ int x;
+
+ x = 50;
+ do
+ x = x - 1;
+ while(x);
+ return x;
+}
diff --git a/tests/execute/0009-expr.c b/tests/execute/0009-expr.c
new file mode 100644
index 0000000..f9a3509
--- /dev/null
+++ b/tests/execute/0009-expr.c
_AT_@ -0,0 +1,12 @@
+
+int
+main()
+{
+ int x;
+
+ x = 1;
+ x = x * 10;
+ x = x / 2;
+ x = x % 3;
+ return x - 2;
+}
diff --git a/tests/execute/0010-goto.c b/tests/execute/0010-goto.c
new file mode 100644
index 0000000..d5bfbbf
--- /dev/null
+++ b/tests/execute/0010-goto.c
_AT_@ -0,0 +1,13 @@
+int
+main()
+{
+ start:
+ goto next;
+ return 1;
+ success:
+ return 0;
+ next:
+ foo:
+ goto success;
+ return 1;
+}
diff --git a/tests/execute/0011-assign.c b/tests/execute/0011-assign.c
new file mode 100644
index 0000000..831ebeb
--- /dev/null
+++ b/tests/execute/0011-assign.c
_AT_@ -0,0 +1,9 @@
+
+int
+main()
+{
+ int x;
+ int y;
+ x = y = 0;
+ return x;
+}
diff --git a/tests/execute/0012-expr.c b/tests/execute/0012-expr.c
new file mode 100644
index 0000000..654dc11
--- /dev/null
+++ b/tests/execute/0012-expr.c
_AT_@ -0,0 +1,6 @@
+
+int
+main()
+{
+ return (2 + 2) * 2 - 8;
+}
diff --git a/tests/execute/0013-addridx.c b/tests/execute/0013-addridx.c
new file mode 100644
index 0000000..1e51a0e
--- /dev/null
+++ b/tests/execute/0013-addridx.c
_AT_@ -0,0 +1,11 @@
+
+int
+main()
+{
+ int x;
+ int *p;
+
+ x = 0;
+ p = &x;
+ return p[0];
+}
diff --git a/tests/execute/0014-assignidx.c b/tests/execute/0014-assignidx.c
new file mode 100644
index 0000000..3b11891
--- /dev/null
+++ b/tests/execute/0014-assignidx.c
_AT_@ -0,0 +1,12 @@
+
+int
+main()
+{
+ int x;
+ int *p;
+
+ x = 1;
+ p = &x;
+ p[0] = 0;
+ return x;
+}
diff --git a/tests/execute/0015-localarray.c b/tests/execute/0015-localarray.c
new file mode 100644
index 0000000..fef1794
--- /dev/null
+++ b/tests/execute/0015-localarray.c
_AT_@ -0,0 +1,11 @@
+
+int
+main()
+{
+ int arr[2];
+
+ arr[0] = 1;
+ arr[1] = 2;
+
+ return arr[0] + arr[1] - 3;
+}
diff --git a/tests/execute/0016-addrarray.c b/tests/execute/0016-addrarray.c
new file mode 100644
index 0000000..9db7edb
--- /dev/null
+++ b/tests/execute/0016-addrarray.c
_AT_@ -0,0 +1,10 @@
+int
+main()
+{
+ int arr[2];
+ int *p;
+
+ p = &arr[1];
+ *p = 0;
+ return arr[1];
+}
diff --git a/tests/execute/0017-struct.c b/tests/execute/0017-struct.c
new file mode 100644
index 0000000..d74481b
--- /dev/null
+++ b/tests/execute/0017-struct.c
_AT_@ -0,0 +1,11 @@
+
+
+int
+main()
+{
+ struct { int x; int y; } s;
+
+ s.x = 3;
+ s.y = 5;
+ return s.y - s.x - 2;
+}
diff --git a/tests/execute/0018-structptr.c b/tests/execute/0018-structptr.c
new file mode 100644
index 0000000..58b6b5d
--- /dev/null
+++ b/tests/execute/0018-structptr.c
_AT_@ -0,0 +1,15 @@
+
+
+int
+main()
+{
+
+ struct S { int x; int y; } s;
+ struct S *p;
+
+ p = &s;
+ s.x = 1;
+ p->y = 2;
+ return p->y + p->x - 3;
+}
+
diff --git a/tests/execute/0019-selfrefstruct.c b/tests/execute/0019-selfrefstruct.c
new file mode 100644
index 0000000..768c36f
--- /dev/null
+++ b/tests/execute/0019-selfrefstruct.c
_AT_@ -0,0 +1,11 @@
+
+int
+main()
+{
+ struct S { struct S *p; int x; } s;
+
+ s.x = 0;
+ s.p = &s;
+ return s.p->p->p->p->p->x;
+}
+
diff --git a/tests/execute/0020-ptrptr.c b/tests/execute/0020-ptrptr.c
new file mode 100644
index 0000000..4209c90
--- /dev/null
+++ b/tests/execute/0020-ptrptr.c
_AT_@ -0,0 +1,11 @@
+
+int
+main()
+{
+ int x, *p, **pp;
+
+ x = 0;
+ p = &x;
+ pp = &p;
+ return **pp;
+}
diff --git a/tests/execute/0021-intfunc.c b/tests/execute/0021-intfunc.c
new file mode 100644
index 0000000..9633851
--- /dev/null
+++ b/tests/execute/0021-intfunc.c
_AT_@ -0,0 +1,13 @@
+
+int
+foo(int a, int b)
+{
+ return 2 + a - b;
+}
+
+int
+main()
+{
+ return foo(1, 3);
+}
+
diff --git a/tests/execute/0022-typedef.c b/tests/execute/0022-typedef.c
new file mode 100644
index 0000000..81fd3b1
--- /dev/null
+++ b/tests/execute/0022-typedef.c
_AT_@ -0,0 +1,11 @@
+
+typedef int x;
+
+int
+main()
+{
+ x v;
+ v = 0;
+ return v;
+}
+
diff --git a/tests/execute/0023-global.c b/tests/execute/0023-global.c
new file mode 100644
index 0000000..f058f49
--- /dev/null
+++ b/tests/execute/0023-global.c
_AT_@ -0,0 +1,10 @@
+
+int x;
+
+int
+main()
+{
+ x = 0;
+ return x;
+}
+
diff --git a/tests/execute/0024-typedefstruct.c b/tests/execute/0024-typedefstruct.c
new file mode 100644
index 0000000..67e6ed8
--- /dev/null
+++ b/tests/execute/0024-typedefstruct.c
_AT_@ -0,0 +1,13 @@
+
+typedef struct { int x; int y; } s;
+
+s v;
+
+int
+main()
+{
+ v.x = 1;
+ v.y = 2;
+ return 3 - v.x - v.y;
+}
+
diff --git a/tests/execute/0025-string.c b/tests/execute/0025-string.c
new file mode 100644
index 0000000..4b2ae82
--- /dev/null
+++ b/tests/execute/0025-string.c
_AT_@ -0,0 +1,11 @@
+
+int strlen(char *);
+
+int
+main()
+{
+ char *p;
+
+ p = "hello";
+ return strlen(p) - 5;
+}
diff --git a/tests/execute/0026-implicitret.c b/tests/execute/0026-implicitret.c
new file mode 100644
index 0000000..0867241
--- /dev/null
+++ b/tests/execute/0026-implicitret.c
_AT_@ -0,0 +1,6 @@
+
+main()
+{
+ return 0;
+}
+
diff --git a/tests/execute/0027-charval.c b/tests/execute/0027-charval.c
new file mode 100644
index 0000000..2f6d40a
--- /dev/null
+++ b/tests/execute/0027-charval.c
_AT_@ -0,0 +1,9 @@
+
+int
+main()
+{
+ char *p;
+
+ p = "hello";
+ return p[0] - 104;
+}
diff --git a/tests/execute/0028-bor.c b/tests/execute/0028-bor.c
new file mode 100644
index 0000000..92beb1f
--- /dev/null
+++ b/tests/execute/0028-bor.c
_AT_@ -0,0 +1,11 @@
+
+int
+main()
+{
+ int x;
+
+ x = 1;
+ x = x | 4;
+ return x - 5;
+}
+
diff --git a/tests/execute/0029-band.c b/tests/execute/0029-band.c
new file mode 100644
index 0000000..53e264e
--- /dev/null
+++ b/tests/execute/0029-band.c
_AT_@ -0,0 +1,11 @@
+
+int
+main()
+{
+ int x;
+
+ x = 1;
+ x = x & 3;
+ return x - 1;
+}
+
diff --git a/tests/execute/0030-bxor.c b/tests/execute/0030-bxor.c
new file mode 100644
index 0000000..238955a
--- /dev/null
+++ b/tests/execute/0030-bxor.c
_AT_@ -0,0 +1,11 @@
+
+int
+main()
+{
+ int x;
+
+ x = 1;
+ x = x ^ 3;
+ return x - 2;
+}
+
diff --git a/tests/execute/0031-relop.c b/tests/execute/0031-relop.c
new file mode 100644
index 0000000..643d130
--- /dev/null
+++ b/tests/execute/0031-relop.c
_AT_@ -0,0 +1,25 @@
+
+int
+f()
+{
+ return 100;
+}
+
+int
+main()
+{
+ if (f() > 1000)
+ return 1;
+ if (f() >= 1000)
+ return 1;
+ if (1000 < f())
+ return 1;
+ if (1000 <= f())
+ return 1;
+ if (1000 == f())
+ return 1;
+ if (100 != f())
+ return 1;
+ return 0;
+}
+
diff --git a/tests/execute/0032-indec.c b/tests/execute/0032-indec.c
new file mode 100644
index 0000000..45748eb
--- /dev/null
+++ b/tests/execute/0032-indec.c
_AT_@ -0,0 +1,49 @@
+
+int
+zero()
+{
+ return 0;
+}
+
+int
+one()
+{
+ return 1;
+}
+
+int
+main()
+{
+ int x;
+ int y;
+
+ x = zero();
+ y = ++x;
+ if (x != 1)
+ return 1;
+ if (y != 1)
+ return 1;
+
+ x = one();
+ y = --x;
+ if (x != 0)
+ return 1;
+ if (y != 0)
+ return 1;
+
+ x = zero();
+ y = x++;
+ if (x != 1)
+ return 1;
+ if (y != 0)
+ return 1;
+
+ x = one();
+ y = x--;
+ if (x != 0)
+ return 1;
+ if (y != 1)
+ return 1;
+
+ return 0;
+}
diff --git a/tests/execute/0033-ptrindec.c b/tests/execute/0033-ptrindec.c
new file mode 100644
index 0000000..30d4271
--- /dev/null
+++ b/tests/execute/0033-ptrindec.c
_AT_@ -0,0 +1,32 @@
+
+
+int
+main()
+{
+ int arr[2];
+ int *p;
+
+ arr[0] = 2;
+ arr[1] = 3;
+ p = &arr[0];
+ if(*(p++) != 2)
+ return 1;
+ if(*(p++) != 3)
+ return 2;
+
+ p = &arr[1];
+ if(*(p--) != 3)
+ return 1;
+ if(*(p--) != 2)
+ return 2;
+
+ p = &arr[0];
+ if(*(++p) != 3)
+ return 1;
+
+ p = &arr[1];
+ if(*(--p) != 2)
+ return 1;
+
+ return 0;
+}
diff --git a/tests/execute/0034-logandor.c b/tests/execute/0034-logandor.c
new file mode 100644
index 0000000..5371622
--- /dev/null
+++ b/tests/execute/0034-logandor.c
_AT_@ -0,0 +1,46 @@
+
+int g;
+
+int
+effect()
+{
+ g = 1;
+ return 1;
+}
+
+int
+main()
+{
+ int x;
+
+ g = 0;
+ x = 0;
+ if(x && effect())
+ return 1;
+ if(g)
+ return 2;
+ x = 1;
+ if(x && effect()) {
+ if(g != 1)
+ return 3;
+ } else {
+ return 4;
+ }
+ g = 0;
+ x = 1;
+ if(x || effect()) {
+ if(g)
+ return 5;
+ } else {
+ return 6;
+ }
+ x = 0;
+ if(x || effect()) {
+ if(g != 1)
+ return 7;
+ } else {
+ return 8;
+ }
+ return 0;
+}
+
diff --git a/tests/execute/0035-breakcont.c b/tests/execute/0035-breakcont.c
new file mode 100644
index 0000000..a25ddd4
--- /dev/null
+++ b/tests/execute/0035-breakcont.c
_AT_@ -0,0 +1,33 @@
+
+int
+main()
+{
+ int x;
+
+ x = 0;
+ while(1)
+ break;
+ while(1) {
+ if (x == 5) {
+ break;
+ }
+ x = x + 1;
+ continue;
+ }
+ for (;;) {
+ if (x == 10) {
+ break;
+ }
+ x = x + 1;
+ continue;
+ }
+ do {
+ if (x == 15) {
+ break;
+ }
+ x = x + 1;
+ continue;
+ } while(1);
+ return x - 15;
+}
+
diff --git a/tests/execute/0036-notneg.c b/tests/execute/0036-notneg.c
new file mode 100644
index 0000000..e8bf709
--- /dev/null
+++ b/tests/execute/0036-notneg.c
_AT_@ -0,0 +1,15 @@
+int
+main()
+{
+ int x;
+
+ x = 4;
+ if(!x != 0)
+ return 1;
+ if(!!x != 1)
+ return 1;
+ if(-x != 0 - 4)
+ return 1;
+ return 0;
+}
+
diff --git a/tests/execute/0037-assignop.c b/tests/execute/0037-assignop.c
new file mode 100644
index 0000000..df5cb89
--- /dev/null
+++ b/tests/execute/0037-assignop.c
_AT_@ -0,0 +1,17 @@
+
+int
+main()
+{
+ int x;
+
+ x = 0;
+ x += 2;
+ x += 2;
+ if (x != 4)
+ return 1;
+ x -= 3;
+ if (x != 1)
+ return 2;
+
+ return 0;
+}
diff --git a/tests/execute/0038-ptradd.c b/tests/execute/0038-ptradd.c
new file mode 100644
index 0000000..a353946
--- /dev/null
+++ b/tests/execute/0038-ptradd.c
_AT_@ -0,0 +1,17 @@
+int
+main()
+{
+ int x[2];
+ int *p;
+
+ x[1] = 7;
+ p = &x[0];
+ p = p + 1;
+
+ if(*p != 7)
+ return 1;
+ if(&x[1] - &x[0] != 1)
+ return 1;
+
+ return 0;
+}
diff --git a/tests/execute/0039-sizeof.c b/tests/execute/0039-sizeof.c
new file mode 100644
index 0000000..86cbd6f
--- /dev/null
+++ b/tests/execute/0039-sizeof.c
_AT_@ -0,0 +1,10 @@
+int
+main()
+{
+ int x;
+ if((sizeof (int) - 4))
+ return 1;
+ if((sizeof (&x) - 8))
+ return 1;
+ return 0;
+}
diff --git a/tests/execute/0040-cast.c b/tests/execute/0040-cast.c
new file mode 100644
index 0000000..a2ebba3
--- /dev/null
+++ b/tests/execute/0040-cast.c
_AT_@ -0,0 +1,14 @@
+
+int
+main()
+{
+ void *p;
+ int x;
+
+ x = 2;
+ p = &x;
+
+ if(*((int*)p) != 2)
+ return 1;
+ return 0;
+}
diff --git a/tests/execute/0041-queen.c b/tests/execute/0041-queen.c
new file mode 100644
index 0000000..32e1c4c
--- /dev/null
+++ b/tests/execute/0041-queen.c
_AT_@ -0,0 +1,56 @@
+
+int *calloc(int, int);
+
+int N;
+int *t;
+
+int
+chk(int x, int y)
+{
+ int i;
+ int r;
+
+ for (r=i=0; i<8; i++) {
+ r = r + t[x + 8*i];
+ r = r + t[i + 8*y];
+ if (x+i < 8 & y+i < 8)
+ r = r + t[x+i + 8*(y+i)];
+ if (x+i < 8 & y-i >= 0)
+ r = r + t[x+i + 8*(y-i)];
+ if (x-i >= 0 & y+i < 8)
+ r = r + t[x-i + 8*(y+i)];
+ if (x-i >= 0 & y-i >= 0)
+ r = r + t[x-i + 8*(y-i)];
+ }
+ return r;
+}
+
+int
+go(int n, int x, int y)
+{
+ if (n == 8) {
+ N++;
+ return 0;
+ }
+ for (; y<8; y++) {
+ for (; x<8; x++)
+ if (chk(x, y) == 0) {
+ t[x + 8*y]++;
+ go(n+1, x, y);
+ t[x + 8*y]--;
+ }
+ x = 0;
+ }
+ return 0;
+}
+
+int
+main()
+{
+ t = calloc(64, sizeof(int));
+ go(0, 0, 0);
+ if(N != 92)
+ return 1;
+ return 0;
+}
+
diff --git a/tests/execute/0042-prime.c b/tests/execute/0042-prime.c
new file mode 100644
index 0000000..75f2c6b
--- /dev/null
+++ b/tests/execute/0042-prime.c
_AT_@ -0,0 +1,27 @@
+
+int
+main() {
+ int n;
+ int t;
+ int c;
+ int p;
+
+ c = 0;
+ n = 2;
+ while (n < 5000) {
+ t = 2;
+ p = 1;
+ while (t*t <= n) {
+ if (n % t == 0)
+ p = 0;
+ t++;
+ }
+ n++;
+ if (p)
+ c++;
+ }
+ if (c != 669)
+ return 1;
+ return 0;
+}
+
diff --git a/tests/execute/0043-union.c b/tests/execute/0043-union.c
new file mode 100644
index 0000000..c43cff2
--- /dev/null
+++ b/tests/execute/0043-union.c
_AT_@ -0,0 +1,14 @@
+
+
+
+int
+main()
+{
+ union { int a; int b; } u;
+ u.a = 1;
+ u.b = 3;
+
+ if (u.a != 3 || u.b != 3)
+ return 1;
+ return 0;
+}
diff --git a/tests/execute/0044-struct.c b/tests/execute/0044-struct.c
new file mode 100644
index 0000000..895e55b
--- /dev/null
+++ b/tests/execute/0044-struct.c
_AT_@ -0,0 +1,19 @@
+struct s {
+ int x;
+ struct {
+ int y;
+ int z;
+ } nest;
+};
+
+int
+main() {
+ struct s v;
+ v.x = 1;
+ v.nest.y = 2;
+ v.nest.z = 3;
+ if (v.x + v.nest.y + v.nest.z != 6)
+ return 1;
+ return 0;
+}
+
diff --git a/tests/execute/0045-struct.c b/tests/execute/0045-struct.c
new file mode 100644
index 0000000..418a4a1
--- /dev/null
+++ b/tests/execute/0045-struct.c
_AT_@ -0,0 +1,16 @@
+struct T;
+
+struct T {
+ int x;
+};
+
+int
+main()
+{
+ struct T v;
+ { struct T { int z; }; }
+ v.x = 2;
+ if(v.x != 2)
+ return 1;
+ return 0;
+}
diff --git a/tests/execute/0046-inits.c b/tests/execute/0046-inits.c
new file mode 100644
index 0000000..8949f87
--- /dev/null
+++ b/tests/execute/0046-inits.c
_AT_@ -0,0 +1,17 @@
+
+int x = 5;
+long y = 6;
+int *p = &x;
+
+int
+main()
+{
+ if (x != 5)
+ return 1;
+ if (y != 6)
+ return 2;
+ if (*p != 5)
+ return 3;
+ return 0;
+}
+
diff --git a/tests/execute/0047-anonexport.c b/tests/execute/0047-anonexport.c
new file mode 100644
index 0000000..2631df2
--- /dev/null
+++ b/tests/execute/0047-anonexport.c
_AT_@ -0,0 +1,35 @@
+
+typedef struct {
+ int a;
+ union {
+ int b1;
+ int b2;
+ };
+ struct { union { struct { int c; }; struct {}; }; };
+ struct {};
+ struct {
+ int d;
+ };
+} s;
+
+int
+main()
+{
+ s v;
+
+ v.a = 1;
+ v.b1 = 2;
+ v.c = 3;
+ v.d = 4;
+
+ if (v.a != 1)
+ return 1;
+ if (v.b1 != 2 && v.b2 != 2)
+ return 2;
+ if (v.c != 3)
+ return 3;
+ if (v.d != 4)
+ return 4;
+
+ return 0;
+}
diff --git a/tests/execute/0048-inits.c b/tests/execute/0048-inits.c
new file mode 100644
index 0000000..c0208c0
--- /dev/null
+++ b/tests/execute/0048-inits.c
_AT_@ -0,0 +1,15 @@
+
+struct { int a; int b; int c; } s = {1, 2, 3};
+
+int
+main()
+{
+ if (s.a != 1)
+ return 1;
+ if (s.b != 2)
+ return 2;
+ if (s.c != 3)
+ return 3;
+
+ return 0;
+}
diff --git a/tests/execute/0049-inits.c b/tests/execute/0049-inits.c
new file mode 100644
index 0000000..eda8dcf
--- /dev/null
+++ b/tests/execute/0049-inits.c
_AT_@ -0,0 +1,14 @@
+
+
+struct S {int a; int b;};
+struct S s = { .b = 2, .a = 1};
+
+int
+main()
+{
+ if(s.a != 1)
+ return 1;
+ if(s.b != 2)
+ return 2;
+ return 0;
+}
diff --git a/tests/execute/0050-inits.c b/tests/execute/0050-inits.c
new file mode 100644
index 0000000..0206352
--- /dev/null
+++ b/tests/execute/0050-inits.c
_AT_@ -0,0 +1,16 @@
+
+
+int x = 10;
+
+struct S {int a; int *p;};
+struct S s = { .p = &x, .a = 1};
+
+int
+main()
+{
+ if(s.a != 1)
+ return 1;
+ if(*s.p != 10)
+ return 2;
+ return 0;
+}
diff --git a/tests/execute/0051-inits.c b/tests/execute/0051-inits.c
new file mode 100644
index 0000000..face064
--- /dev/null
+++ b/tests/execute/0051-inits.c
_AT_@ -0,0 +1,34 @@
+
+struct S1 {
+ int a;
+ int b;
+};
+
+struct S2 {
+ int a;
+ int b;
+ union {
+ int c;
+ int d;
+ };
+ struct S1 s;
+};
+
+struct S2 v = {1, 2, 3, {4, 5}};
+
+int
+main()
+{
+ if(v.a != 1)
+ return 1;
+ if(v.b != 2)
+ return 2;
+ if(v.c != 3 || v.d != 3)
+ return 3;
+ if(v.s.a != 4)
+ return 4;
+ if(v.s.b != 5)
+ return 5;
+
+ return 0;
+}
diff --git a/tests/execute/0052-switch.c b/tests/execute/0052-switch.c
new file mode 100644
index 0000000..8168ab4
--- /dev/null
+++ b/tests/execute/0052-switch.c
_AT_@ -0,0 +1,38 @@
+int x = 0;
+
+int
+main()
+{
+ switch(x)
+ case 0:
+ ;
+ switch(x)
+ case 0:
+ switch(x) {
+ case 0:
+ goto next;
+ default:
+ return 1;
+ }
+ return 1;
+ next:
+ switch(x)
+ case 1:
+ return 1;
+ switch(x) {
+ {
+ x = 1 + 1;
+ foo:
+ case 1:
+ return 1;
+ }
+ }
+ switch(x) {
+ case 0:
+ return x;
+ case 1:
+ return 1;
+ default:
+ return 1;
+ }
+}
diff --git a/tests/execute/0053-struct.c b/tests/execute/0053-struct.c
new file mode 100644
index 0000000..912bcb6
--- /dev/null
+++ b/tests/execute/0053-struct.c
_AT_@ -0,0 +1,11 @@
+
+int
+main()
+{
+ struct T { int x; };
+ {
+ struct T s;
+ s.x = 0;
+ return s.x;
+ }
+}
diff --git a/tests/execute/0054-struct.c b/tests/execute/0054-struct.c
new file mode 100644
index 0000000..df418eb
--- /dev/null
+++ b/tests/execute/0054-struct.c
_AT_@ -0,0 +1,14 @@
+
+int
+main()
+{
+ struct T { int x; } s1;
+ s1.x = 1;
+ {
+ struct T { int y; } s2;
+ s2.y = 1;
+ if (s1.x - s2.y != 0)
+ return 1;
+ }
+ return 0;
+}
diff --git a/tests/execute/0055-enum.c b/tests/execute/0055-enum.c
new file mode 100644
index 0000000..c35a63d
--- /dev/null
+++ b/tests/execute/0055-enum.c
_AT_@ -0,0 +1,23 @@
+
+enum E {
+ x,
+ y,
+ z,
+};
+
+int
+main()
+{
+ enum E e;
+
+ if(x != 0)
+ return 1;
+ if(y != 1)
+ return 2;
+ if(z != 2)
+ return 3;
+
+ e = x;
+ return e;
+}
+
diff --git a/tests/execute/0056-enum.c b/tests/execute/0056-enum.c
new file mode 100644
index 0000000..2cb7b2a
--- /dev/null
+++ b/tests/execute/0056-enum.c
_AT_@ -0,0 +1,23 @@
+
+enum E {
+ x,
+ y = 2,
+ z,
+};
+
+int
+main()
+{
+ enum E e;
+
+ if(x != 0)
+ return 1;
+ if(y != 2)
+ return 2;
+ if(z != 3)
+ return 3;
+
+ e = x;
+ return e;
+}
+
diff --git a/tests/execute/0057-duff.c b/tests/execute/0057-duff.c
new file mode 100644
index 0000000..6b9aae1
--- /dev/null
+++ b/tests/execute/0057-duff.c
_AT_@ -0,0 +1,31 @@
+
+int main()
+{
+ int count, n;
+ char *from, *to;
+ char a[39], b[39];
+
+ for(n = 0; n < 39; n++) {
+ a[n] = n;
+ b[n] = 0;
+ }
+ from = a;
+ to = b;
+ count = 39;
+ n = (count + 7) / 8;
+ switch (count % 8) {
+ case 0: do { *to++ = *from++;
+ case 7: *to++ = *from++;
+ case 6: *to++ = *from++;
+ case 5: *to++ = *from++;
+ case 4: *to++ = *from++;
+ case 3: *to++ = *from++;
+ case 2: *to++ = *from++;
+ case 1: *to++ = *from++;
+ } while (--n > 0);
+ }
+ for(n = 0; n < 39; n++)
+ if(a[n] != b[n])
+ return 1;
+ return 0;
+}
diff --git a/tests/execute/0058-bug.c b/tests/execute/0058-bug.c
new file mode 100644
index 0000000..8eb87cf
--- /dev/null
+++ b/tests/execute/0058-bug.c
_AT_@ -0,0 +1,10 @@
+
+int
+main()
+{
+ char a[16], b[16];
+
+ if(sizeof(a) != sizeof(b))
+ return 1;
+ return 0;
+}
diff --git a/tests/execute/0059-multistring.c b/tests/execute/0059-multistring.c
new file mode 100644
index 0000000..d0d2638
--- /dev/null
+++ b/tests/execute/0059-multistring.c
_AT_@ -0,0 +1,18 @@
+
+
+
+int main()
+{
+ char * s;
+
+ s = "abc" "def";
+ if(s[0] != 'a') return 1;
+ if(s[1] != 'b') return 2;
+ if(s[2] != 'c') return 3;
+ if(s[3] != 'd') return 4;
+ if(s[4] != 'e') return 5;
+ if(s[5] != 'f') return 6;
+ if(s[6] != 0) return 7;
+
+ return 0;
+}
diff --git a/tests/execute/0060-charlit.c b/tests/execute/0060-charlit.c
new file mode 100644
index 0000000..869c531
--- /dev/null
+++ b/tests/execute/0060-charlit.c
_AT_@ -0,0 +1,9 @@
+
+int
+main()
+{
+ if ('a' != 97)
+ return 1;
+
+ return 0;
+}
diff --git a/tests/execute/0061-comments.c b/tests/execute/0061-comments.c
new file mode 100644
index 0000000..d2f5060
--- /dev/null
+++ b/tests/execute/0061-comments.c
_AT_@ -0,0 +1,11 @@
+// line comment
+
+int
+main()
+{
+ /*
+ multiline
+ comment
+ */
+ return 0;
+}
diff --git a/tests/execute/0062-include.c b/tests/execute/0062-include.c
new file mode 100644
index 0000000..12877fd
--- /dev/null
+++ b/tests/execute/0062-include.c
_AT_@ -0,0 +1,4 @@
+#include \
+"0062-include.h"
+ return 0;
+}
diff --git a/tests/execute/0062-include.h b/tests/execute/0062-include.h
new file mode 100644
index 0000000..a4d76de
--- /dev/null
+++ b/tests/execute/0062-include.h
_AT_@ -0,0 +1,3 @@
+int
+main()
+{
diff --git a/tests/execute/0063-define.c b/tests/execute/0063-define.c
new file mode 100644
index 0000000..c3abf01
--- /dev/null
+++ b/tests/execute/0063-define.c
_AT_@ -0,0 +1,7 @@
+#define FOO 0
+
+int main()
+{
+ return FOO;
+}
+
diff --git a/tests/execute/0064-sysinclude.c b/tests/execute/0064-sysinclude.c
new file mode 100644
index 0000000..51ab801
--- /dev/null
+++ b/tests/execute/0064-sysinclude.c
_AT_@ -0,0 +1,7 @@
+#include <0064-sysinclude.h>
+
+int
+main()
+{
+ return x;
+}
diff --git a/tests/execute/0065-ifdef.c b/tests/execute/0065-ifdef.c
new file mode 100644
index 0000000..be3665e
--- /dev/null
+++ b/tests/execute/0065-ifdef.c
_AT_@ -0,0 +1,26 @@
+
+#ifdef FOO
+ XXX
+#ifdef BAR
+ XXX
+#endif
+ XXX
+#endif
+
+#define FOO 1
+
+#ifdef FOO
+
+#ifdef FOO
+int x = 0;
+#endif
+
+int
+main()
+{
+ return x;
+}
+#endif
+
+
+
diff --git a/tests/execute/0066-cppelse.c b/tests/execute/0066-cppelse.c
new file mode 100644
index 0000000..5020fb2
--- /dev/null
+++ b/tests/execute/0066-cppelse.c
_AT_@ -0,0 +1,20 @@
+#define BAR 0
+#ifdef BAR
+ #ifdef FOO
+ XXX
+ #ifdef FOO
+ XXX
+ #endif
+ #else
+ #define FOO
+ #ifdef FOO
+ int x = BAR;
+ #endif
+ #endif
+#endif
+
+int
+main()
+{
+ return BAR;
+}
diff --git a/tests/execute/0067-define.c b/tests/execute/0067-define.c
new file mode 100644
index 0000000..2b3d701
--- /dev/null
+++ b/tests/execute/0067-define.c
_AT_@ -0,0 +1,7 @@
+#define X 6 / 2
+
+int
+main()
+{
+ return X - 3;
+}
diff --git a/tests/execute/0068-funclikemacro.c b/tests/execute/0068-funclikemacro.c
new file mode 100644
index 0000000..850b6ce
--- /dev/null
+++ b/tests/execute/0068-funclikemacro.c
_AT_@ -0,0 +1,8 @@
+#define ADD(X, Y) (X + Y)
+
+
+int
+main()
+{
+ return ADD(1, 2) - 3;
+}
diff --git a/tests/execute/0069-funclikemacro.c b/tests/execute/0069-funclikemacro.c
new file mode 100644
index 0000000..f4f787c
--- /dev/null
+++ b/tests/execute/0069-funclikemacro.c
_AT_@ -0,0 +1,11 @@
+#define A 3
+#define FOO(X,Y,Z) X + Y + Z
+#define SEMI ;
+
+int
+main()
+{
+ if(FOO(1, 2, A) != 6)
+ return 1 SEMI
+ return FOO(0,0,0);
+}
diff --git a/tests/execute/0070-cppif.c b/tests/execute/0070-cppif.c
new file mode 100644
index 0000000..e4eef1f
--- /dev/null
+++ b/tests/execute/0070-cppif.c
_AT_@ -0,0 +1,19 @@
+
+#if 1
+int x = 0;
+#endif
+
+#if 0
+int x = 1;
+#if 1
+ X
+#endif
+#ifndef AAA
+ X
+#endif
+#endif
+
+int main()
+{
+ return x;
+}
diff --git a/tests/execute/0071-cppelif.c b/tests/execute/0071-cppelif.c
new file mode 100644
index 0000000..6355f47
--- /dev/null
+++ b/tests/execute/0071-cppelif.c
_AT_@ -0,0 +1,14 @@
+
+#if 0
+X
+#elif 1
+int x = 0;
+#else
+X
+#endif
+
+int
+main()
+{
+ return x;
+}
diff --git a/tests/execute/0072-cppelif.c b/tests/execute/0072-cppelif.c
new file mode 100644
index 0000000..71b351b
--- /dev/null
+++ b/tests/execute/0072-cppelif.c
_AT_@ -0,0 +1,14 @@
+
+#if 0
+X
+#elif 0
+X
+#elif 1
+int x = 0;
+#endif
+
+int
+main()
+{
+ return x;
+}
diff --git a/tests/execute/0073-ifndef.c b/tests/execute/0073-ifndef.c
new file mode 100644
index 0000000..5636dcd
--- /dev/null
+++ b/tests/execute/0073-ifndef.c
_AT_@ -0,0 +1,17 @@
+
+
+#ifndef DEF
+int x = 0;
+#endif
+
+#define DEF
+
+#ifndef DEF
+X
+#endif
+
+int
+main()
+{
+ return x;
+}
diff --git a/tests/execute/0074-undef.c b/tests/execute/0074-undef.c
new file mode 100644
index 0000000..ac870e8
--- /dev/null
+++ b/tests/execute/0074-undef.c
_AT_@ -0,0 +1,13 @@
+
+#define X 1
+#undef X
+
+#ifdef X
+FAIL
+#endif
+
+int
+main()
+{
+ return 0;
+}
diff --git a/tests/execute/0075-ptraddasn.c b/tests/execute/0075-ptraddasn.c
new file mode 100644
index 0000000..d3ec201
--- /dev/null
+++ b/tests/execute/0075-ptraddasn.c
_AT_@ -0,0 +1,15 @@
+
+int
+main()
+{
+ int arr[2];
+ int *p;
+
+ p = &arr[0];
+ p += 1;
+ *p = 123;
+
+ if(arr[1] != 123)
+ return 1;
+ return 0;
+}
diff --git a/tests/execute/0076-ptrsubasn.c b/tests/execute/0076-ptrsubasn.c
new file mode 100644
index 0000000..45cb5da
--- /dev/null
+++ b/tests/execute/0076-ptrsubasn.c
_AT_@ -0,0 +1,15 @@
+
+int
+main()
+{
+ int arr[2];
+ int *p;
+
+ p = &arr[1];
+ p -= 1;
+ *p = 123;
+
+ if(arr[0] != 123)
+ return 1;
+ return 0;
+}
diff --git a/tests/execute/0077-defined.c b/tests/execute/0077-defined.c
new file mode 100644
index 0000000..88fb17c
--- /dev/null
+++ b/tests/execute/0077-defined.c
_AT_@ -0,0 +1,33 @@
+
+#if defined X
+X
+#endif
+
+#if defined(X)
+X
+#endif
+
+#if X
+X
+#endif
+
+#define X 0
+
+#if X
+X
+#endif
+
+#if defined(X)
+int x = 0;
+#endif
+
+#undef X
+#define X 1
+
+#if X
+int
+main()
+{
+ return 0;
+}
+#endif
diff --git a/tests/execute/0078-dirifexpr.c b/tests/execute/0078-dirifexpr.c
new file mode 100644
index 0000000..9387dbf
--- /dev/null
+++ b/tests/execute/0078-dirifexpr.c
_AT_@ -0,0 +1,167 @@
+
+#if (-2) != -2
+#error fail
+#endif
+
+#if (0 || 0) != 0
+#error fail
+#endif
+
+#if (1 || 0) != 1
+#error fail
+#endif
+
+#if (1 || 1) != 1
+#error fail
+#endif
+
+#if (0 && 0) != 0
+#error fail
+#endif
+
+#if (1 && 0) != 0
+#error fail
+#endif
+
+#if (0 && 1) != 0
+#error fail
+#endif
+
+#if (1 && 1) != 1
+#error fail
+#endif
+
+#if (0xf0 | 1) != 0xf1
+#error fail
+#endif
+
+#if (0xf0 & 1) != 0
+#error fail
+#endif
+
+#if (0xf0 & 0x1f) != 0x10
+#error fail
+#endif
+
+#if (1 ^ 1) != 0
+#error fail
+#endif
+
+#if (1 == 1) != 1
+#error fail
+#endif
+
+#if (1 == 0) != 0
+#error fail
+#endif
+
+#if (1 != 1) != 0
+#error fail
+#endif
+
+#if (0 != 1) != 1
+#error fail
+#endif
+
+#if (0 > 1) != 0
+#error fail
+#endif
+
+#if (0 < 1) != 1
+#error fail
+#endif
+
+#if (0 > -1) != 1
+#error fail
+#endif
+
+#if (0 < -1) != 0
+#error fail
+#endif
+
+#if (0 >= 1) != 0
+#error fail
+#endif
+
+#if (0 <= 1) != 1
+#error fail
+#endif
+
+#if (0 >= -1) != 1
+#error fail
+#endif
+
+#if (0 <= -1) != 0
+#error fail
+#endif
+
+#if (0 < 0) != 0
+#error fail
+#endif
+
+#if (0 <= 0) != 1
+#error fail
+#endif
+
+#if (0 > 0) != 0
+#error fail
+#endif
+
+#if (0 >= 0) != 1
+#error fail
+#endif
+
+#if (1 << 1) != 2
+#error fail
+#endif
+
+#if (2 >> 1) != 1
+#error fail
+#endif
+
+#if (2 + 1) != 3
+#error fail
+#endif
+
+#if (2 - 3) != -1
+#error fail
+#endif
+
+#if (2 * 3) != 6
+#error fail
+#endif
+
+#if (6 / 3) != 2
+#error fail
+#endif
+
+#if (7 % 3) != 1
+#error fail
+#endif
+
+#if (2+2*3+2) != 10
+#error fail
+#endif
+
+#if ((2+2)*(3+2)) != 20
+#error fail
+#endif
+
+#if (2 + 2 + 2 + 2 == 2 + 2 * 3) != 1
+#error fail
+#endif
+
+#if (0 ? 1 : 3) != 3
+#error fail
+#endif
+
+#if (1 ? 3 : 1) != 3
+#error fail
+#endif
+
+int
+main()
+{
+ return 0;
+}
+
diff --git a/tests/execute/0079-cond.c b/tests/execute/0079-cond.c
new file mode 100644
index 0000000..1b1a329
--- /dev/null
+++ b/tests/execute/0079-cond.c
_AT_@ -0,0 +1,10 @@
+
+int
+main()
+{
+ if(0 ? 1 : 0)
+ return 1;
+ if(1 ? 0 : 1)
+ return 2;
+ return 0;
+}
diff --git a/tests/execute/0080-arrays.c b/tests/execute/0080-arrays.c
new file mode 100644
index 0000000..6d11cd3
--- /dev/null
+++ b/tests/execute/0080-arrays.c
_AT_@ -0,0 +1,49 @@
+
+int
+foo(int x[100])
+{
+ int y[100];
+ int *p;
+
+ y[0] = 2000;
+
+ if(x[0] != 1000)
+ {
+ return 1;
+ }
+
+ p = x;
+
+ if(p[0] != 1000)
+ {
+ return 2;
+ }
+
+ p = y;
+
+ if(p[0] != 2000)
+ {
+ return 3;
+ }
+
+ if(sizeof(x) != sizeof(void*))
+ {
+ return 4;
+ }
+
+ if(sizeof(y) <= sizeof(x))
+ {
+ return 5;
+ }
+
+ return 0;
+}
+
+int
+main()
+{
+ int x[100];
+ x[0] = 1000;
+
+ return foo(x);
+}
diff --git a/tests/execute/0081-calls.c b/tests/execute/0081-calls.c
new file mode 100644
index 0000000..64425f5
--- /dev/null
+++ b/tests/execute/0081-calls.c
_AT_@ -0,0 +1,18 @@
+
+int
+f1(char *p)
+{
+ return *p+1;
+}
+
+int
+main()
+{
+ char s = 1;
+ int v[1000];
+ int f1(char *);
+
+ if (f1(&s) != 2)
+ return 1;
+ return 0;
+}
diff --git a/tests/execute/0082-bug.c b/tests/execute/0082-bug.c
new file mode 100644
index 0000000..ad0af76
--- /dev/null
+++ b/tests/execute/0082-bug.c
_AT_@ -0,0 +1,17 @@
+#define x(y) ((y) + 1)
+
+int
+main()
+{
+ int x;
+ int y;
+
+ y = 0;
+ x = x(y);
+
+ if(x != 1)
+ return 1;
+
+ return 0;
+}
+
diff --git a/tests/execute/0083-voidret.c b/tests/execute/0083-voidret.c
new file mode 100644
index 0000000..e2c4ff4
--- /dev/null
+++ b/tests/execute/0083-voidret.c
_AT_@ -0,0 +1,13 @@
+
+void
+voidfn()
+{
+ return;
+}
+
+int
+main()
+{
+ voidfn();
+ return 0;
+}
diff --git a/tests/execute/0084-longlong.c b/tests/execute/0084-longlong.c
new file mode 100644
index 0000000..a2b8580
--- /dev/null
+++ b/tests/execute/0084-longlong.c
_AT_@ -0,0 +1,12 @@
+
+int
+main()
+{
+ long long x;
+
+ x = 0;
+ x = x + 1;
+ if (x != 1)
+ return 1;
+ return 0;
+}
diff --git a/tests/execute/0085-ulonglong.c b/tests/execute/0085-ulonglong.c
new file mode 100644
index 0000000..dc3e356
--- /dev/null
+++ b/tests/execute/0085-ulonglong.c
_AT_@ -0,0 +1,12 @@
+
+int
+main()
+{
+ unsigned long long x;
+
+ x = 0;
+ x = x + 1;
+ if (x != 1)
+ return 1;
+ return 0;
+}
diff --git a/tests/execute/0086-variadic.c b/tests/execute/0086-variadic.c
new file mode 100644
index 0000000..cb05002
--- /dev/null
+++ b/tests/execute/0086-variadic.c
_AT_@ -0,0 +1,55 @@
+#define CALL(FUN, ...) FUN(__VA_ARGS__)
+
+int
+none()
+{
+ return 0;
+}
+
+int
+one(int a)
+{
+ if (a != 1)
+ return 1;
+
+ return 0;
+}
+
+int
+two(int a, int b)
+{
+ if (a != 1)
+ return 1;
+ if (b != 2)
+ return 1;
+
+ return 0;
+}
+
+int
+three(int a, int b, int c)
+{
+ if (a != 1)
+ return 1;
+ if (b != 2)
+ return 1;
+ if (c != 3)
+ return 1;
+
+ return 0;
+}
+
+int
+main()
+{
+ if (CALL(none))
+ return 1;
+ if (CALL(one, 1))
+ return 2;
+ if (CALL(two, 1, 2))
+ return 3;
+ if (CALL(three, 1, 2, 3))
+ return 4;
+
+ return 0;
+}
diff --git a/tests/execute/0087-variadic.c b/tests/execute/0087-variadic.c
new file mode 100644
index 0000000..cfd0fac
--- /dev/null
+++ b/tests/execute/0087-variadic.c
_AT_@ -0,0 +1,54 @@
+#define ARGS(...) __VA_ARGS__
+
+int
+none()
+{
+ return 0;
+}
+
+int
+one(int a)
+{
+ if (a != 1)
+ return 1;
+
+ return 0;
+}
+
+int
+two(int a, int b)
+{
+ if (a != 1)
+ return 1;
+ if (b != 2)
+ return 1;
+
+ return 0;
+}
+
+int
+three(int a, int b, int c)
+{
+ if (a != 1)
+ return 1;
+ if (b != 2)
+ return 1;
+ if (c != 3)
+ return 1;
+
+ return 0;
+}
+
+int
+main()
+{
+ if (none(ARGS()))
+ return 1;
+ if (one(ARGS(1)))
+ return 2;
+ if (two(ARGS(1, 2)))
+ return 3;
+ if (three(ARGS(1, 2, 3)))
+ return 4;
+ return 0;
+}
diff --git a/tests/execute/0088-macros.c b/tests/execute/0088-macros.c
new file mode 100644
index 0000000..65d678b
--- /dev/null
+++ b/tests/execute/0088-macros.c
_AT_@ -0,0 +1,30 @@
+#define ZERO_0() 0
+#define ZERO_1(A) 0
+#define ZERO_2(A, B) 0
+#define ZERO_VAR(...) 0
+#define ZERO_1_VAR(A, ...) 0
+
+int
+main()
+{
+ if (ZERO_0())
+ return 1;
+ if (ZERO_1(1))
+ return 1;
+ if (ZERO_2(1, 2))
+ return 1;
+ if (ZERO_VAR())
+ return 1;
+ if (ZERO_VAR(1))
+ return 1;
+ if (ZERO_VAR(1, 2))
+ return 1;
+ if (ZERO_1_VAR(1))
+ return 1;
+ if (ZERO_1_VAR(1, 2))
+ return 1;
+ if (ZERO_1_VAR(1, 2, 3))
+ return 1;
+
+ return 0;
+}
diff --git a/tests/execute/0089-short.c b/tests/execute/0089-short.c
new file mode 100644
index 0000000..4dce16f
--- /dev/null
+++ b/tests/execute/0089-short.c
_AT_@ -0,0 +1,12 @@
+
+int
+main()
+{
+ short x;
+
+ x = 0;
+ x = x + 1;
+ if (x != 1)
+ return 1;
+ return 0;
+}
diff --git a/tests/execute/0090-fptr.c b/tests/execute/0090-fptr.c
new file mode 100644
index 0000000..e30edfa
--- /dev/null
+++ b/tests/execute/0090-fptr.c
_AT_@ -0,0 +1,21 @@
+
+struct S
+{
+ int (*fptr)();
+};
+
+int
+foo()
+{
+ return 0;
+}
+
+int
+main()
+{
+ struct S v;
+
+ v.fptr = foo;
+ return v.fptr();
+}
+
diff --git a/tests/execute/0091-fptr.c b/tests/execute/0091-fptr.c
new file mode 100644
index 0000000..f0cf00f
--- /dev/null
+++ b/tests/execute/0091-fptr.c
_AT_@ -0,0 +1,12 @@
+
+int (*fptr)() = 0;
+
+
+int
+main()
+{
+ if (fptr)
+ return 1;
+ return 0;
+}
+
diff --git a/tests/execute/0092-fptr.c b/tests/execute/0092-fptr.c
new file mode 100644
index 0000000..ab6b5ef
--- /dev/null
+++ b/tests/execute/0092-fptr.c
_AT_@ -0,0 +1,31 @@
+
+int
+zero()
+{
+ return 0;
+}
+
+struct S
+{
+ int (*zerofunc)();
+} s = { &zero };
+
+struct S *
+anon()
+{
+ return &s;
+}
+
+typedef struct S * (*fty)();
+
+fty
+go()
+{
+ return &anon;
+}
+
+int
+main()
+{
+ return go()()->zerofunc();
+}
diff --git a/tests/execute/0093-arrayinit.c b/tests/execute/0093-arrayinit.c
new file mode 100644
index 0000000..21f7118
--- /dev/null
+++ b/tests/execute/0093-arrayinit.c
_AT_@ -0,0 +1,15 @@
+
+int a[3] = {0, 1, 2};
+
+int
+main()
+{
+ if (a[0] != 0)
+ return 1;
+ if (a[1] != 1)
+ return 2;
+ if (a[2] != 2)
+ return 3;
+
+ return 0;
+}
diff --git a/tests/execute/0094-arrayinit.c b/tests/execute/0094-arrayinit.c
new file mode 100644
index 0000000..e90d5f3
--- /dev/null
+++ b/tests/execute/0094-arrayinit.c
_AT_@ -0,0 +1,20 @@
+
+typedef struct {
+ int v;
+ int sub[2];
+} S;
+
+S a[1] = {{1, {2, 3}}};
+
+int
+main()
+{
+ if (a[0].v != 1)
+ return 1;
+ if (a[0].sub[0] != 2)
+ return 2;
+ if (a[0].sub[1] != 3)
+ return 3;
+
+ return 0;
+}
diff --git a/tests/execute/0095-arrayselector.c b/tests/execute/0095-arrayselector.c
new file mode 100644
index 0000000..19341f2
--- /dev/null
+++ b/tests/execute/0095-arrayselector.c
_AT_@ -0,0 +1,23 @@
+
+
+
+
+int a[] = {5, [2] = 2, 3};
+
+int
+main()
+{
+ if (sizeof(a) != 4*sizeof(int))
+ return 1;
+
+ if (a[0] != 5)
+ return 2;
+ if (a[1] != 0)
+ return 3;
+ if (a[2] != 2)
+ return 4;
+ if (a[3] != 3)
+ return 5;
+
+ return 0;
+}
diff --git a/tests/execute/0096-inferredarraysize.c b/tests/execute/0096-inferredarraysize.c
new file mode 100644
index 0000000..31758d8
--- /dev/null
+++ b/tests/execute/0096-inferredarraysize.c
_AT_@ -0,0 +1,12 @@
+
+
+int a[] = {1, 2, 3, 4};
+
+int
+main()
+{
+ if (sizeof(a) != 4*sizeof(int))
+ return 1;
+
+ return 0;
+}
diff --git a/tests/execute/0097-extern.c b/tests/execute/0097-extern.c
new file mode 100644
index 0000000..b71ada8
--- /dev/null
+++ b/tests/execute/0097-extern.c
_AT_@ -0,0 +1,6 @@
+extern int x;
+
+int main()
+{
+ return 0;
+}
diff --git a/tests/execute/0098-tentative.c b/tests/execute/0098-tentative.c
new file mode 100644
index 0000000..1184b85
--- /dev/null
+++ b/tests/execute/0098-tentative.c
_AT_@ -0,0 +1,23 @@
+
+int x;
+int x = 3;
+int x;
+
+int main();
+
+void *
+foo()
+{
+ return &main;
+}
+
+int
+main()
+{
+ if (x != 3)
+ return 0;
+
+ x = 0;
+ return x;
+}
+
diff --git a/tests/execute/0099-tentative.c b/tests/execute/0099-tentative.c
new file mode 100644
index 0000000..37165a8
--- /dev/null
+++ b/tests/execute/0099-tentative.c
_AT_@ -0,0 +1,13 @@
+
+int x, x = 3, x;
+
+int
+main()
+{
+ if (x != 3)
+ return 0;
+
+ x = 0;
+ return x;
+}
+
diff --git a/tests/execute/0100-redeclaremacro.c b/tests/execute/0100-redeclaremacro.c
new file mode 100644
index 0000000..cf94041
--- /dev/null
+++ b/tests/execute/0100-redeclaremacro.c
_AT_@ -0,0 +1,15 @@
+
+#define NULL ((void*)0)
+#define NULL ((void*)0)
+
+#define FOO(X, Y) (X + Y + Z)
+#define FOO(X, Y) (X + Y + Z)
+
+#define BAR(X, Y, ...) (X + Y + Z)
+#define BAR(X, Y, ...) (X + Y + Z)
+
+int
+main()
+{
+ return 0;
+}
diff --git a/tests/execute/0101-wcharlit.c b/tests/execute/0101-wcharlit.c
new file mode 100644
index 0000000..194db7b
--- /dev/null
+++ b/tests/execute/0101-wcharlit.c
_AT_@ -0,0 +1,6 @@
+
+int
+main()
+{
+ return L'\0';
+}
diff --git a/tests/execute/0102-bug.c b/tests/execute/0102-bug.c
new file mode 100644
index 0000000..06c77bd
--- /dev/null
+++ b/tests/execute/0102-bug.c
_AT_@ -0,0 +1,14 @@
+// This wouldn't compile
+
+typedef struct { } Vec;
+
+static void
+vecresize(Vec *v, int cap)
+{
+ return;
+}
+
+int main()
+{
+ return 0;
+}
diff --git a/tests/execute/0103-voidparm.c b/tests/execute/0103-voidparm.c
new file mode 100644
index 0000000..c67452a
--- /dev/null
+++ b/tests/execute/0103-voidparm.c
_AT_@ -0,0 +1,12 @@
+
+int
+foo(void)
+{
+ return 0;
+}
+
+int
+main()
+{
+ return foo();
+}
diff --git a/tests/execute/0104-voidparm.c b/tests/execute/0104-voidparm.c
new file mode 100644
index 0000000..633b86f
--- /dev/null
+++ b/tests/execute/0104-voidparm.c
_AT_@ -0,0 +1,11 @@
+
+int
+main()
+{
+ int c;
+ c = 0;
+ do
+ ;
+ while (0);
+ return c;
+}
diff --git a/tests/execute/0105-shl.c b/tests/execute/0105-shl.c
new file mode 100644
index 0000000..53c2faf
--- /dev/null
+++ b/tests/execute/0105-shl.c
_AT_@ -0,0 +1,12 @@
+
+int
+main()
+{
+ int x;
+
+ x = 1;
+ if ((x << 1) != 2)
+ return 1;
+
+ return 0;
+}
diff --git a/tests/execute/0106-ppcast.c b/tests/execute/0106-ppcast.c
new file mode 100644
index 0000000..9fc1478
--- /dev/null
+++ b/tests/execute/0106-ppcast.c
_AT_@ -0,0 +1,15 @@
+
+int
+main()
+{
+ int x;
+ void *foo;
+ void **bar;
+
+ x = 0;
+
+ foo = (void*)&x;
+ bar = &foo;
+
+ return **(int**)bar;
+}
diff --git a/tests/execute/0107-bnot.c b/tests/execute/0107-bnot.c
new file mode 100644
index 0000000..464e7f2
--- /dev/null
+++ b/tests/execute/0107-bnot.c
_AT_@ -0,0 +1,22 @@
+
+
+int
+main()
+{
+ int x;
+ long long l;
+
+ x = 0;
+ l = 0;
+
+ x = ~x;
+ if (x != 0xffffffff)
+ return 1;
+
+ l = ~l;
+ if (x != 0xffffffffffffffff)
+ return 2;
+
+
+ return 0;
+}
diff --git a/tests/execute/0108-bug.c b/tests/execute/0108-bug.c
new file mode 100644
index 0000000..34d9f97
--- /dev/null
+++ b/tests/execute/0108-bug.c
_AT_@ -0,0 +1,13 @@
+
+
+int
+main()
+{
+ int i;
+
+ for(i = 0; i < 10; i++)
+ if (!i)
+ continue;
+
+ return 0;
+}
diff --git a/tests/execute/README b/tests/execute/README
new file mode 100644
index 0000000..aca0de8
--- /dev/null
+++ b/tests/execute/README
_AT_@ -0,0 +1,2 @@
+These tests are taken from https://github.com/andrewchambers/qc.
+All the credits for this test suite are for Andrew Chambers.
diff --git a/tests/execute/chktest.sh b/tests/execute/chktest.sh
new file mode 100755
index 0000000..950e31d
--- /dev/null
+++ b/tests/execute/chktest.sh
_AT_@ -0,0 +1,12 @@
+#!/bin/sh
+
+trap 'tabs -8;rm -f a.out' 0 1 2 3 15
+tabs 40
+ulimit -c 0
+
+for i in $_AT_
+do
+ printf "%s\t" $i
+ rm -f a.out
+ (scc -Iinclude -m qbe "$i" && ./a.out) 2>/dev/null && echo [OK] || echo [FAILED]
+done
diff --git a/tests/execute/compose.sh b/tests/execute/compose.sh
new file mode 100755
index 0000000..0492fbb
--- /dev/null
+++ b/tests/execute/compose.sh
_AT_@ -0,0 +1,23 @@
+#!/bin/sh
+
+rm -f tmp_test.c
+rm -f tests.h
+rm -f tmp_*.c
+
+(echo '#include "tests.h"'
+echo 'int main()'
+echo '{'
+
+for i in *-*.c
+do
+ n=`echo $i | sed 's/\(.*\)-.*\.c/\1/'`
+ sed s/main/main_$n/ < $i > tmp_$n.c
+ echo "int main_$n();" >> tests.h
+ echo "main_$n();"
+
+done
+
+echo 'return 0;'
+echo '}'
+) > tmp_test.c
+
diff --git a/tests/execute/include/0064-sysinclude.h b/tests/execute/include/0064-sysinclude.h
new file mode 100644
index 0000000..fffa928
--- /dev/null
+++ b/tests/execute/include/0064-sysinclude.h
_AT_@ -0,0 +1,2 @@
+int x = 0;
+
diff --git a/tests/execute/scc-tests.lst b/tests/execute/scc-tests.lst
new file mode 100644
index 0000000..641ebf4
--- /dev/null
+++ b/tests/execute/scc-tests.lst
_AT_@ -0,0 +1,101 @@
+0001-sanity.c
+0002-expr.c
+0003-local.c
+0004-pointer.c
+0005-ifstmt.c
+0006-whilestmt.c
+0007-forstmt.c
+0008-dowhilestmt.c
+0009-expr.c
+0010-goto.c
+0011-assign.c
+0012-expr.c
+0013-addridx.c
+0014-assignidx.c
+0015-localarray.c
+0016-addrarray.c
+0017-struct.c
+0018-structptr.c
+0019-selfrefstruct.c
+0020-ptrptr.c
+0021-intfunc.c
+0022-typedef.c
+0023-global.c
+0024-typedefstruct.c
+0025-string.c
+0026-implicitret.c
+0027-charval.c
+0028-bor.c
+0029-band.c
+0030-bxor.c
+0031-relop.c
+0032-indec.c
+0033-ptrindec.c
+0034-logandor.c
+0035-breakcont.c
+0036-notneg.c
+0037-assignop.c
+0038-ptradd.c
+0039-sizeof.c
+0040-cast.c
+0041-queen.c
+0042-prime.c
+0043-union.c
+0044-struct.c
+0045-struct.c
+0046-inits.c
+0048-inits.c
+0049-inits.c
+0050-inits.c
+0052-switch.c
+0053-struct.c
+0054-struct.c
+0055-enum.c
+0056-enum.c
+0057-duff.c
+0058-bug.c
+0059-multistring.c
+0060-charlit.c
+0061-comments.c
+0062-include.c
+0063-define.c
+0064-sysinclude.c
+0065-ifdef.c
+0066-cppelse.c
+0067-define.c
+0068-funclikemacro.c
+0069-funclikemacro.c
+0070-cppif.c
+0071-cppelif.c
+0072-cppelif.c
+0073-ifndef.c
+0074-undef.c
+0075-ptraddasn.c
+0076-ptrsubasn.c
+0077-defined.c
+0078-dirifexpr.c
+0079-cond.c
+0080-arrays.c
+0081-calls.c
+0082-bug.c
+0083-voidret.c
+0084-longlong.c
+0085-ulonglong.c
+0089-short.c
+0090-fptr.c
+0091-fptr.c
+0092-fptr.c
+0093-arrayinit.c
+0094-arrayinit.c
+0095-arrayselector.c
+0096-inferredarraysize.c
+0097-extern.c
+0098-tentative.c
+0099-tentative.c
+0102-bug.c
+0103-voidparm.c
+0104-voidparm.c
+0105-shl.c
+0106-ppcast.c
+0107-bnot.c
+0108-bug.c
diff --git a/tests/include/0064-sysinclude.h b/tests/include/0064-sysinclude.h
deleted file mode 100644
index fffa928..0000000
--- a/tests/include/0064-sysinclude.h
+++ /dev/null
_AT_@ -1,2 +0,0 @@
-int x = 0;
-
diff --git a/tests/scc-tests.lst b/tests/scc-tests.lst
deleted file mode 100644
index 641ebf4..0000000
--- a/tests/scc-tests.lst
+++ /dev/null
_AT_@ -1,101 +0,0 @@
-0001-sanity.c
-0002-expr.c
-0003-local.c
-0004-pointer.c
-0005-ifstmt.c
-0006-whilestmt.c
-0007-forstmt.c
-0008-dowhilestmt.c
-0009-expr.c
-0010-goto.c
-0011-assign.c
-0012-expr.c
-0013-addridx.c
-0014-assignidx.c
-0015-localarray.c
-0016-addrarray.c
-0017-struct.c
-0018-structptr.c
-0019-selfrefstruct.c
-0020-ptrptr.c
-0021-intfunc.c
-0022-typedef.c
-0023-global.c
-0024-typedefstruct.c
-0025-string.c
-0026-implicitret.c
-0027-charval.c
-0028-bor.c
-0029-band.c
-0030-bxor.c
-0031-relop.c
-0032-indec.c
-0033-ptrindec.c
-0034-logandor.c
-0035-breakcont.c
-0036-notneg.c
-0037-assignop.c
-0038-ptradd.c
-0039-sizeof.c
-0040-cast.c
-0041-queen.c
-0042-prime.c
-0043-union.c
-0044-struct.c
-0045-struct.c
-0046-inits.c
-0048-inits.c
-0049-inits.c
-0050-inits.c
-0052-switch.c
-0053-struct.c
-0054-struct.c
-0055-enum.c
-0056-enum.c
-0057-duff.c
-0058-bug.c
-0059-multistring.c
-0060-charlit.c
-0061-comments.c
-0062-include.c
-0063-define.c
-0064-sysinclude.c
-0065-ifdef.c
-0066-cppelse.c
-0067-define.c
-0068-funclikemacro.c
-0069-funclikemacro.c
-0070-cppif.c
-0071-cppelif.c
-0072-cppelif.c
-0073-ifndef.c
-0074-undef.c
-0075-ptraddasn.c
-0076-ptrsubasn.c
-0077-defined.c
-0078-dirifexpr.c
-0079-cond.c
-0080-arrays.c
-0081-calls.c
-0082-bug.c
-0083-voidret.c
-0084-longlong.c
-0085-ulonglong.c
-0089-short.c
-0090-fptr.c
-0091-fptr.c
-0092-fptr.c
-0093-arrayinit.c
-0094-arrayinit.c
-0095-arrayselector.c
-0096-inferredarraysize.c
-0097-extern.c
-0098-tentative.c
-0099-tentative.c
-0102-bug.c
-0103-voidparm.c
-0104-voidparm.c
-0105-shl.c
-0106-ppcast.c
-0107-bnot.c
-0108-bug.c
Received on Thu Jan 12 2017 - 12:03:34 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 12 2017 - 12:12:09 CET