10 qt "github.com/frankban/quicktest"
11 "github.com/google/go-cmp/cmp"
14 var bencodeInterfaceChecker = qt.CmpEquals(cmp.Comparer(func(a, b *big.Int) bool {
18 func Fuzz(f *testing.F) {
19 for _, ret := range random_encode_tests {
20 f.Add([]byte(ret.expected))
22 f.Fuzz(func(t *testing.T, b []byte) {
25 err := Unmarshal(b, &d)
30 c.Assert(err, qt.IsNil)
32 err = Unmarshal(b0, &d0)
33 c.Assert(err, qt.IsNil)
34 c.Assert(d0, bencodeInterfaceChecker, d)
38 func FuzzInterfaceRoundTrip(f *testing.F) {
39 for _, ret := range random_encode_tests {
40 f.Add([]byte(ret.expected))
42 f.Fuzz(func(t *testing.T, b []byte) {
45 err := Unmarshal(b, &d)
50 c.Assert(err, qt.IsNil)
51 c.Check(b0, qt.DeepEquals, b)