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

Function TestFastAggregationsCont

fastaggregation_test.go:35–75  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func TestFastAggregationsCont(t *testing.T) {
36 rb1 := NewBitmap()
37 rb2 := NewBitmap()
38 rb3 := NewBitmap()
39 for i := uint32(0); i < 10; i += 3 {
40 rb1.Add(i)
41 }
42 for i := uint32(0); i < 10; i += 7 {
43 rb2.Add(i)
44 }
45 for i := uint32(0); i < 10; i += 1001 {
46 rb3.Add(i)
47 }
48 for i := uint32(1000000); i < 1000000+10; i += 1001 {
49 rb1.Add(i)
50 }
51 for i := uint32(1000000); i < 1000000+10; i += 7 {
52 rb2.Add(i)
53 }
54 for i := uint32(1000000); i < 1000000+10; i += 3 {
55 rb3.Add(i)
56 }
57 rb1.Add(500000)
58 pq := make(containerPriorityQueue, 3)
59 pq[0] = &containeritem{rb1, 0, 0}
60 pq[1] = &containeritem{rb2, 0, 1}
61 pq[2] = &containeritem{rb3, 0, 2}
62 heap.Init(&pq)
63 expected := []int{6, 4, 5, 6, 5, 4, 6}
64 counter := 0
65 for pq.Len() > 0 {
66 x1 := heap.Pop(&pq).(*containeritem)
67 assert.EqualValues(t, expected[counter], x1.value.GetCardinality())
68
69 counter++
70 x1.keyindex++
71 if x1.keyindex < x1.value.highlowcontainer.size() {
72 heap.Push(&pq, x1)
73 }
74 }
75}
76
77func TestFastAggregationsAdvanced_run(t *testing.T) {
78 rb1 := NewBitmap()

Callers

nothing calls this directly

Calls 7

AddMethod · 0.95
NewBitmapFunction · 0.70
LenMethod · 0.45
PopMethod · 0.45
GetCardinalityMethod · 0.45
sizeMethod · 0.45
PushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…