From 61b777f5757e5fa085e5a9caa08ba8da2739455d Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Sat, 12 Jan 2013 16:37:26 +0100 Subject: [PATCH] vararg testcases --- tests/varargs.qc | 14 ++++++++++++++ tests/varargs.tmpl | 10 ++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/varargs.qc create mode 100644 tests/varargs.tmpl 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