diff --git a/creature_test.go b/creature_test.go index e148dd4..50a4244 100644 --- a/creature_test.go +++ b/creature_test.go @@ -199,3 +199,31 @@ func TestHalt(test *testing.T) { test.Fail() } } + +func TestJump(test *testing.T) { + machine := runMachineTest ([]int { + PUSH, 1, + PUSH, 8, + JMP, + + PUSH, 3, + HALT, + + PUSH, 0, + PUSH, 16, + JMP, + + PUSH, 4, + HALT, + + PUSH, 5, + }, nil, test) + + result := machine.Pop() + test.Log("popped:", result) + + if result != 4 { + test.Log("result should be", 4) + test.Fail() + } +}