MCPcopy Create free account
hub / github.com/RoaringBitmap/roaring / TestBitmapSelect

Function TestBitmapSelect

roaring64/roaring64_test.go:320–342  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

318}
319
320func TestBitmapSelect(t *testing.T) {
321 for n := uint64(1); n <= 1048576; n *= 2 {
322 t.Run("rank tests"+strconv.Itoa(int(n)), func(t *testing.T) {
323 for gap := uint64(1); gap <= 65536; gap *= 2 {
324 rb1 := NewBitmap()
325 for x := uint64(0); x <= n; x += gap {
326 rb1.Add(x)
327 }
328 for y := uint64(0); y <= n/gap; y++ {
329 expectedInt := y * gap
330 i, err := rb1.Select(y)
331 if err != nil {
332 t.Fatal(err)
333 }
334
335 if i != expectedInt {
336 assert.Equal(t, expectedInt, i)
337 }
338 }
339 }
340 })
341 }
342}
343
344// some extra tests
345func TestBitmapExtra(t *testing.T) {

Callers

nothing calls this directly

Calls 3

AddMethod · 0.95
SelectMethod · 0.95
NewBitmapFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…