Skip to content

Commit

Permalink
BitmapContainer: orArrayCardinality test
Browse files Browse the repository at this point in the history
  • Loading branch information
bstrausser committed Jun 17, 2024
1 parent 5aca967 commit 187a17a
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions bitmapcontainer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,3 +485,50 @@ func TestBitmapcontainerNextHasMany(t *testing.T) {
assert.Equal(t, 256, result)
})
}

func TestBitmapcontainerOrArrayCardinality(t *testing.T) {
t.Run("Empty Bitmap and Empty Array", func(t *testing.T) {
array := newArrayContainer()
bc := newBitmapContainer()
result := bc.orArrayCardinality(array)

assert.Equal(t, 0, result)
})

t.Run("Populated Bitmap with Empty Array", func(t *testing.T) {
bc := newBitmapContainer()
bc.iaddRange(0, 1024)
array := newArrayContainer()

result := bc.orArrayCardinality(array)

assert.Equal(t, 1024, result)
})

t.Run("Populated Bitmap with Empty Run Container", func(t *testing.T) {
bc := newBitmapContainer()
bc.iaddRange(0, 1024)

runC := newRunContainer16()

result := runC.orBitmapContainerCardinality(bc)

assert.Equal(t, 1024, result)

other := newBitmapContainerFromRun(runC)
result = bc.orBitmapCardinality(other)

assert.Equal(t, 1024, result)
})

t.Run("Populated Bitmap with Empty Bitmap", func(t *testing.T) {
bc := newBitmapContainer()
bc.iaddRange(0, 1024)

other := newBitmapContainer()

result := bc.orBitmapCardinality(other)

assert.Equal(t, 1024, result)
})
}

0 comments on commit 187a17a

Please sign in to comment.