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

Function TestArrayContainerRank

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

Source from the content-addressed store, hash-verified

39}
40
41func TestArrayContainerRank(t *testing.T) {
42 v := container(newArrayContainer())
43 v = v.iaddReturnMinimized(10)
44 v = v.iaddReturnMinimized(100)
45 v = v.iaddReturnMinimized(1000)
46
47 assert.Equal(t, 3, v.getCardinality())
48
49 for i := 0; i <= arrayDefaultMaxSize; i++ {
50 thisrank := v.rank(uint16(i))
51
52 if i < 10 {
53 assert.Equalf(t, 0, thisrank, "At %d should be zero but is %d", i, thisrank)
54 } else if i < 100 {
55 assert.Equalf(t, 1, thisrank, "At %d should be one but is %d", i, thisrank)
56 } else if i < 1000 {
57 assert.Equalf(t, 2, thisrank, "At %d should be two but is %d", i, thisrank)
58 } else {
59 assert.Equalf(t, 3, thisrank, "At %d should be three but is %d", i, thisrank)
60 }
61 }
62}
63
64func TestArrayOffset(t *testing.T) {
65 nums := []uint16{10, 100, 1000}

Callers

nothing calls this directly

Calls 5

containerInterface · 0.85
newArrayContainerFunction · 0.85
iaddReturnMinimizedMethod · 0.65
getCardinalityMethod · 0.65
rankMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…