github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/network/payload/mptdata_test.go (about)

     1  package payload
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/nspcc-dev/neo-go/internal/testserdes"
     7  	"github.com/stretchr/testify/require"
     8  )
     9  
    10  func TestMPTData_EncodeDecodeBinary(t *testing.T) {
    11  	t.Run("empty", func(t *testing.T) {
    12  		d := new(MPTData)
    13  		bytes, err := testserdes.EncodeBinary(d)
    14  		require.NoError(t, err)
    15  		require.Error(t, testserdes.DecodeBinary(bytes, new(MPTData)))
    16  	})
    17  
    18  	t.Run("good", func(t *testing.T) {
    19  		d := &MPTData{
    20  			Nodes: [][]byte{{}, {1}, {1, 2, 3}},
    21  		}
    22  		testserdes.EncodeDecodeBinary(t, d, new(MPTData))
    23  	})
    24  }