mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-21 02:40:56 +00:00
Add the array tests, seem to have forgotten to add those...
This commit is contained in:
parent
f431b7a693
commit
4b71b74c6a
2 changed files with 63 additions and 0 deletions
56
tests/arrays.qc
Normal file
56
tests/arrays.qc
Normal file
|
@ -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");
|
||||
}
|
7
tests/arrays.tmpl
Normal file
7
tests/arrays.tmpl
Normal file
|
@ -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
|
Loading…
Reference in a new issue