// Ensure that we can transition between runs and arrays when materializing the bitmap.
Ensure that we can transition between runs and arrays when materializing the bitmap.
// Ensure that we can transition between runs and arrays when materializing the bitmap .
func TestContainerTransitions(t *testing.T) {
	b := roaring.NewFileBitmap(0, 1, 2, 3, 4, 5, 1000, 1001, 1002, 1003, 1004, 1005, 100000, 100001, 100002, 132000, 132001, 132002, 132003, 132004, 132005)
	b.Optimize() 
	if !reflect.DeepEqual(b.Slice(), []uint64{0, 1, 2, 3, 4, 5, 1000, 1001, 1002, 1003, 1004, 1005, 100000, 100001, 100002, 132000, 132001, 132002, 132003, 132004, 132005}) {
		t.Fatalf("unexpected slice: %+v", b.Slice())
	}
	b2 := roaring.NewFileBitmap(65531, 65532, 65533, 65534, 65535, 65536, 131071, 131072, 131073, 131074, 131075, 131076)
	b2.Optimize() 
	if !reflect.DeepEqual(b2.Slice(), []uint64{65531, 65532, 65533, 65534, 65535, 65536, 131071, 131072, 131073, 131074, 131075, 131076}) {
		t.Fatalf("unexpected slice: %+v", b2.Slice())
	}
}
func TestContainerTransitions ( t * testing . T ) { b := roaring . NewFileBitmap ( 0 , 1 , 2 , 3 , 4 , 5 , 1000 , 1001 , 1002 , 1003 , 1004 , 1005 , 100000 , 100001 , 100002 , 132000 , 132001 , 132002 , 132003 , 132004 , 132005 ) b . Optimize ( ) if ! reflect . DeepEqual ( b . Slice ( ) , [ ] uint64 { 0 , 1 , 2 , 3 , 4 , 5 , 1000 , 1001 , 1002 , 1003 , 1004 , 1005 , 100000 , 100001 , 100002 , 132000 , 132001 , 132002 , 132003 , 132004 , 132005 } ) { t . Fatalf ( " " , b . Slice ( ) ) } b2 := roaring . NewFileBitmap ( 65531 , 65532 , 65533 , 65534 , 65535 , 65536 , 131071 , 131072 , 131073 , 131074 , 131075 , 131076 ) b2 . Optimize ( ) if ! reflect . DeepEqual ( b2 . Slice ( ) , [ ] uint64 { 65531 , 65532 , 65533 , 65534 , 65535 , 65536 , 131071 , 131072 , 131073 , 131074 , 131075 , 131076 } ) { t . Fatalf ( " " , b2 . Slice ( ) ) } }
Ensure that we can transition between runs and arrays when materializing the bitmap.
Ensure that we can transition between runs and arrays when materializing the bitmap .
// [run, run][array][run] // convert to runs // Test the case where last and first bits of adjoining containers are set. // [run][array][run] // convert to runs