Merge pull request #507 from travisturner/roaring-test-fix

Fix roaring test: TestBitmap_Quick_Array1
This commit is contained in:
Travis Turner 2017-04-30 21:27:01 -05:00 committed by GitHub
commit 84e39e3bd8

View file

@ -211,7 +211,10 @@ func testBitmapQuick(t *testing.T, n int, min, max uint64) {
}
// Verify slices are equal.
if got, exp := bm.Slice(), uint64SetSlice(m); !reflect.DeepEqual(got, exp) {
// If `got` is nil and `exp` has zero length, don't perform the DeepEqual
// because when `a` is empty (`a = []uint64{}`) then `got` is a nil slice
// while `exp` is an empty slice. Therefore they will not be considered equal.
if got, exp := bm.Slice(), uint64SetSlice(m); !(got == nil && len(exp) == 0) && !reflect.DeepEqual(got, exp) {
t.Fatalf("unexpected values:\n\ngot=%+v\n\nexp=%+v\n\n", got, exp)
}