From: Wolfgang Bumiller Date: Thu, 20 Dec 2012 19:43:58 +0000 (+0100) Subject: Testcases for -ftrue-empty-strings and -ffalse-empty-strings X-Git-Tag: 0.2~42 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=712be84bba106b2a8edde95461b4b776b1a0b903;p=xonotic%2Fgmqcc.git Testcases for -ftrue-empty-strings and -ffalse-empty-strings --- diff --git a/tests/truth.qc b/tests/truth.qc new file mode 100644 index 0000000..e08bde8 --- /dev/null +++ b/tests/truth.qc @@ -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); +} diff --git a/tests/truth.tmpl b/tests/truth.tmpl new file mode 100644 index 0000000..6c95314 --- /dev/null +++ b/tests/truth.tmpl @@ -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 diff --git a/tests/truth2.tmpl b/tests/truth2.tmpl new file mode 100644 index 0000000..e4a167f --- /dev/null +++ b/tests/truth2.tmpl @@ -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 diff --git a/tests/truth3.tmpl b/tests/truth3.tmpl new file mode 100644 index 0000000..106d105 --- /dev/null +++ b/tests/truth3.tmpl @@ -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