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

Function TestIssue181

bitmapcontainer_test.go:61–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

59}
60
61func TestIssue181(t *testing.T) {
62 t.Run("Initial issue 181", func(t *testing.T) {
63 a := New()
64 var x uint32
65
66 // adding 1M integers
67 for i := 1; i <= 1000000; i++ {
68 x += uint32(rand.Intn(10) + 1)
69 a.Add(x)
70 }
71 b := New()
72 for i := 1; i <= int(x); i++ {
73 b.Add(uint32(i))
74 }
75
76 assert.Equal(t, b.AndCardinality(a), a.AndCardinality(b))
77 assert.Equal(t, b.AndCardinality(a), And(a, b).GetCardinality())
78 })
79
80 t.Run("Second version of issue 181", func(t *testing.T) {
81 a := New()
82 var x uint32
83
84 // adding 1M integers
85 for i := 1; i <= 1000000; i++ {
86 x += uint32(rand.Intn(10) + 1)
87 a.Add(x)
88 }
89 b := New()
90 b.AddRange(1, uint64(x))
91
92 assert.Equal(t, b.AndCardinality(a), a.AndCardinality(b))
93 assert.Equal(t, b.AndCardinality(a), And(a, b).GetCardinality())
94 })
95}
96
97// RunReverseIterator16 unit tests for cur, next, hasNext, and remove should pass
98func TestBitmapContainerReverseIterator(t *testing.T) {

Callers

nothing calls this directly

Calls 6

NewFunction · 0.70
AndFunction · 0.70
AddMethod · 0.45
AndCardinalityMethod · 0.45
GetCardinalityMethod · 0.45
AddRangeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…