MCPcopy
hub / github.com/RoaringBitmap/roaring / TestNextMany

Function TestNextMany

roaring_test.go:2489–2525  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2487}
2488
2489func TestNextMany(t *testing.T) {
2490 count := 70000
2491
2492 for _, gap := range []uint32{1, 8, 32, 128} {
2493 expected := make([]uint32, count)
2494 {
2495 v := uint32(0)
2496 for i := range expected {
2497 expected[i] = v
2498 v += gap
2499 }
2500 }
2501 bm := BitmapOf(expected...)
2502 for _, bufSize := range []int{1, 64, 4096, count} {
2503 buf := make([]uint32, bufSize)
2504 it := bm.ManyIterator()
2505 cur := 0
2506 for n := it.NextMany(buf); n != 0; n = it.NextMany(buf) {
2507 // much faster tests... (10s -> 5ms)
2508 if cur+n > count {
2509 assert.LessOrEqual(t, count, cur+n)
2510 }
2511
2512 for i, v := range buf[:n] {
2513 // much faster tests...
2514 if v != expected[cur+i] {
2515 assert.Equal(t, expected[cur+i], v)
2516 }
2517 }
2518
2519 cur += n
2520 }
2521
2522 assert.Equal(t, count, cur)
2523 }
2524 }
2525}
2526
2527func TestBigRandom(t *testing.T) {
2528 rTest(t, 15)

Callers

nothing calls this directly

Calls 3

BitmapOfFunction · 0.70
NextManyMethod · 0.65
ManyIteratorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…