Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Dec 24, 2023
1 parent b821b78 commit 148260b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/stats/hexbin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function plot!(hb::Hexbin{<:Tuple{<:AbstractVector{<:Point2}}})
# and every cell has only 1 entry, then we set the minimum to 0 so we do not get
# a singular colorrange error down the line.
if mi == ma
(0, ma == 0 ? 1 : ma)
(0, ma == 0 ? one(ma) : ma)
else
(mi, ma)
end
Expand Down
10 changes: 10 additions & 0 deletions test/statistical_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,13 @@ end
@test p2.plots[2][:color][] === :white
@test p2.plots[2][:visible][] === :false
end

@tetset "hexbin" begin
# degenerate case with singleton 0
hexbin([0, 0], [1, 2])
hexbin([1, 2], [0, 0])

# degenerate case with singleton 1
hexbin([1, 1], [1, 2])
hexbin([1, 2], [1, 1])
end

0 comments on commit 148260b

Please sign in to comment.