mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Fix roaring test: TestBitmap_Quick_Array1
When the random number generator was coming up 0,
then `a = []uint64{}`. This caused the bitmap `bm` to be empty.
In this case, `bm.Slice()` is a nil slice, while the expected
slice is an empty slice (i.e. they are not considered equal):
got: ([]uint64) <nil>
exp: ([]uint64) {}
This commit is contained in:
parent
a1871388b0
commit
ea4bf0a1d3
1 changed files with 4 additions and 1 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue