]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Combine peer protocol fuzz targets into one file
authorMatt Joiner <anacrolix@gmail.com>
Thu, 30 Sep 2021 01:19:50 +0000 (11:19 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 30 Sep 2021 01:19:50 +0000 (11:19 +1000)
peer_protocol/fuzz_test.go [moved from peer_protocol/decoder_fuzz_test.go with 75% similarity]
peer_protocol/msg_fuzz_test.go [deleted file]

similarity index 75%
rename from peer_protocol/decoder_fuzz_test.go
rename to peer_protocol/fuzz_test.go
index 2fd357e40f3e1c7ac1d7c8f701b5532f6c187c6f..2c92c70c227d562e7c4e78bbd397eb78794850cf 100644 (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)
+       })
+}
diff --git a/peer_protocol/msg_fuzz_test.go b/peer_protocol/msg_fuzz_test.go
deleted file mode 100644 (file)
index 9e214b3..0000000
+++ /dev/null
@@ -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)
-       })
-}