mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 23:33:37 +00:00
1b83dc2476
Mostly it's about Go 1.22+ syntax with ranging over integers, but it also prefers ranging over slices where possible (it makes code a little better to read). Notice that we have a number of dangerous loops where slices are mutated during loop execution, many of these can't be converted since we need proper length evalutation at every iteration. Signed-off-by: Roman Khimov <roman@nspcc.ru>
24 lines
472 B
Go
24 lines
472 B
Go
package network
|
|
|
|
import (
|
|
"math/rand/v2"
|
|
"testing"
|
|
|
|
"github.com/nspcc-dev/neo-go/internal/random"
|
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func FuzzMessageDecode(f *testing.F) {
|
|
for range 100 {
|
|
seed := make([]byte, rand.IntN(1000))
|
|
random.Fill(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) })
|
|
})
|
|
}
|