]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Added preprocessor test
authorDale Weiler <killfieldengine@gmail.com>
Sun, 2 Dec 2012 23:16:44 +0000 (23:16 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Sun, 2 Dec 2012 23:16:44 +0000 (23:16 +0000)
tests/pmacros.qc [new file with mode: 0644]
tests/pmacros.tmpl [new file with mode: 0644]

diff --git a/tests/pmacros.qc b/tests/pmacros.qc
new file mode 100644 (file)
index 0000000..1ecee8c
--- /dev/null
@@ -0,0 +1,38 @@
+/* will never happen unless blown up */
+#ifndef GMQCC
+    void() main = { error-gmqcc-is-not-defined; };
+#else
+    const string standard =
+#   ifdef __STD_QCC__
+        "qcc"
+#   else
+#       ifdef __STD_GMQCC__
+            "gmqcc"
+#       else
+#           ifdef __STD_FTEQCC__
+                "fteqcc"
+#           else
+            "unknown"
+#           endif
+#       endif
+#   endif
+    ;
+    const string verminor = __STD_VERSION_MINOR__;
+    const string vermajor = __STD_VERSION_MAJOR__;
+
+#   define ALPHA_a "a"
+#   define ALPHA_b "b"
+#   define ALPHA_c "c"
+
+#   define ALPHA(SEL) ALPHA_##SEL
+
+#   define ABC ALPHA(a)##ALPHA(b)##ALPHA(c)
+
+    void(string, ...) print = #1;
+    void() main = {
+        if (ABC == "abc")
+            print("ABC\n");
+        if (standard != "unknown")
+            print("123\n");
+    };
+#endif
diff --git a/tests/pmacros.tmpl b/tests/pmacros.tmpl
new file mode 100644 (file)
index 0000000..3f6849c
--- /dev/null
@@ -0,0 +1,8 @@
+I: pmacros.qc
+D: test preprocessor
+T: -execute
+C: -std=fteqcc
+F: preprocessor failed
+S: preprocessor works
+M: ABC
+M: 123