mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-24 04:41:25 +00:00
vararg testcases
This commit is contained in:
parent
f440c3c614
commit
61b777f575
2 changed files with 24 additions and 0 deletions
14
tests/varargs.qc
Normal file
14
tests/varargs.qc
Normal file
|
@ -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");
|
||||
}
|
10
tests/varargs.tmpl
Normal file
10
tests/varargs.tmpl
Normal file
|
@ -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
|
Loading…
Reference in a new issue