[hackers] [scc] Add basic test for arrays || Roberto E. Vargas Caballero
commit ceb069acb461dd7da080303e29b2e8d916487cb8
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Aug 26 22:31:11 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed Aug 26 22:31:11 2015 +0200
Add basic test for arrays
diff --git a/cc1/tests/test018.c b/cc1/tests/test018.c
new file mode 100644
index 0000000..aa50f08
--- /dev/null
+++ b/cc1/tests/test018.c
_AT_@ -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 _AT_M #M2 :M
+ A10 'P _AT_I #I2 :I
+ j L12 A4 'P #P4 +P #P3 +P _AT_M MI #I2 =I
+ yI #I1
+L12
+ j L13 A6 #P4 +P #P3 +P _AT_M MI #I2 =I
+ yI #I1
+L13
+ j L14 A8 _AT_M MI #I2 =I
+ yI #I1
+L14
+ j L15 A10 _AT_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;
+}
Received on Wed Aug 26 2015 - 22:32:48 CEST
This archive was generated by hypermail 2.3.0
: Wed Aug 26 2015 - 22:36:29 CEST