From: Wolfgang (Blub) Bumiller Date: Mon, 19 Nov 2012 22:50:47 +0000 (+0100) Subject: switch testcases X-Git-Tag: 0.1.9~389 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5778b6ffb60296c5081fda4aa62bd566add98d0e;p=xonotic%2Fgmqcc.git switch testcases --- diff --git a/tests/switch-1.tmpl b/tests/switch-1.tmpl new file mode 100644 index 0000000..c44c0c9 --- /dev/null +++ b/tests/switch-1.tmpl @@ -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 diff --git a/tests/switch-2.tmpl b/tests/switch-2.tmpl new file mode 100644 index 0000000..4aa313b --- /dev/null +++ b/tests/switch-2.tmpl @@ -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 diff --git a/tests/switch-3.tmpl b/tests/switch-3.tmpl new file mode 100644 index 0000000..a7dc4cc --- /dev/null +++ b/tests/switch-3.tmpl @@ -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 diff --git a/tests/switch-4.tmpl b/tests/switch-4.tmpl new file mode 100644 index 0000000..1c9f524 --- /dev/null +++ b/tests/switch-4.tmpl @@ -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 diff --git a/tests/switch-5.tmpl b/tests/switch-5.tmpl new file mode 100644 index 0000000..1db84e6 --- /dev/null +++ b/tests/switch-5.tmpl @@ -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 diff --git a/tests/switch-6.tmpl b/tests/switch-6.tmpl new file mode 100644 index 0000000..ba65426 --- /dev/null +++ b/tests/switch-6.tmpl @@ -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 diff --git a/tests/switch-7.tmpl b/tests/switch-7.tmpl new file mode 100644 index 0000000..0420e28 --- /dev/null +++ b/tests/switch-7.tmpl @@ -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 diff --git a/tests/switch-8.tmpl b/tests/switch-8.tmpl new file mode 100644 index 0000000..343a3a5 --- /dev/null +++ b/tests/switch-8.tmpl @@ -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 diff --git a/tests/switch.qc b/tests/switch.qc new file mode 100644 index 0000000..c6396c5 --- /dev/null +++ b/tests/switch.qc @@ -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"); + } +}