| 221 | } |
| 222 | |
| 223 | static void TestPickAt(int items, const int32* weights) { |
| 224 | WeightedPicker picker(items); |
| 225 | picker.SetWeightsFromArray(items, weights); |
| 226 | int weight_index = 0; |
| 227 | for (int i = 0; i < items; ++i) { |
| 228 | for (int j = 0; j < weights[i]; ++j) { |
| 229 | int pick = picker.PickAt(weight_index); |
| 230 | EXPECT_EQ(pick, i); |
| 231 | ++weight_index; |
| 232 | } |
| 233 | } |
| 234 | EXPECT_EQ(weight_index, picker.total_weight()); |
| 235 | } |
| 236 | |
| 237 | static void BM_Create(int iters, int arg) { |
| 238 | while (--iters > 0) { |
no test coverage detected