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

Function TestRoaringArray

roaring_test.go:2668–2730  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2666}
2667
2668func TestRoaringArray(t *testing.T) {
2669 a := newRoaringArray()
2670
2671 t.Run("Test Init", func(t *testing.T) {
2672 assert.Equal(t, 0, a.size())
2673 })
2674
2675 t.Run("Test Insert", func(t *testing.T) {
2676 a.appendContainer(0, newArrayContainer(), false)
2677 assert.Equal(t, 1, a.size())
2678 })
2679
2680 t.Run("Test Remove", func(t *testing.T) {
2681 a.remove(0)
2682 assert.Equal(t, 0, a.size())
2683 })
2684
2685 t.Run("Test popcount Full", func(t *testing.T) {
2686 res := popcount(uint64(0xffffffffffffffff))
2687 assert.EqualValues(t, 64, res)
2688 })
2689
2690 t.Run("Test popcount Empty", func(t *testing.T) {
2691 res := popcount(0)
2692 assert.EqualValues(t, 0, res)
2693 })
2694
2695 t.Run("Test popcount 16", func(t *testing.T) {
2696 res := popcount(0xff00ff)
2697 assert.EqualValues(t, 16, res)
2698 })
2699
2700 t.Run("Test ArrayContainer Add", func(t *testing.T) {
2701 ar := newArrayContainer()
2702 ar.iadd(1)
2703
2704 assert.EqualValues(t, 1, ar.getCardinality())
2705 })
2706
2707 t.Run("Test ArrayContainer Add wacky", func(t *testing.T) {
2708 ar := newArrayContainer()
2709 ar.iadd(0)
2710 ar.iadd(5000)
2711
2712 assert.EqualValues(t, 2, ar.getCardinality())
2713 })
2714
2715 t.Run("Test ArrayContainer Add Reverse", func(t *testing.T) {
2716 ar := newArrayContainer()
2717 ar.iadd(5000)
2718 ar.iadd(2048)
2719 ar.iadd(0)
2720
2721 assert.EqualValues(t, 3, ar.getCardinality())
2722 })
2723
2724 t.Run("Test BitmapContainer Add ", func(t *testing.T) {
2725 bm := newBitmapContainer()

Callers

nothing calls this directly

Calls 9

newRoaringArrayFunction · 0.85
newArrayContainerFunction · 0.85
newBitmapContainerFunction · 0.85
popcountFunction · 0.70
iaddMethod · 0.65
getCardinalityMethod · 0.65
sizeMethod · 0.45
appendContainerMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…