Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flip() of ImmutableRoaringBitmap skips last bit of bitmap #61

Closed
sirpkt opened this issue Jan 5, 2016 · 0 comments · Fixed by #62
Closed

flip() of ImmutableRoaringBitmap skips last bit of bitmap #61

sirpkt opened this issue Jan 5, 2016 · 0 comments · Fixed by #62

Comments

@sirpkt
Copy link
Contributor

sirpkt commented Jan 5, 2016

flip() of ImmutableRoaringBitmap does not work correctly.
I skips the last bit of bitmap.
For example, with following test codes, the second test fails as ImmutableRoaringBitmap.flip() results in {1, 2} not {1}.
Both RoaringBitmap.flip() and MutableRoaringBitmap.flip() work fine.

  @Test
  public void fliptest1() {
    final MutableRoaringBitmap rb = new MutableRoaringBitmap();
    rb.add(0);
    rb.add(2);
    final MutableRoaringBitmap rb2 = MutableRoaringBitmap.flip(rb, 0, 3);
    final MutableRoaringBitmap result = new MutableRoaringBitmap();
    result.add(1);

    Assert.assertEquals(result, rb2);
  }

  @Test
  public void fliptest2() {
    final MutableRoaringBitmap rb = new MutableRoaringBitmap();
    rb.add(0);
    rb.add(2);
    final MutableRoaringBitmap rb2 = ImmutableRoaringBitmap.flip(rb, 0, 3);
    final MutableRoaringBitmap result = new MutableRoaringBitmap();
    result.add(1);

    Assert.assertEquals(result, rb2);
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant