]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Add the array tests, seem to have forgotten to add those...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 25 Nov 2012 20:41:30 +0000 (21:41 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 25 Nov 2012 20:41:30 +0000 (21:41 +0100)
tests/arrays.qc [new file with mode: 0644]
tests/arrays.tmpl [new file with mode: 0644]

diff --git a/tests/arrays.qc b/tests/arrays.qc
new file mode 100644 (file)
index 0000000..a3a84c1
--- /dev/null
@@ -0,0 +1,56 @@
+void     print(...)   = #1;
+string   ftos (float) = #2;
+entity() spawn = #3;
+
+float  glob[7];
+
+.float above;
+.float flds[6];
+.float below;
+
+void main() {
+    float loc[6];
+
+    loc[0] = 1000;
+    loc[1] = 1100;
+    loc[2] = 1200;
+    loc[3] = 1300;
+    loc[4] = 1400;
+    loc[5] = 1500;
+
+    float i;
+
+    for (i = 0; i < 6; i += 1)
+        loc[i] += 1;
+    for (i = 0; i < 5; i += 1)
+        print(ftos(loc[i]), " ");
+    print(ftos(loc[i]), "\n");
+
+    glob[0] = 1000;
+    glob[1] = 1100;
+    glob[2] = 1200;
+    glob[3] = 1300;
+    glob[4] = 1400;
+    glob[5] = 1500;
+    glob[6] = 1600;
+    for (i = 0; i < 7; i += 1)
+        glob[i] += 1;
+    for (i = 0; i < 6; i += 1)
+        print(ftos(glob[i]), " ");
+    print(ftos(glob[i]), "\n");
+
+    entity e = spawn();
+    e.above = 7777;
+    e.below = 9999;
+    e.flds[0] = 1000;
+    e.flds[1] = 1100;
+    e.flds[2] = 1200;
+    e.flds[3] = 1300;
+    e.flds[4] = 1400;
+    e.flds[5] = 1500;
+    for (i = 0; i < 6; i += 1)
+        e.flds[i] += 1;
+    for (i = 0; i < 5; i += 1)
+        print(ftos(e.flds[i]), " ");
+    print(ftos(e.flds[i]), "\n");
+}
diff --git a/tests/arrays.tmpl b/tests/arrays.tmpl
new file mode 100644 (file)
index 0000000..bbeba10
--- /dev/null
@@ -0,0 +1,7 @@
+I: arrays.qc
+D: array accessors and functionality
+T: -execute
+C: -std=fteqcc
+M: 1001 1101 1201 1301 1401 1501
+M: 1001 1101 1201 1301 1401 1501 1601
+M: 1001 1101 1201 1301 1401 1501