(t *testing.T)
| 74 | } |
| 75 | |
| 76 | func TestSamplers(t *testing.T) { |
| 77 | for i := range samplers { |
| 78 | s := samplers[i] |
| 79 | t.Run(s.name, func(t *testing.T) { |
| 80 | sampler := s.sampler() |
| 81 | got := 0 |
| 82 | for t := s.total; t > 0; t-- { |
| 83 | if sampler.Sample(0) { |
| 84 | got++ |
| 85 | } |
| 86 | } |
| 87 | if got < s.wantMin || got > s.wantMax { |
| 88 | t.Errorf("%s.Sample(0) == true %d on %d, want [%d, %d]", s.name, got, s.total, s.wantMin, s.wantMax) |
| 89 | } |
| 90 | }) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | func BenchmarkSamplers(b *testing.B) { |
| 95 | for i := range samplers { |