diff --git a/pkg/compiler/assign_test.go b/pkg/compiler/assign_test.go index b770e8a61..41f5a9dcd 100644 --- a/pkg/compiler/assign_test.go +++ b/pkg/compiler/assign_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/nspcc-dev/neo-go/pkg/compiler" + "github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger" "github.com/nspcc-dev/neo-go/pkg/vm" "github.com/stretchr/testify/require" ) @@ -149,8 +150,7 @@ func TestAssignments(t *testing.T) { for i, tc := range assignTestCases { v := vm.New() t.Run(tc.name, func(t *testing.T) { - v.Istack().Clear() - v.Estack().Clear() + v.Reset(trigger.Application) invokeMethod(t, fmt.Sprintf("F%d", i), ne.Script, v, di) runAndCheck(t, v, tc.result) }) diff --git a/pkg/compiler/binary_expr_test.go b/pkg/compiler/binary_expr_test.go index b03a33727..725c66136 100644 --- a/pkg/compiler/binary_expr_test.go +++ b/pkg/compiler/binary_expr_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/nspcc-dev/neo-go/pkg/compiler" + "github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger" "github.com/nspcc-dev/neo-go/pkg/vm" "github.com/stretchr/testify/require" ) @@ -238,8 +239,7 @@ func TestBinaryExprs(t *testing.T) { for i, tc := range binaryExprTestCases { v := vm.New() t.Run(tc.name, func(t *testing.T) { - v.Istack().Clear() - v.Estack().Clear() + v.Reset(trigger.Application) invokeMethod(t, fmt.Sprintf("F%d", i), ne.Script, v, di) runAndCheck(t, v, tc.result) }) diff --git a/pkg/compiler/convert_test.go b/pkg/compiler/convert_test.go index 073b153de..eba50b332 100644 --- a/pkg/compiler/convert_test.go +++ b/pkg/compiler/convert_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/nspcc-dev/neo-go/pkg/compiler" + "github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger" "github.com/nspcc-dev/neo-go/pkg/vm" "github.com/stretchr/testify/require" ) @@ -72,8 +73,7 @@ func TestConvert(t *testing.T) { for i, tc := range convertTestCases { v := vm.New() t.Run(tc.argValue+getFunctionName(tc.returnType), func(t *testing.T) { - v.Istack().Clear() - v.Estack().Clear() + v.Reset(trigger.Application) invokeMethod(t, fmt.Sprintf("F%d", i), ne.Script, v, di) runAndCheck(t, v, tc.result) }) diff --git a/pkg/compiler/for_test.go b/pkg/compiler/for_test.go index bf451af1c..a07cad913 100644 --- a/pkg/compiler/for_test.go +++ b/pkg/compiler/for_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/nspcc-dev/neo-go/pkg/compiler" + "github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger" "github.com/nspcc-dev/neo-go/pkg/vm" "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" "github.com/stretchr/testify/require" @@ -727,8 +728,7 @@ func TestForLoop(t *testing.T) { for i, tc := range forLoopTestCases { v := vm.New() t.Run(tc.name, func(t *testing.T) { - v.Istack().Clear() - v.Estack().Clear() + v.Reset(trigger.Application) invokeMethod(t, fmt.Sprintf("F%d", i), ne.Script, v, di) runAndCheck(t, v, tc.result) }) @@ -785,8 +785,7 @@ func TestForLoopComplexConditions(t *testing.T) { name = tc.Assign } t.Run(name, func(t *testing.T) { - v.Istack().Clear() - v.Estack().Clear() + v.Reset(trigger.Application) invokeMethod(t, fmt.Sprintf("F%d", i), ne.Script, v, di) runAndCheck(t, v, big.NewInt(tc.Result)) }) diff --git a/pkg/compiler/vm_test.go b/pkg/compiler/vm_test.go index a6826a028..58a4cda57 100644 --- a/pkg/compiler/vm_test.go +++ b/pkg/compiler/vm_test.go @@ -84,7 +84,7 @@ func evalWithArgs(t *testing.T, src string, op []byte, args []stackitem.Item, re func assertResult(t *testing.T, vm *vm.VM, result interface{}) { assert.Equal(t, result, vm.PopResult()) - assert.Equal(t, 0, vm.Istack().Len()) + assert.Nil(t, vm.Context()) } func vmAndCompile(t *testing.T, src string) *vm.VM {