From 188a4aa8d9a91f9e302244a178e613b87e64ac6a Mon Sep 17 00:00:00 2001 From: Todd Gruben Date: Thu, 22 Jun 2017 10:58:47 -0500 Subject: [PATCH] extended bitmap contains test coverage --- roaring/roaring_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/roaring/roaring_test.go b/roaring/roaring_test.go index bc706cf84..bafe3daad 100644 --- a/roaring/roaring_test.go +++ b/roaring/roaring_test.go @@ -651,6 +651,7 @@ func testBM() *roaring.Bitmap { for i := uint64(0); i < 65535; i += 1 { bm.Add((4 << 16) + i) } + bm.Optimize() //count 75007 return bm } @@ -668,6 +669,19 @@ func TestBitmapOffsetRange(t *testing.T) { } } +func TestBitmapContains(t *testing.T) { + bm := testBM() + + //search for run value present + if found := bm.Contains(3 << 16); !found { + t.Fatalf("Test #1 Not Found %d ", 3<<16) + } + + //search for value not present + if found := bm.Contains((3 << 16) + 2048); found { + t.Fatalf("Test #2 Found %d ", (3<<16)+2048) + } +} func TestBitmapBufIterator(t *testing.T) {