Skip to content

Commit

Permalink
bugfix: return correct cardMinusOne in runArrayUnionToRuns
Browse files Browse the repository at this point in the history
  • Loading branch information
jnewhouse committed Jun 13, 2022
1 parent 16dd346 commit 500fba4
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 500fba4

Please sign in to comment.