More opcode tests

This commit is contained in:
Ian Gulliver
2021-11-19 15:32:49 -10:00
parent cfec23f4e9
commit 4988893b10

View File

@@ -153,3 +153,57 @@ functions:
expectGlobalMemory(t, state, 1, 3)
}
func TestGTU(t *testing.T) {
state := assembleAndExecute(t, `
functions:
- - [mov, g0, 5]
- [gtu, g0, 4]
- [jmpt, +2]
- [add, g1, 1]
- [gtu, g0, 5]
- [jmpt, +2]
- [add, g1, 2]
- [gtu, g0, 6]
- [jmpt, +2]
- [add, g1, 4]
`)
expectGlobalMemory(t, state, 1, 6)
}
func TestLTEU(t *testing.T) {
state := assembleAndExecute(t, `
functions:
- - [mov, g0, 5]
- [lteu, g0, 4]
- [jmpt, +2]
- [add, g1, 1]
- [lteu, g0, 5]
- [jmpt, +2]
- [add, g1, 2]
- [lteu, g0, 6]
- [jmpt, +2]
- [add, g1, 4]
`)
expectGlobalMemory(t, state, 1, 1)
}
func TestGTEU(t *testing.T) {
state := assembleAndExecute(t, `
functions:
- - [mov, g0, 5]
- [gteu, g0, 4]
- [jmpt, +2]
- [add, g1, 1]
- [gteu, g0, 5]
- [jmpt, +2]
- [add, g1, 2]
- [gteu, g0, 6]
- [jmpt, +2]
- [add, g1, 4]
`)
expectGlobalMemory(t, state, 1, 4)
}