Added a halt instruction test

This commit is contained in:
Sasha Koshka 2022-08-28 21:33:26 -04:00
parent a78c1dfcf1
commit c77925a7e0
1 changed files with 16 additions and 0 deletions

View File

@ -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()
}
}