mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-27 14:12:36 +00:00
Testcases for -ftrue-empty-strings and -ffalse-empty-strings
This commit is contained in:
parent
68c4070f62
commit
712be84bba
4 changed files with 59 additions and 0 deletions
29
tests/truth.qc
Normal file
29
tests/truth.qc
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
void print(...) = #1;
|
||||||
|
string ftos (float) = #2;
|
||||||
|
|
||||||
|
void test(string s) {
|
||||||
|
print(ftos(!s));
|
||||||
|
if (s) print(" on");
|
||||||
|
if (!s) print(" off");
|
||||||
|
if (!!s) print(" !!on");
|
||||||
|
print("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void test2(string s) {
|
||||||
|
print(ftos(!s));
|
||||||
|
while (s) { print(" on"); break; }
|
||||||
|
while (!s) { print(" off"); break; }
|
||||||
|
while (!!s) { print(" !!on"); break; }
|
||||||
|
print("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
string str_nul;
|
||||||
|
|
||||||
|
void main(vector v) {
|
||||||
|
test("foo");
|
||||||
|
test2("foo");
|
||||||
|
test("");
|
||||||
|
test2("");
|
||||||
|
test(str_nul);
|
||||||
|
test2(str_nul);
|
||||||
|
}
|
10
tests/truth.tmpl
Normal file
10
tests/truth.tmpl
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
I: truth.qc
|
||||||
|
D: -ffalse-empty-strings
|
||||||
|
T: -execute
|
||||||
|
C: -std=fteqcc -ffalse-empty-strings
|
||||||
|
M: 0 on !!on
|
||||||
|
M: 0 on !!on
|
||||||
|
M: 1 off
|
||||||
|
M: 1 off
|
||||||
|
M: 1 off
|
||||||
|
M: 1 off
|
10
tests/truth2.tmpl
Normal file
10
tests/truth2.tmpl
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
I: truth.qc
|
||||||
|
D: regular truth
|
||||||
|
T: -execute
|
||||||
|
C: -std=fteqcc
|
||||||
|
M: 0 on !!on
|
||||||
|
M: 0 on !!on
|
||||||
|
M: 1 on off
|
||||||
|
M: 1 on off
|
||||||
|
M: 1 off
|
||||||
|
M: 1 off
|
10
tests/truth3.tmpl
Normal file
10
tests/truth3.tmpl
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
I: truth.qc
|
||||||
|
D: -ftrue-empty-strings
|
||||||
|
T: -execute
|
||||||
|
C: -std=fteqcc -ftrue-empty-strings
|
||||||
|
M: 0 on !!on
|
||||||
|
M: 0 on !!on
|
||||||
|
M: 0 on !!on
|
||||||
|
M: 0 on !!on
|
||||||
|
M: 1 off
|
||||||
|
M: 1 off
|
Loading…
Reference in a new issue