2020-03-04 10:04:11 +00:00
|
|
|
package transaction
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/hex"
|
|
|
|
"testing"
|
|
|
|
|
2020-03-26 14:43:24 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/internal/testserdes"
|
2020-03-04 10:04:11 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestInvocationZeroScript(t *testing.T) {
|
|
|
|
// Zero-length script.
|
|
|
|
in, err := hex.DecodeString("000000000000000000")
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2020-05-27 20:32:19 +00:00
|
|
|
inv := &InvocationTX{}
|
2020-03-26 14:43:24 +00:00
|
|
|
assert.Error(t, testserdes.DecodeBinary(in, inv))
|
2020-03-04 10:04:11 +00:00
|
|
|
|
|
|
|
// PUSH1 script.
|
|
|
|
in, err = hex.DecodeString("01510000000000000000")
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
2020-03-26 14:43:24 +00:00
|
|
|
assert.NoError(t, testserdes.DecodeBinary(in, inv))
|
2020-03-04 10:04:11 +00:00
|
|
|
}
|