mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-11 15:30:07 +00:00
26 lines
660 B
Go
26 lines
660 B
Go
|
package payload
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/nspcc-dev/neo-go/pkg/internal/testserdes"
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
func TestGetBlockDataEncodeDecode(t *testing.T) {
|
||
|
d := NewGetBlockData(123, 100)
|
||
|
testserdes.EncodeDecodeBinary(t, d, new(GetBlockData))
|
||
|
|
||
|
// invalid block count
|
||
|
d = NewGetBlockData(5, 0)
|
||
|
data, err := testserdes.EncodeBinary(d)
|
||
|
require.NoError(t, err)
|
||
|
require.Error(t, testserdes.DecodeBinary(data, new(GetBlockData)))
|
||
|
|
||
|
// invalid block count
|
||
|
d = NewGetBlockData(5, maxBlockCount+1)
|
||
|
data, err = testserdes.EncodeBinary(d)
|
||
|
require.NoError(t, err)
|
||
|
require.Error(t, testserdes.DecodeBinary(data, new(GetBlockData)))
|
||
|
}
|