-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
19 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
|
||
@version 1.0 | ||
@swipe 8.2 | ||
@name "Swipe test" | ||
@by "HJfod" | ||
|
||
function vararg(named, x, y, args...) { | ||
// todo: why tf is this not just args[0], args[1]??? why is args not just an array??? | ||
print("named: {}, x: {}, y: {}, argument0: {}, argument1: {}", argument0, argument1) | ||
function test(func, expected, msg) { | ||
res = func() | ||
if res != expected { | ||
print("test '{}' failed: {} != {}", msg, res, expected) | ||
} | ||
} | ||
|
||
function testVariadic(args...) { | ||
result = 0 | ||
for arg in args { | ||
result += arg | ||
} | ||
return result | ||
} | ||
test(testVariadic(1, 2, 3, 4, 5, 6, 7), 1 + 2 + 3 + 4 + 5 + 6 + 7, "variadic sum") | ||
|
||
function vararg(named, x, y, args...) { | ||
print("named: {}, x: {}, y: {}, args[0]: {}, args[1]: {}", args[0], args[1]) | ||
} | ||
vararg("hi", 5, true, "six", y = 6, ball) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters