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

Function TestBitmapRank

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

Source from the content-addressed store, hash-verified

300}
301
302func TestBitmapRank(t *testing.T) {
303 for n := uint64(1); n <= 1048576; n *= 2 {
304 t.Run("rank tests"+strconv.Itoa(int(n)), func(t *testing.T) {
305 for gap := uint64(1); gap <= 65536; gap *= 2 {
306 rb1 := NewBitmap()
307 for x := uint64(0); x <= n; x += gap {
308 rb1.Add(x)
309 }
310 for y := uint64(0); y <= n; y++ {
311 if rb1.Rank(y) != (y+1+gap-1)/gap {
312 assert.Equal(t, (y+1+gap-1)/gap, rb1.Rank(y))
313 }
314 }
315 }
316 })
317 }
318}
319
320func TestBitmapSelect(t *testing.T) {
321 for n := uint64(1); n <= 1048576; n *= 2 {

Callers

nothing calls this directly

Calls 3

AddMethod · 0.95
RankMethod · 0.95
NewBitmapFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…