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

Function TestRunOffset

runcontainer_test.go:80–110  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestRunOffset(t *testing.T) {
81 v := newRunContainer16TakeOwnership([]interval16{newInterval16Range(34, 39)})
82 offtest := uint16(65500)
83 l, h := v.addOffset(offtest)
84
85 expected := []int{65534, 65535, 65536, 65537, 65538, 65539}
86 wout := make([]int, len(expected))
87
88 var w0card, w1card int
89
90 if l != nil {
91 w0card = l.getCardinality()
92
93 for i := 0; i < w0card; i++ {
94 wout[i] = l.selectInt(uint16(i))
95 }
96 }
97
98 if h != nil {
99 w1card = h.getCardinality()
100
101 for i := 0; i < w1card; i++ {
102 wout[i+w0card] = h.selectInt(uint16(i)) + 65536
103 }
104 }
105
106 assert.Equal(t, v.getCardinality(), w0card+w1card)
107 for i, x := range wout {
108 assert.Equal(t, expected[i], x)
109 }
110}
111
112func TestRunArrayUnionToRuns(t *testing.T) {
113 arrayArg := newArrayContainerRange(0, 10)

Callers

nothing calls this directly

Calls 5

newInterval16RangeFunction · 0.85
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…