diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aaea8ed --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +cid-fuzz.zip diff --git a/cid_fuzz.go b/cid_fuzz.go index 495ec4d..0d47167 100644 --- a/cid_fuzz.go +++ b/cid_fuzz.go @@ -10,8 +10,26 @@ func Fuzz(data []byte) int { } _ = cid.Bytes() + _ = cid.String() + _ = cid.Prefix() + if !cid.Equals(cid) { panic("inequality") } + + // json loop + json, err := cid.MarshalJSON() + if err != nil { + panic(err.Error()) + } + cid2 := &Cid{} + err = cid2.UnmarshalJSON(json) + if err != nil { + panic(err.Error()) + } + + if !cid.Equals(cid2) { + panic("json loop not equal") + } return 1 }