Skip to content

Commit

Permalink
Increase coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Antoni Reus <antoni.reus@exasol.com>
  • Loading branch information
YotillaAntoni committed Nov 22, 2024
1 parent 80638fa commit 90730c8
Showing 1 changed file with 35 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,48 @@ import org.scalatest.funsuite.AnyFunSuite

class RoaringBitmapArraySuite extends AnyFunSuite {

test("RoaringBitmapArray create and contains methods") {
val bitmap = RoaringBitmapArray.create(1L, 100L, 10000000000L)

test("RoaringBitmapArray create empty map") {
val bitmap = RoaringBitmapArray.create()
assert(bitmap.toArray.isEmpty)
}

test("RoaringBitmapArray create map with values only in first bitmap") {
// Values <= max unsigned integer (4,294,967,295) will be in the first bitmap
val bitmap = RoaringBitmapArray.create(1L, 100L)

assert(bitmap.contains(1L))
assert(bitmap.contains(100L))
assert(bitmap.contains(10000000000L))

assert(!bitmap.contains(2L))
assert(!bitmap.contains(99L))
assert(!bitmap.contains(10000000001L))

assert(bitmap.toArray.sorted sameElements Array(1L, 100L, 10000000000L))
assert(bitmap.toArray sameElements Array(1L, 100L))
}

test("RoaringBitmapArray create map with values only in second bitmap") {
// Values > max unsigned integer (4,294,967,295) will be in the second bitmap
val bitmap = RoaringBitmapArray.create(5000000000L, 5000000100L)

assert(bitmap.contains(5000000000L))
assert(bitmap.contains(5000000100L))

assert(!bitmap.contains(5000000001L))
assert(!bitmap.contains(5000000099L))

assert(bitmap.toArray sameElements Array(5000000000L, 5000000100L))
}

test("RoaringBitmapArray create map with values in first and second bitmap") {
val bitmap = RoaringBitmapArray.create(100L, 5000000000L)

assert(bitmap.contains(100L))
assert(bitmap.contains(5000000000L))

assert(!bitmap.contains(101L))
assert(!bitmap.contains(5000000001L))

assert(bitmap.toArray sameElements Array(100L, 5000000000L))
}

// TODO need to implement serialize to copy over tests
Expand Down

0 comments on commit 90730c8

Please sign in to comment.