vm: implement PUSHNULL opcode

This commit is contained in:
Evgenii Stratonikov 2020-03-23 11:58:41 +03:00
parent e50b529631
commit 3db030bbb6
3 changed files with 13 additions and 0 deletions

View file

@ -197,6 +197,15 @@ func TestStackLimitPUSH1Bad(t *testing.T) {
checkVMFailed(t, v)
}
func TestPUSHNULL(t *testing.T) {
prog := makeProgram(opcode.PUSHNULL, opcode.PUSHNULL, opcode.EQUAL)
v := load(prog)
require.NoError(t, v.Step())
require.Equal(t, 1, v.estack.Len())
runVM(t, v)
require.True(t, v.estack.Pop().Bool())
}
// appendBigStruct returns a program which:
// 1. pushes size Structs on stack
// 2. packs them into a new struct