]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Testcases for -ftrue-empty-strings and -ffalse-empty-strings
authorWolfgang Bumiller <blub@speed.at>
Thu, 20 Dec 2012 19:43:58 +0000 (20:43 +0100)
committerWolfgang Bumiller <blub@speed.at>
Thu, 20 Dec 2012 19:43:58 +0000 (20:43 +0100)
tests/truth.qc [new file with mode: 0644]
tests/truth.tmpl [new file with mode: 0644]
tests/truth2.tmpl [new file with mode: 0644]
tests/truth3.tmpl [new file with mode: 0644]

diff --git a/tests/truth.qc b/tests/truth.qc
new file mode 100644 (file)
index 0000000..e08bde8
--- /dev/null
@@ -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 (file)
index 0000000..6c95314
--- /dev/null
@@ -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 (file)
index 0000000..e4a167f
--- /dev/null
@@ -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 (file)
index 0000000..106d105
--- /dev/null
@@ -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