(b *testing.B, name string, test testGenericParseTypeUintCase)
| 1323 | } |
| 1324 | |
| 1325 | func benchGenericParseTypeUInt[V GenericTypeInteger](b *testing.B, name string, test testGenericParseTypeUintCase) { |
| 1326 | b.Helper() |
| 1327 | b.Run(name, func(t *testing.B) { |
| 1328 | var v V |
| 1329 | var err error |
| 1330 | b.ReportAllocs() |
| 1331 | b.ResetTimer() |
| 1332 | b.RunParallel(func(pb *testing.PB) { |
| 1333 | for pb.Next() { |
| 1334 | v, err = genericParseType[V](strconv.FormatUint(test.value, 10)) |
| 1335 | } |
| 1336 | }) |
| 1337 | if test.bits <= int(unsafe.Sizeof(V(0)))*8 { |
| 1338 | require.NoError(t, err) |
| 1339 | require.Equal(t, V(test.value), v) |
| 1340 | } else { |
| 1341 | require.ErrorIs(t, err, errParseValue) |
| 1342 | } |
| 1343 | }) |
| 1344 | } |
| 1345 | |
| 1346 | // go test -v -run=^$ -bench=Benchmark_GenericParseTypeFloats -benchmem -count=4 |
| 1347 | func Benchmark_GenericParseTypeFloats(b *testing.B) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…