commit ceb069acb461dd7da080303e29b2e8d916487cb8 parent 557b3bd32b1d1b7801e565aa695d7340221b20ce Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Wed, 26 Aug 2015 22:31:11 +0200 Add basic test for arrays Diffstat:
A | cc1/tests/test018.c | | | 59 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 59 insertions(+), 0 deletions(-)
diff --git a/cc1/tests/test018.c b/cc1/tests/test018.c @@ -0,0 +1,59 @@ +/* +name: TEST018 +description: Basic test for arrays +output: +F1 +G1 F1 main +{ +- +V2 M #4 +V3 V2 #2 +A4 V3 arr +A6 P p +A8 P q +V9 I #4 +A10 V9 v + A6 A4 'P :P + A8 A4 'P #P4 +P #P3 +P :P + A4 'P #P4 +P #P3 +P @M #M2 :M + A10 'P @I #I2 :I + j L12 A4 'P #P4 +P #P3 +P @M MI #I2 =I + yI #I1 +L12 + j L13 A6 #P4 +P #P3 +P @M MI #I2 =I + yI #I1 +L13 + j L14 A8 @M MI #I2 =I + yI #I1 +L14 + j L15 A10 @I #I2 =I + yI #I1 +L15 + yI #I0 +} +*/ + +#line 1 + +int +main() +{ + char arr[2][4], (*p)[4], *q; + int v[4]; + + p = arr; + q = &arr[1][3]; + arr[1][3] = 2; + v[0] = 2; + + if (arr[1][3] != 2) + return 1; + if (p[1][3] != 2) + return 1; + if (*q != 2) + return 1; + if (*v != 2) + return 1; + + return 0; +}