diff --git a/test/opcode_test.go b/test/opcode_test.go index 7068f51..f9518d5 100644 --- a/test/opcode_test.go +++ b/test/opcode_test.go @@ -154,6 +154,24 @@ functions: expectGlobalMemory(t, state, 1, 3) } +func TestLTS(t *testing.T) { + state := assembleAndExecute(t, ` +functions: +- - [mov, g0, 0] + - [lts, g0, -1] + - [jmpt, +2] + - [add, g1, 1] + - [lts, g0, 0] + - [jmpt, +2] + - [add, g1, 2] + - [lts, g0, 1] + - [jmpt, +2] + - [add, g1, 4] +`) + + expectGlobalMemory(t, state, 1, 3) +} + func TestGTU(t *testing.T) { state := assembleAndExecute(t, ` functions: @@ -172,6 +190,24 @@ functions: expectGlobalMemory(t, state, 1, 6) } +func TestGTS(t *testing.T) { + state := assembleAndExecute(t, ` +functions: +- - [mov, g0, 0] + - [gts, g0, -1] + - [jmpt, +2] + - [add, g1, 1] + - [gts, g0, 0] + - [jmpt, +2] + - [add, g1, 2] + - [gts, g0, 1] + - [jmpt, +2] + - [add, g1, 4] +`) + + expectGlobalMemory(t, state, 1, 6) +} + func TestLTEU(t *testing.T) { state := assembleAndExecute(t, ` functions: @@ -190,6 +226,24 @@ functions: expectGlobalMemory(t, state, 1, 1) } +func TestLTES(t *testing.T) { + state := assembleAndExecute(t, ` +functions: +- - [mov, g0, 0] + - [ltes, g0, -1] + - [jmpt, +2] + - [add, g1, 1] + - [ltes, g0, 0] + - [jmpt, +2] + - [add, g1, 2] + - [ltes, g0, 1] + - [jmpt, +2] + - [add, g1, 4] +`) + + expectGlobalMemory(t, state, 1, 1) +} + func TestGTEU(t *testing.T) { state := assembleAndExecute(t, ` functions: @@ -207,3 +261,21 @@ functions: expectGlobalMemory(t, state, 1, 4) } + +func TestGTES(t *testing.T) { + state := assembleAndExecute(t, ` +functions: +- - [mov, g0, 0] + - [gtes, g0, -1] + - [jmpt, +2] + - [add, g1, 1] + - [gtes, g0, 0] + - [jmpt, +2] + - [add, g1, 2] + - [gtes, g0, 1] + - [jmpt, +2] + - [add, g1, 4] +`) + + expectGlobalMemory(t, state, 1, 4) +}