Added more tests
This commit is contained in:
81
tests/programs/branch.q
Normal file
81
tests/programs/branch.q
Normal 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
|
||||
}
|
Reference in New Issue
Block a user