mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-17 09:02:25 +00:00
switch testcases
This commit is contained in:
parent
f4043faf0b
commit
5778b6ffb6
9 changed files with 75 additions and 0 deletions
6
tests/switch-1.tmpl
Normal file
6
tests/switch-1.tmpl
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
I: switch.qc
|
||||||
|
D: test switches - case 1
|
||||||
|
T: -execute
|
||||||
|
C: -std=fteqcc -frelaxed-switch
|
||||||
|
E: -float 1 -float 0
|
||||||
|
M: One
|
6
tests/switch-2.tmpl
Normal file
6
tests/switch-2.tmpl
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
I: switch.qc
|
||||||
|
D: test switches - case 2
|
||||||
|
T: -execute
|
||||||
|
C: -std=fteqcc -frelaxed-switch
|
||||||
|
E: -float 2 -float 0
|
||||||
|
M: Two
|
6
tests/switch-3.tmpl
Normal file
6
tests/switch-3.tmpl
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
I: switch.qc
|
||||||
|
D: test switches - case 3
|
||||||
|
T: -execute
|
||||||
|
C: -std=fteqcc -frelaxed-switch
|
||||||
|
E: -float 3 -float 0
|
||||||
|
M: Three, falling through to 2 - Two
|
6
tests/switch-4.tmpl
Normal file
6
tests/switch-4.tmpl
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
I: switch.qc
|
||||||
|
D: test switches - case 4
|
||||||
|
T: -execute
|
||||||
|
C: -std=fteqcc -frelaxed-switch
|
||||||
|
E: -float 4 -float 0
|
||||||
|
M: Four, falling through to default - Other
|
6
tests/switch-5.tmpl
Normal file
6
tests/switch-5.tmpl
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
I: switch.qc
|
||||||
|
D: test switches - case 5
|
||||||
|
T: -execute
|
||||||
|
C: -std=fteqcc -frelaxed-switch
|
||||||
|
E: -float 5 -float 0
|
||||||
|
M: Other
|
6
tests/switch-6.tmpl
Normal file
6
tests/switch-6.tmpl
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
I: switch.qc
|
||||||
|
D: test switches - case 6
|
||||||
|
T: -execute
|
||||||
|
C: -std=fteqcc -frelaxed-switch
|
||||||
|
E: -float 80 -float 0
|
||||||
|
M: Enhanced 80
|
6
tests/switch-7.tmpl
Normal file
6
tests/switch-7.tmpl
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
I: switch.qc
|
||||||
|
D: test switches - case 7
|
||||||
|
T: -execute
|
||||||
|
C: -std=fteqcc -frelaxed-switch
|
||||||
|
E: -float 99 -float 0
|
||||||
|
M: 1 2 3 4 5 6
|
6
tests/switch-8.tmpl
Normal file
6
tests/switch-8.tmpl
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
I: switch.qc
|
||||||
|
D: test switches - case 8
|
||||||
|
T: -execute
|
||||||
|
C: -std=fteqcc -frelaxed-switch
|
||||||
|
E: -float 99 -float 6
|
||||||
|
M: early break
|
27
tests/switch.qc
Normal file
27
tests/switch.qc
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
void print(...) = #1;
|
||||||
|
string ftos(float) = #2;
|
||||||
|
|
||||||
|
void main(float param, float p2) {
|
||||||
|
float i;
|
||||||
|
float c80 = 80;
|
||||||
|
switch(param) {
|
||||||
|
case 3: print("Three, falling through to 2 - ");
|
||||||
|
case 2: print("Two\n"); break;
|
||||||
|
case 1: print("One\n"); break;
|
||||||
|
case 4: print("Four, falling through to default - ");
|
||||||
|
default: print("Other\n"); break;
|
||||||
|
|
||||||
|
case c80:
|
||||||
|
print("Enhanced 80\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 99:
|
||||||
|
if (p2 > 5) {
|
||||||
|
print("early break\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (i = 0; i < 5; i += 1)
|
||||||
|
print(ftos(i), " ");
|
||||||
|
print(ftos(i), "\n");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue