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

Function TestNextManyOfAddRangeAcrossContainers

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

Source from the content-addressed store, hash-verified

2786}
2787
2788func TestNextManyOfAddRangeAcrossContainers(t *testing.T) {
2789 rb := NewBitmap()
2790 rb.AddRange(65530, 65540)
2791 expectedCard := 10
2792 expected := []uint32{65530, 65531, 65532, 65533, 65534, 65535, 65536, 65537, 65538, 65539, 0}
2793
2794 // test where all values can be returned in a single buffer
2795 it := rb.ManyIterator()
2796 buf := make([]uint32, 11)
2797 n := it.NextMany(buf)
2798
2799 assert.Equal(t, expectedCard, n)
2800
2801 for i, e := range expected {
2802 assert.Equal(t, e, buf[i])
2803 }
2804
2805 // test where buf is size 1, so many iterations
2806 it = rb.ManyIterator()
2807 n = 0
2808 buf = make([]uint32, 1)
2809
2810 for i := 0; i < expectedCard; i++ {
2811 n = it.NextMany(buf)
2812
2813 assert.Equal(t, 1, n)
2814 assert.Equal(t, expected[i], buf[0])
2815 }
2816
2817 n = it.NextMany(buf)
2818 assert.Equal(t, 0, n)
2819}
2820
2821func TestDoubleAdd(t *testing.T) {
2822 t.Run("doubleadd ", func(t *testing.T) {

Callers

nothing calls this directly

Calls 4

AddRangeMethod · 0.95
ManyIteratorMethod · 0.95
NewBitmapFunction · 0.70
NextManyMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…