Skip to content

Commit 7db47d6

Browse files
committed
more testing and simplification.
1 parent fb89c43 commit 7db47d6

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

iter_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,20 @@ func TestUnset(t *testing.T) {
275275
assert.Contains(t, actual, uint32(101))
276276
assert.Contains(t, actual, uint32(150))
277277
})
278+
279+
t.Run("min is in the bitmap", func(t *testing.T) {
280+
b := New()
281+
b.AddInt(100)
282+
283+
it := Unset(b, 100, 105)
284+
285+
actual := make([]uint32, 0)
286+
it(func(val uint32) bool {
287+
actual = append(actual, val)
288+
return true
289+
})
290+
expected := []uint32{101, 102, 103, 104, 105}
291+
292+
assert.Equal(t, expected, actual)
293+
})
278294
}

roaring.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,6 @@ func (ui *unsetIterator) Initialize(b *Bitmap, min, max uint32) {
755755
ui.max = max
756756
ui.current = min
757757
ui.it = b.Iterator()
758-
ui.hasNext = min <= max
759-
760758
// Advance to first value >= min
761759
ui.it.AdvanceIfNeeded(min)
762760
ui.updateHasNext()

0 commit comments

Comments
 (0)