From c77925a7e007bd8e1b87b956770add18c60397e2 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Sun, 28 Aug 2022 21:33:26 -0400 Subject: [PATCH] Added a halt instruction test --- creature_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/creature_test.go b/creature_test.go index 4ac4f94..e148dd4 100644 --- a/creature_test.go +++ b/creature_test.go @@ -183,3 +183,19 @@ func TestPeekPoke(test *testing.T) { test.Fail() } } + +func TestHalt(test *testing.T) { + machine := runMachineTest ([]int { + PUSH, 32, + HALT, + PUSH, 3, + }, nil, test) + + result := machine.Pop() + test.Log("popped:", result) + + if result != 32 { + test.Log("result should be", 32) + test.Fail() + } +}