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

Function TestRoaringArrayCOW

roaringcow_test.go:1589–1652  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1587}
1588
1589func TestRoaringArrayCOW(t *testing.T) {
1590 a := newRoaringArray()
1591
1592 t.Run("Test Init", func(t *testing.T) {
1593 assert.Equal(t, 0, a.size())
1594 })
1595
1596 t.Run("Test Insert", func(t *testing.T) {
1597 a.appendContainer(0, newArrayContainer(), false)
1598
1599 assert.Equal(t, 1, a.size())
1600 })
1601
1602 t.Run("Test Remove", func(t *testing.T) {
1603 a.remove(0)
1604 assert.Equal(t, 0, a.size())
1605 })
1606
1607 t.Run("Test popcount Full", func(t *testing.T) {
1608 res := popcount(uint64(0xffffffffffffffff))
1609 assert.EqualValues(t, 64, res)
1610 })
1611
1612 t.Run("Test popcount Empty", func(t *testing.T) {
1613 res := popcount(0)
1614 assert.EqualValues(t, 0, res)
1615 })
1616
1617 t.Run("Test popcount 16", func(t *testing.T) {
1618 res := popcount(0xff00ff)
1619 assert.EqualValues(t, 16, res)
1620 })
1621
1622 t.Run("Test ArrayContainer Add", func(t *testing.T) {
1623 ar := newArrayContainer()
1624 ar.iadd(1)
1625
1626 assert.EqualValues(t, 1, ar.getCardinality())
1627 })
1628
1629 t.Run("Test ArrayContainer Add wacky", func(t *testing.T) {
1630 ar := newArrayContainer()
1631 ar.iadd(0)
1632 ar.iadd(5000)
1633
1634 assert.EqualValues(t, 2, ar.getCardinality())
1635 })
1636
1637 t.Run("Test ArrayContainer Add Reverse", func(t *testing.T) {
1638 ar := newArrayContainer()
1639 ar.iadd(5000)
1640 ar.iadd(2048)
1641 ar.iadd(0)
1642
1643 assert.EqualValues(t, 3, ar.getCardinality())
1644 })
1645
1646 t.Run("Test BitmapContainer Add ", func(t *testing.T) {

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…