From 4988893b10bd90aeb6e8183db67168277a6d46c7 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Fri, 19 Nov 2021 15:32:49 -1000 Subject: [PATCH] More opcode tests --- test/opcode_test.go | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/test/opcode_test.go b/test/opcode_test.go index 3af78aa..7068f51 100644 --- a/test/opcode_test.go +++ b/test/opcode_test.go @@ -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) +}