Added more tests

This commit is contained in:
Eduard Urbach 2024-08-03 23:05:09 +02:00
parent 52d1de042c
commit a811da3477
Signed by: eduard
GPG key ID: 49226B848C78F6C8
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)
}