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

Function TestBitmapSelectCOW

roaringcow_test.go:256–279  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

254}
255
256func TestBitmapSelectCOW(t *testing.T) {
257 for N := uint32(1); N <= 1048576; N *= 2 {
258 t.Run("rank tests"+strconv.Itoa(int(N)), func(t *testing.T) {
259 for gap := uint32(1); gap <= 65536; gap *= 2 {
260 rb1 := NewBitmap()
261 rb1.SetCopyOnWrite(true)
262 for x := uint32(0); x <= N; x += gap {
263 rb1.Add(x)
264 }
265 for y := uint32(0); y <= N/gap; y++ {
266 expectedInt := y * gap
267 i, err := rb1.Select(y)
268 if err != nil {
269 t.Fatal(err)
270 }
271
272 if i != expectedInt {
273 assert.Equal(t, expectedInt, i)
274 }
275 }
276 }
277 })
278 }
279}
280
281// some extra tests
282func TestBitmapExtraCOW(t *testing.T) {

Callers

nothing calls this directly

Calls 4

SetCopyOnWriteMethod · 0.95
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…