Implemented 32-bit jumps

This commit is contained in:
2024-07-10 15:01:46 +02:00
parent d3436b13a5
commit e24d9ebb50
10 changed files with 253 additions and 38 deletions

View File

@ -11,7 +11,6 @@ var examples = []struct {
ExpectedExitCode int
}{
{"hello", "", 0},
{"write", "ELF", 0},
{"fibonacci", "", 55},
}

187
tests/programs/jump-near.q Normal file
View 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)
}

View File

@ -30,6 +30,7 @@ var programs = []struct {
{"branch-and", "", 0},
{"branch-or", "", 0},
{"branch-both", "", 0},
{"jump-near", "", 0},
}
func TestPrograms(t *testing.T) {