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

Function TestBitmapSelect

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

Source from the content-addressed store, hash-verified

1232}
1233
1234func TestBitmapSelect(t *testing.T) {
1235 for N := uint32(1); N <= 1048576; N *= 2 {
1236 t.Run("rank tests"+strconv.Itoa(int(N)), func(t *testing.T) {
1237 for gap := uint32(1); gap <= 65536; gap *= 2 {
1238 rb1 := NewBitmap()
1239 for x := uint32(0); x <= N; x += gap {
1240 rb1.Add(x)
1241 }
1242 for y := uint32(0); y <= N/gap; y++ {
1243 expectedInt := y * gap
1244 i, err := rb1.Select(y)
1245 if err != nil {
1246 t.Fatal(err)
1247 }
1248
1249 if i != expectedInt {
1250 assert.Equal(t, expectedInt, i)
1251 }
1252 }
1253 }
1254 })
1255 }
1256}
1257
1258// some extra tests
1259func 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…