mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-27 03:58:06 +00:00
vm: make PUSH0 create empty bytearray
Also make tests expect []byte{} instead of 0.
This commit is contained in:
parent
66501f9ef9
commit
09e197eaf3
7 changed files with 14 additions and 14 deletions
|
@ -26,7 +26,7 @@ var binaryExprTestCases = []testCase{
|
|||
return x
|
||||
}
|
||||
`,
|
||||
big.NewInt(0),
|
||||
[]byte{},
|
||||
},
|
||||
{
|
||||
"simple div",
|
||||
|
@ -86,7 +86,7 @@ var binaryExprTestCases = []testCase{
|
|||
return 0
|
||||
}
|
||||
`,
|
||||
big.NewInt(0),
|
||||
[]byte{},
|
||||
},
|
||||
{
|
||||
"compare equal strings with eql",
|
||||
|
@ -128,7 +128,7 @@ var binaryExprTestCases = []testCase{
|
|||
return 0
|
||||
}
|
||||
`,
|
||||
big.NewInt(0),
|
||||
[]byte{},
|
||||
},
|
||||
{
|
||||
"compare equal ints with eql",
|
||||
|
@ -156,7 +156,7 @@ var binaryExprTestCases = []testCase{
|
|||
return 0
|
||||
}
|
||||
`,
|
||||
big.NewInt(0),
|
||||
[]byte{},
|
||||
},
|
||||
{
|
||||
"compare not equal ints with eql",
|
||||
|
@ -170,7 +170,7 @@ var binaryExprTestCases = []testCase{
|
|||
return 0
|
||||
}
|
||||
`,
|
||||
big.NewInt(0),
|
||||
[]byte{},
|
||||
},
|
||||
{
|
||||
"compare not equal ints with neq",
|
||||
|
|
|
@ -275,7 +275,7 @@ func TestIfUnaryInvert(t *testing.T) {
|
|||
return 0
|
||||
}
|
||||
`
|
||||
eval(t, src, big.NewInt(0))
|
||||
eval(t, src, []byte{})
|
||||
}
|
||||
|
||||
func TestAppendByte(t *testing.T) {
|
||||
|
|
|
@ -35,7 +35,7 @@ func TestNotAssignedFunctionCall(t *testing.T) {
|
|||
return 0
|
||||
}
|
||||
`
|
||||
eval(t, src, big.NewInt(0))
|
||||
eval(t, src, []byte{})
|
||||
}
|
||||
|
||||
func TestMultipleFunctionCalls(t *testing.T) {
|
||||
|
|
|
@ -30,7 +30,7 @@ func TestGT(t *testing.T) {
|
|||
return 0
|
||||
}
|
||||
`
|
||||
eval(t, src, big.NewInt(0))
|
||||
eval(t, src, []byte{})
|
||||
}
|
||||
|
||||
func TestGTE(t *testing.T) {
|
||||
|
@ -44,7 +44,7 @@ func TestGTE(t *testing.T) {
|
|||
return 0
|
||||
}
|
||||
`
|
||||
eval(t, src, big.NewInt(0))
|
||||
eval(t, src, []byte{})
|
||||
}
|
||||
|
||||
func TestLAND(t *testing.T) {
|
||||
|
@ -89,5 +89,5 @@ func TestNestedIF(t *testing.T) {
|
|||
return 0
|
||||
}
|
||||
`
|
||||
eval(t, src, big.NewInt(0))
|
||||
eval(t, src, []byte{})
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ func TestImportStruct(t *testing.T) {
|
|||
return b.Y
|
||||
}
|
||||
`
|
||||
eval(t, src, big.NewInt(0))
|
||||
eval(t, src, []byte{})
|
||||
}
|
||||
|
||||
func TestMultipleDirFileImport(t *testing.T) {
|
||||
|
|
|
@ -179,7 +179,7 @@ var structTestCases = []testCase{
|
|||
return t.y
|
||||
}
|
||||
`,
|
||||
big.NewInt(0),
|
||||
[]byte{},
|
||||
},
|
||||
{
|
||||
"test return struct from func",
|
||||
|
@ -209,7 +209,7 @@ var structTestCases = []testCase{
|
|||
vm.NewBigIntegerItem(1),
|
||||
vm.NewBigIntegerItem(2),
|
||||
vm.NewByteArrayItem([]byte("hello")),
|
||||
vm.NewBigIntegerItem(0),
|
||||
vm.NewByteArrayItem([]byte{}),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -257,7 +257,7 @@ func (v *VM) execute(ctx *Context, op Instruction) {
|
|||
v.estack.PushVal(val)
|
||||
|
||||
case PUSH0:
|
||||
v.estack.PushVal(0)
|
||||
v.estack.PushVal([]byte{})
|
||||
|
||||
case PUSHDATA1:
|
||||
n := ctx.readByte()
|
||||
|
|
Loading…
Reference in a new issue