mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-21 18:30:52 +00:00
Added tests for 'noreturn'
This commit is contained in:
parent
f1a662a422
commit
a301796186
5 changed files with 45 additions and 0 deletions
29
tests/noreturn.qc
Normal file
29
tests/noreturn.qc
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef NORETURN
|
||||
#define NORETURN noreturn
|
||||
#endif
|
||||
|
||||
void print(...) = #1;
|
||||
string ftos(float) = #2;
|
||||
NORETURN void error(...) = #6;
|
||||
|
||||
#if TEST == 1
|
||||
void test1(float a) {
|
||||
float x;
|
||||
|
||||
if (a == 1) x = 1337;
|
||||
else if (a == 2) x = 1338;
|
||||
else
|
||||
error("Error\n");
|
||||
print("Is this initialized: ", ftos(x), "\n");
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
float test2(float it) {
|
||||
switch (it) {
|
||||
case 1: return 0;
|
||||
case 2: return 1;
|
||||
default: error("End of non-void not reachable...\n");
|
||||
}
|
||||
}
|
||||
#endif
|
4
tests/noreturn1.tmpl
Normal file
4
tests/noreturn1.tmpl
Normal file
|
@ -0,0 +1,4 @@
|
|||
I: noreturn.qc
|
||||
D: noreturn keyword - should work
|
||||
T: -compile
|
||||
C: -std=fteqcc -Wall -Werror -DTEST=1 -DNORETURN=noreturn
|
4
tests/noreturn2.tmpl
Normal file
4
tests/noreturn2.tmpl
Normal file
|
@ -0,0 +1,4 @@
|
|||
I: noreturn.qc
|
||||
D: noreturn keyword - should fail
|
||||
T: -compile
|
||||
C: -std=fteqcc -Wall -Werror -DTEST=2 -DNORETURN=noreturn
|
4
tests/noreturn3.tmpl
Normal file
4
tests/noreturn3.tmpl
Normal file
|
@ -0,0 +1,4 @@
|
|||
I: noreturn.qc
|
||||
D: noreturn keyword - should work
|
||||
T: -fail
|
||||
C: -std=fteqcc -Wall -Werror -DTEST=1 -DNORETURN
|
4
tests/noreturn4.tmpl
Normal file
4
tests/noreturn4.tmpl
Normal file
|
@ -0,0 +1,4 @@
|
|||
I: noreturn.qc
|
||||
D: noreturn keyword - should fail
|
||||
T: -fail
|
||||
C: -std=fteqcc -Wall -Werror -DTEST=2 -DNORETURN
|
Loading…
Reference in a new issue