]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
vararg testcases
authorWolfgang Bumiller <blub@speed.at>
Sat, 12 Jan 2013 15:37:26 +0000 (16:37 +0100)
committerWolfgang Bumiller <blub@speed.at>
Sat, 12 Jan 2013 15:37:26 +0000 (16:37 +0100)
tests/varargs.qc [new file with mode: 0644]
tests/varargs.tmpl [new file with mode: 0644]

diff --git a/tests/varargs.qc b/tests/varargs.qc
new file mode 100644 (file)
index 0000000..ffe7d1b
--- /dev/null
@@ -0,0 +1,14 @@
+void(string...)   print  = #1;
+string(float)     ftos   = #2;
+
+void nbva(float a, string...count) {
+    print("You gave me ", ftos(count), " additional parameters\n");
+    print("First: ", ...(0, string), "\n");
+    print("You chose: ", ...(a, string), "\n");
+    for (a = 0; a < count; ++a)
+        print("Vararg ", ftos(a), " = ", ...(a, string), "\n");
+}
+
+void main() {
+    nbva(1, "Hello", "You", "There");
+}
diff --git a/tests/varargs.tmpl b/tests/varargs.tmpl
new file mode 100644 (file)
index 0000000..d8130a8
--- /dev/null
@@ -0,0 +1,10 @@
+I: varargs.qc
+D: non-builtin vararg support
+T: -execute
+C: -std=fteqcc -fvariadic-args
+M: You gave me 3 additional parameters
+M: First: Hello
+M: You chose: You
+M: Vararg 0 = Hello
+M: Vararg 1 = You
+M: Vararg 2 = There