(b *testing.B)
| 105 | } |
| 106 | |
| 107 | func BenchmarkDecimalString(b *testing.B) { |
| 108 | rng := rand.New(rand.NewSource(461210934723948)) |
| 109 | corpus := func() []Decimal { |
| 110 | res := make([]Decimal, 8192) |
| 111 | for i := range res { |
| 112 | _, err := res[i].SetFloat64(rng.Float64()) |
| 113 | if err != nil { |
| 114 | b.Fatal(err) |
| 115 | } |
| 116 | } |
| 117 | return res |
| 118 | }() |
| 119 | b.ResetTimer() |
| 120 | b.ReportAllocs() |
| 121 | for i := 0; i < b.N; i++ { |
| 122 | _ = corpus[rng.Intn(len(corpus))].String() |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | func BenchmarkDecimalSetFloat(b *testing.B) { |
| 127 | rng := rand.New(rand.NewSource(461210934723948)) |
nothing calls this directly
no test coverage detected
searching dependent graphs…