Explorar el Código

Added testcase for global array initialisation

Taddeus Kroes hace 12 años
padre
commit
bd12758353

+ 20 - 0
test/arrays/functional/array_init_global.cvc

@@ -0,0 +1,20 @@
+extern void printInt(int val);
+extern void printSpaces(int num);
+extern void printNewlines(int num);
+
+void printArray2D(int[n, m] a) {
+    for (int i = 0, n) {
+        for (int j = 0, m) {
+            printInt(a[i, j]);
+            printSpaces(1);
+        }
+        printNewlines(1);
+    }
+}
+
+int[2, 2] a = [[1, 2], 3];
+
+export int main() {
+    printArray2D(a);
+    return 0;
+}

+ 2 - 0
test/arrays/functional/array_init_global.out

@@ -0,0 +1,2 @@
+1 2
+3 3