(t *testing.T)
| 2786 | } |
| 2787 | |
| 2788 | func 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 | |
| 2821 | func TestDoubleAdd(t *testing.T) { |
| 2822 | t.Run("doubleadd ", func(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…