mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
40 lines
524 B
Plaintext
40 lines
524 B
Plaintext
|
|
|
|
//test true jump
|
|
if (true) {
|
|
assert true, "if-then failed";
|
|
}
|
|
else {
|
|
assert false, "if-then failed";
|
|
}
|
|
|
|
|
|
//test false jump
|
|
if (false) {
|
|
assert false, "if-then failed";
|
|
}
|
|
else {
|
|
assert true, "if-then failed";
|
|
}
|
|
|
|
|
|
//test while loop
|
|
var whileCounter = 0;
|
|
while (whileCounter < 10) {
|
|
whileCounter = whileCounter + 1;
|
|
}
|
|
|
|
assert whileCounter == 10, "while-loop failed";
|
|
|
|
|
|
//test for loop
|
|
var forCache = 0;
|
|
for (var i = 0; i < 20; i = i + 1) {
|
|
forCache = i;
|
|
}
|
|
|
|
assert forCache == 19, "for-loop failed";
|
|
|
|
|
|
print "All good";
|