Skip to content

Commit

Permalink
Provide offset information on AddOffset test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Oppen committed Nov 30, 2021
1 parent ed76873 commit 3f51720
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions roaring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,12 @@ func testAddOffset(t *testing.T, arr []uint32, offset int64) {

cop := AddOffset64(bmp, offset)

assert.EqualValues(t, len(expected), cop.GetCardinality())
assert.EqualValues(t, expected, cop.ToArray())
if !assert.EqualValues(t, len(expected), cop.GetCardinality()) {
t.Logf("Applying offset %d", offset)
}
if !assert.EqualValues(t, expected, cop.ToArray()) {
t.Logf("Applying offset %d", offset)
}

// Now check backing off gets us back all non-discarded numbers
expected2 := make([]uint32, 0, len(expected))
Expand All @@ -169,8 +173,12 @@ func testAddOffset(t *testing.T, arr []uint32, offset int64) {

cop2 := AddOffset64(cop, -offset)

assert.EqualValues(t, len(expected2), cop2.GetCardinality())
assert.EqualValues(t, expected2, cop2.ToArray())
if !assert.EqualValues(t, len(expected2), cop2.GetCardinality()) {
t.Logf("Restoring from offset %d", offset)
}
if !assert.EqualValues(t, expected2, cop2.ToArray()) {
t.Logf("Restoring from offset %d", offset)
}
}

func TestRoaringBitmapAddOffset(t *testing.T) {
Expand Down

0 comments on commit 3f51720

Please sign in to comment.