// Ensure bitmap can return the number of intersecting bits in two bitmaps.
Ensure bitmap can return the number of intersecting bits in two bitmaps.
// Ensure bitmap can return the number of intersecting bits in two bitmaps .
func TestBitmap_IntersectionCount_BitmapRun(t *testing.T) {
	bm0 := roaring.NewFileBitmap()
	for i := uint64(3); i <= 1000006; i += 2 {
		bm0.Add(i)
	}
	bm1 := roaring.NewFileBitmap(0, 1, 2, 3, 4, 5, 1000000, 1000002, 1000003, 1000004, 1000005, 1000006)
	bm1.Optimize() 
	if n := bm0.IntersectionCount(bm1); n != 4 {
		t.Fatalf("unexpected n: %d", n)
	} else if n := bm1.IntersectionCount(bm0); n != 4 {
		t.Fatalf("unexpected n (reverse): %d", n)
	}
}
func TestBitmap_IntersectionCount_BitmapRun ( t * testing . T ) { bm0 := roaring . NewFileBitmap ( ) for i := uint64 ( 3 ) ; i <= 1000006 ; i += 2 { bm0 . Add ( i ) } bm1 := roaring . NewFileBitmap ( 0 , 1 , 2 , 3 , 4 , 5 , 1000000 , 1000002 , 1000003 , 1000004 , 1000005 , 1000006 ) bm1 . Optimize ( ) if n := bm0 . IntersectionCount ( bm1 ) ; n != 4 { t . Fatalf ( " " , n ) } else if n := bm1 . IntersectionCount ( bm0 ) ; n != 4 { t . Fatalf ( " " , n ) } }
Ensure bitmap can return the number of intersecting bits in two bitmaps.
Ensure bitmap can return the number of intersecting bits in two bitmaps .
// convert to runs