def test_rank2(self): rb = ImmutableRoaringBitmap(range(0, 100000, 7)) rb = rb.union(range(100000, 200000, 1000)) for k in range(100000): assert rb.rank(k) == 1 + k // 7 for k in range(100000, 200000): assert rb.rank(k) == 1 + 100000 // 7 + 1 + (k - 100000) // 1000
def test_rank2(self): rb = ImmutableRoaringBitmap(range(0, 100000, 7)) rb = rb.union(range(100000, 200000, 1000)) for k in range(100000): assert rb.rank(k) == 1 + k // 7 for k in range(100000, 200000): assert rb.rank(k) == 1 + 100000 // 7 + 1 + (k - 100000) // 1000
def test_aggregateor(self, multi): ref = set(multi[0]) res1 = ref.union(*[set(a) for a in multi[1:]]) rb = ImmutableRoaringBitmap(multi[0]) res2 = rb.union(*[ImmutableRoaringBitmap(a) for a in multi[1:]]) res2._checkconsistency() assert res1 == res2
def test_aggregateor(self, multi): ref = set(multi[0]) res1 = ref.union(*[set(a) for a in multi[1:]]) rb = ImmutableRoaringBitmap(multi[0]) res2 = rb.union(*[ImmutableRoaringBitmap(a) for a in multi[1:]]) res2._checkconsistency() assert res1 == res2, name