neo-go/pkg/network/fuzz_test.go
Anna Shaleva 3aa858a69f *: drop go 1.18 support in doc and build targets
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-12 17:59:42 +03:00

23 lines
434 B
Go

package network
import (
"math/rand"
"testing"
"github.com/nspcc-dev/neo-go/pkg/io"
"github.com/stretchr/testify/require"
)
func FuzzMessageDecode(f *testing.F) {
for i := 0; i < 100; i++ {
seed := make([]byte, rand.Uint32()%1000)
rand.Read(seed)
f.Add(seed)
}
f.Fuzz(func(t *testing.T, value []byte) {
m := new(Message)
r := io.NewBinReaderFromBuf(value)
require.NotPanics(t, func() { _ = m.Decode(r) })
})
}