diff --git a/roaring/roaring.go b/roaring/roaring.go index 21e87ed0f..9b734effe 100644 --- a/roaring/roaring.go +++ b/roaring/roaring.go @@ -673,6 +673,7 @@ func (b *Bitmap) Check() error { return a } +//Perform a logical negate of the bits in the range [start,end]. func (b *Bitmap) Flip(start, end uint64) *Bitmap { result := NewBitmap() itr := b.Iterator() diff --git a/roaring/roaring_test.go b/roaring/roaring_test.go index 619e194e2..3cf3548de 100644 --- a/roaring/roaring_test.go +++ b/roaring/roaring_test.go @@ -168,8 +168,8 @@ func TestBitmap_Xor_BitmapBitmap(t *testing.T) { } } -// Ensure bitmap turn on and turn off -func TestBitmap_Fipp_Empty(t *testing.T) { +// Ensure bitmap contents alternate. +func TestBitmap_Flip_Empty(t *testing.T) { bm := roaring.NewBitmap() results := bm.Flip(0, 10) if n := results.Count(); n != 10 { @@ -182,7 +182,7 @@ func TestBitmap_Fipp_Empty(t *testing.T) { } // Test Subrange Flip should not affect bits outside of Range -func TestBitmap_Fipp_Array(t *testing.T) { +func TestBitmap_Flip_Array(t *testing.T) { bm := roaring.NewBitmap(0, 1, 2, 3, 4, 8, 16, 32, 64, 128, 256, 512, 1024) results := bm.Flip(0, 5) if n := results.Count(); n != 8 { @@ -195,7 +195,7 @@ func TestBitmap_Fipp_Array(t *testing.T) { } -func TestBitmap_Fipp_Bitmap(t *testing.T) { +func TestBitmap_Flip_Bitmap(t *testing.T) { bm := roaring.NewBitmap() size := uint64(10000) for i := uint64(0); i < size; i += 2 {