Implemented 32-bit jumps
This commit is contained in:
@ -11,7 +11,6 @@ var examples = []struct {
|
||||
ExpectedExitCode int
|
||||
}{
|
||||
{"hello", "", 0},
|
||||
{"write", "ELF", 0},
|
||||
{"fibonacci", "", 55},
|
||||
}
|
||||
|
||||
|
187
tests/programs/jump-near.q
Normal file
187
tests/programs/jump-near.q
Normal file
@ -0,0 +1,187 @@
|
||||
main() {
|
||||
x := 10
|
||||
|
||||
if x == 0 {
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
}
|
||||
|
||||
if x != 10 {
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
}
|
||||
|
||||
if x > 10 {
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
}
|
||||
|
||||
if x < 10 {
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
}
|
||||
|
||||
if x >= 11 {
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
}
|
||||
|
||||
if x <= 9 {
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
fail()
|
||||
}
|
||||
|
||||
exit(0)
|
||||
}
|
||||
|
||||
fail() {
|
||||
exit(1)
|
||||
}
|
||||
|
||||
exit(code) {
|
||||
syscall(60, code)
|
||||
}
|
@ -30,6 +30,7 @@ var programs = []struct {
|
||||
{"branch-and", "", 0},
|
||||
{"branch-or", "", 0},
|
||||
{"branch-both", "", 0},
|
||||
{"jump-near", "", 0},
|
||||
}
|
||||
|
||||
func TestPrograms(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user