Skip to content

Commit

Permalink
Fix mergesorted bug (#553)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrumbiegel authored Sep 6, 2024
1 parent 4834dea commit e932bef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Added ability to return `ProcessedLayers` from transformations, thereby enabling multi-layer transformations, such as scatter plus errorbars [#549](https://github.com/MakieOrg/AlgebraOfGraphics.jl/pull/549).
- Fixed bug where `mergesorted` applied on string vectors used `isless` instead of natural sort [#553](https://github.com/MakieOrg/AlgebraOfGraphics.jl/pull/553).

## v0.8.6 - 2024-09-02

Expand Down
2 changes: 1 addition & 1 deletion src/scales.jl
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ function mergesorted(v1, v2)
v = sizehint!(T[], length(v1) + length(v2))
i1, i2 = 1, 1
while i2 length(v2)
while i1 length(v1) && isless(v1[i1], v2[i2])
while i1 length(v1) && natural_lt(v1[i1], v2[i2])
push_different!(v, v1[i1])
i1 += 1
end
Expand Down
4 changes: 4 additions & 0 deletions test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
@test AlgebraOfGraphics.extend_extrema(e1, e2) == (-5, 11)

@test AlgebraOfGraphics.midpoints(1:10) == 1.5:9.5

# issue 552
v = ["1", "9", "10"]
@test AlgebraOfGraphics.mergesorted(v, v) == v
end

@testset "arguments" begin
Expand Down

0 comments on commit e932bef

Please sign in to comment.