Added more tests

This commit is contained in:
2024-08-03 23:05:09 +02:00
parent dbf416d45b
commit 57ee65abd1
9 changed files with 77 additions and 2 deletions

44
tests/programs/switch.q Normal file
View File

@ -0,0 +1,44 @@
import sys
main() {
correct := 0
switch {
1 == 1 { correct += 1 }
}
switch {
1 == 1 { correct += 1 }
_ { correct -= 1 }
}
switch {
0 == 1 { correct -= 1 }
_ { correct += 1 }
}
switch {
0 == 1 { correct -= 1 }
0 == 2 { correct -= 1 }
_ { correct += 1 }
}
switch {
0 == 1 { correct -= 1 }
0 == 2 { correct -= 1 }
2 == 2 { correct += 1 }
_ { correct -= 1 }
}
switch {
0 == 1 { correct -= 1 }
0 == 2 { correct -= 1 }
0 == 3 { correct -= 1 }
}
if correct == 5 {
return
}
sys.exit(1)
}