Added more tests

This commit is contained in:
Eduard Urbach 2024-07-07 17:13:22 +02:00
parent b5efc533ea
commit 78ae050d18
Signed by: eduard
GPG key ID: 49226B848C78F6C8
7 changed files with 157 additions and 13 deletions

81
tests/programs/branch.q Normal file
View file

@ -0,0 +1,81 @@
main() {
x := 0
if x != 0 {
exit(1)
}
if x > 0 {
exit(1)
}
if x < 0 {
exit(1)
}
if 0 != x {
exit(1)
}
if 0 > x {
exit(1)
}
if 0 < x {
exit(1)
}
if x >= 1 {
exit(1)
}
if 1 <= x {
exit(1)
}
if x == inc(x) {
exit(1)
}
if x == dec(x) {
exit(1)
}
if inc(0) == x {
exit(1)
}
if dec(0) == x {
exit(1)
}
if inc(x) == dec(x) {
exit(1)
}
if x + 1 != inc(x) {
exit(1)
}
if x + 1 != x + 1 {
exit(1)
}
if x == 0 {
exit(0)
}
exit(1)
}
exit(x) {
syscall(60, x)
}
inc(x) {
return x + 1
}
dec(x) {
return x - 1
}