From 712be84bba106b2a8edde95461b4b776b1a0b903 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 20 Dec 2012 20:43:58 +0100 Subject: [PATCH] Testcases for -ftrue-empty-strings and -ffalse-empty-strings --- tests/truth.qc | 29 +++++++++++++++++++++++++++++ tests/truth.tmpl | 10 ++++++++++ tests/truth2.tmpl | 10 ++++++++++ tests/truth3.tmpl | 10 ++++++++++ 4 files changed, 59 insertions(+) create mode 100644 tests/truth.qc create mode 100644 tests/truth.tmpl create mode 100644 tests/truth2.tmpl create mode 100644 tests/truth3.tmpl 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 -- 2.39.2