-
Notifications
You must be signed in to change notification settings - Fork 248
Expand file tree
/
Copy pathroaringarray_test.go
More file actions
29 lines (24 loc) · 987 Bytes
/
roaringarray_test.go
File metadata and controls
29 lines (24 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package roaring
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestRoaringArrayAdvanceUntil(t *testing.T) {
bitmap := New()
low := 1 << 16
mid := 2 << 16
high := 3 << 16
bitmap.AddRange(uint64(low)-1, uint64(low)+2)
bitmap.AddRange(uint64(mid)-1, uint64(mid)+2)
bitmap.AddRange(uint64(high)-1, uint64(high)+2)
assert.Equal(t, 0, bitmap.highlowcontainer.advanceUntil(0, -1))
assert.Equal(t, 1, bitmap.highlowcontainer.advanceUntil(1, -1))
assert.Equal(t, 2, bitmap.highlowcontainer.advanceUntil(2, -1))
assert.Equal(t, 3, bitmap.highlowcontainer.advanceUntil(3, -1))
assert.Equal(t, 4, bitmap.highlowcontainer.advanceUntil(4, -1))
assert.Equal(t, 1, bitmap.highlowcontainer.advanceUntil(0, 0))
assert.Equal(t, 2, bitmap.highlowcontainer.advanceUntil(1, 1))
assert.Equal(t, 3, bitmap.highlowcontainer.advanceUntil(2, 2))
assert.Equal(t, 4, bitmap.highlowcontainer.advanceUntil(3, 3))
assert.Equal(t, 5, bitmap.highlowcontainer.advanceUntil(4, 4))
}