Combine peer protocol fuzz targets into one file

This commit is contained in:
Matt Joiner 2021-09-30 11:19:50 +10:00
parent 2027028539
commit 702cf3c8f7
2 changed files with 13 additions and 18 deletions

View File

@ -1,3 +1,5 @@
//go:build go1.18
package peer_protocol
import (
@ -43,3 +45,14 @@ func FuzzDecoder(f *testing.F) {
c.Assert(buf.Bytes(), qt.DeepEquals, b)
})
}
func FuzzMessageMarshalBinary(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
var m Message
if err := m.UnmarshalBinary(b); err != nil {
t.Skip(err)
}
b0 := m.MustMarshalBinary()
qt.Assert(t, b0, qt.DeepEquals, b)
})
}

View File

@ -1,18 +0,0 @@
package peer_protocol
import (
"testing"
qt "github.com/frankban/quicktest"
)
func FuzzMessageMarshalBinary(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
var m Message
if err := m.UnmarshalBinary(b); err != nil {
t.Skip(err)
}
b0 := m.MustMarshalBinary()
qt.Assert(t, b0, qt.DeepEquals, b)
})
}