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

Function TestArrayOffset

arraycontainer_test.go:64–98  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestArrayOffset(t *testing.T) {
65 nums := []uint16{10, 100, 1000}
66 expected := make([]int, len(nums))
67 offtest := uint16(65000)
68 v := container(newArrayContainer())
69 for i, n := range nums {
70 v = v.iaddReturnMinimized(n)
71 expected[i] = int(n) + int(offtest)
72 }
73 l, h := v.addOffset(offtest)
74
75 var w0card, w1card int
76 wout := make([]int, len(nums))
77
78 if l != nil {
79 w0card = l.getCardinality()
80
81 for i := 0; i < w0card; i++ {
82 wout[i] = l.selectInt(uint16(i))
83 }
84 }
85
86 if h != nil {
87 w1card = h.getCardinality()
88
89 for i := 0; i < w1card; i++ {
90 wout[i+w0card] = h.selectInt(uint16(i)) + 65536
91 }
92 }
93
94 assert.Equal(t, 3, w0card+w1card)
95 for i, x := range wout {
96 assert.Equal(t, expected[i], x)
97 }
98}
99
100func TestArrayContainerMassiveSetAndGet(t *testing.T) {
101 v := container(newArrayContainer())

Callers

nothing calls this directly

Calls 6

containerInterface · 0.85
newArrayContainerFunction · 0.85
iaddReturnMinimizedMethod · 0.65
addOffsetMethod · 0.65
getCardinalityMethod · 0.65
selectIntMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…