github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/network/fuzz_test.go (about) 1 package network 2 3 import ( 4 "math/rand" 5 "testing" 6 7 "github.com/nspcc-dev/neo-go/pkg/io" 8 "github.com/stretchr/testify/require" 9 ) 10 11 func FuzzMessageDecode(f *testing.F) { 12 for i := 0; i < 100; i++ { 13 seed := make([]byte, rand.Uint32()%1000) 14 //nolint:staticcheck 15 rand.Read(seed) 16 f.Add(seed) 17 } 18 19 f.Fuzz(func(t *testing.T, value []byte) { 20 m := new(Message) 21 r := io.NewBinReaderFromBuf(value) 22 require.NotPanics(t, func() { _ = m.Decode(r) }) 23 }) 24 }