(fn func(string, *Bitmap))
| 3263 | } |
| 3264 | |
| 3265 | func testDense(fn func(string, *Bitmap)) { |
| 3266 | bc := New() |
| 3267 | for i := 0; i <= arrayDefaultMaxSize; i++ { |
| 3268 | bc.Add(uint32(1 + MaxUint16 + i*2)) |
| 3269 | } |
| 3270 | |
| 3271 | rc := New() |
| 3272 | rc.AddRange(1, 2) |
| 3273 | rc.AddRange(bc.GetCardinality(), bc.GetCardinality()*2) |
| 3274 | |
| 3275 | ac := New() |
| 3276 | for i := 1; i <= arrayDefaultMaxSize; i++ { |
| 3277 | ac.Add(uint32(MaxUint16 + i*2)) |
| 3278 | } |
| 3279 | |
| 3280 | brc := New() |
| 3281 | for i := 150000; i < 450000; i++ { |
| 3282 | brc.Add(uint32(i)) |
| 3283 | } |
| 3284 | |
| 3285 | for _, tc := range []struct { |
| 3286 | name string |
| 3287 | rb *Bitmap |
| 3288 | }{ |
| 3289 | {"bitmap", bc}, |
| 3290 | {"run", rc}, |
| 3291 | {"array", ac}, |
| 3292 | {"bitmaps-and-runs", brc}, |
| 3293 | } { |
| 3294 | fn(tc.name+"-"+strconv.FormatUint(tc.rb.GetCardinality(), 10), tc.rb) |
| 3295 | } |
| 3296 | } |
| 3297 | |
| 3298 | func TestToDense(t *testing.T) { |
| 3299 | testDense(func(name string, rb *Bitmap) { |
no test coverage detected
searching dependent graphs…