From: Wolfgang Bumiller Date: Sat, 12 Jan 2013 15:37:26 +0000 (+0100) Subject: vararg testcases X-Git-Tag: before-library~277 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=61b777f5757e5fa085e5a9caa08ba8da2739455d;p=xonotic%2Fgmqcc.git vararg testcases --- diff --git a/tests/varargs.qc b/tests/varargs.qc new file mode 100644 index 0000000..ffe7d1b --- /dev/null +++ b/tests/varargs.qc @@ -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 index 0000000..d8130a8 --- /dev/null +++ b/tests/varargs.tmpl @@ -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