github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/core/transaction/fuzz_test.go (about)

     1  package transaction
     2  
     3  import (
     4  	"encoding/base64"
     5  	"testing"
     6  
     7  	"github.com/nspcc-dev/neo-go/pkg/util"
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  func FuzzNewTransactionFromBytes(f *testing.F) {
    12  	b, err := base64.StdEncoding.DecodeString(rawInvocationTX)
    13  	require.NoError(f, err)
    14  	f.Add(b)
    15  	tx := New([]byte{0x51}, 1)
    16  	tx.Signers = []Signer{{Account: util.Uint160{1, 2, 3}}}
    17  	tx.Scripts = []Witness{{InvocationScript: []byte{}, VerificationScript: []byte{}}}
    18  	f.Add(tx.Bytes())
    19  	f.Fuzz(func(t *testing.T, b []byte) {
    20  		require.NotPanics(t, func() {
    21  			_, _ = NewTransactionFromBytes(b)
    22  		})
    23  	})
    24  }