diff --git a/cid_test.go b/cid_test.go index b7bdd89..a2e1737 100644 --- a/cid_test.go +++ b/cid_test.go @@ -383,3 +383,17 @@ func TestFromJson(t *testing.T) { t.Fatal("json parsing failed") } } + +func BenchmarkStringV1(b *testing.B) { + data := []byte("this is some test content") + hash, _ := mh.Sum(data, mh.SHA2_256, -1) + cid := NewCidV1(Raw, hash) + b.ResetTimer() + count := 0 + for i := 0; i < b.N; i++ { + count += len(cid.String()) + } + if count != 49*b.N { + b.FailNow() + } +}