From: Wolfgang (Blub) Bumiller Date: Sun, 25 Nov 2012 20:41:30 +0000 (+0100) Subject: Add the array tests, seem to have forgotten to add those... X-Git-Tag: 0.1.9~234 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=commitdiff_plain;h=4b71b74c6ad2ee2c71ec1dfec8f475d0f4307df4 Add the array tests, seem to have forgotten to add those... --- diff --git a/tests/arrays.qc b/tests/arrays.qc new file mode 100644 index 0000000..a3a84c1 --- /dev/null +++ b/tests/arrays.qc @@ -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 index 0000000..bbeba10 --- /dev/null +++ b/tests/arrays.tmpl @@ -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