Skip to content

Commit

Permalink
Merge pull request #360 from jacksonrnewhouse/bugfix/run_container_ar…
Browse files Browse the repository at this point in the history
…ray_union

bugfix: return correct cardMinusOne in runArrayUnionToRuns
  • Loading branch information
lemire authored Jun 14, 2022
2 parents 16dd346 + 500fba4 commit aacb00c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion runcontainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2281,7 +2281,7 @@ func runArrayUnionToRuns(rc *runContainer16, ac *arrayContainer) ([]interval16,
pos2++
}
}
cardMinusOne += previousInterval.length + 1
cardMinusOne += previousInterval.length
target = append(target, previousInterval)

return target, cardMinusOne
Expand Down
8 changes: 8 additions & 0 deletions runcontainer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ func TestRunOffset(t *testing.T) {
}
}

func TestRunArrayUnionToRuns(t *testing.T) {
arrayArg := newArrayContainerRange(0, 10)
runArg := newRunContainer16Range(11, 65535)
intervals, cardMinusOne := runArrayUnionToRuns(runArg, arrayArg)
assert.Equal(t, uint16(65535), cardMinusOne)
assert.Equal(t, []interval16{{start: 0, length: 65535}}, intervals)
}

func TestRleRunIterator16(t *testing.T) {
t.Run("RunIterator16 unit tests for next, hasNext, and peekNext should pass", func(t *testing.T) {
{
Expand Down

0 comments on commit aacb00c

Please sign in to comment.