diff --git a/codec/types/any_test.go b/codec/types/any_test.go index a7914d9484..e8d61de25e 100644 --- a/codec/types/any_test.go +++ b/codec/types/any_test.go @@ -56,9 +56,8 @@ func TestNewAnyWithCustomTypeURLWithErrorNoAllocation(t *testing.T) { var sink any func BenchmarkNewAnyWithCustomTypeURLWithErrorReturned(b *testing.B) { - b.ResetTimer() b.ReportAllocs() - for i := 0; i < b.N; i++ { + for b.Loop() { any, err := types.NewAnyWithValue(eom) if err == nil { b.Fatal("err wasn't returned") diff --git a/contrib/x/nft/internal/conv/string_test.go b/contrib/x/nft/internal/conv/string_test.go index 4bdba63565..8c7328c288 100644 --- a/contrib/x/nft/internal/conv/string_test.go +++ b/contrib/x/nft/internal/conv/string_test.go @@ -52,7 +52,7 @@ func (s *StringSuite) TestUnsafeBytesToStr() { } func BenchmarkUnsafeStrToBytes(b *testing.B) { - for i := 0; i < b.N; i++ { + for i := 0; b.Loop(); i++ { UnsafeStrToBytes(strconv.Itoa(i)) } } diff --git a/internal/conv/string_test.go b/internal/conv/string_test.go index c57205099b..e8f9589f99 100644 --- a/internal/conv/string_test.go +++ b/internal/conv/string_test.go @@ -52,7 +52,7 @@ func (s *StringSuite) TestUnsafeBytesToStr() { } func BenchmarkUnsafeStrToBytes(b *testing.B) { - for i := 0; i < b.N; i++ { + for i := 0; b.Loop(); i++ { UnsafeStrToBytes(strconv.Itoa(i)) } }