Skip to content

Commit

Permalink
Imrpove test coverage + use zero()
Browse files Browse the repository at this point in the history
  • Loading branch information
petvana committed May 25, 2022
1 parent b56f4be commit ea00b23
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/intervals/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ end
Calculate `x mod y` where `x` is an interval and `y` is a positive divisor.
"""
function mod(x::Interval, y::Real)
@assert y > 0 "modulo is currently implemented only for a positive divisor."
@assert y > zero(y) "modulo is currently implemented only for a positive divisor."
division = x / y
fl = floor(division)
fl.lo < fl.hi ? Interval(zero(y), y) : y * (division - fl)
Expand Down
2 changes: 2 additions & 0 deletions test/interval_tests/numeric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -458,4 +458,6 @@ end
@test mod(x, 2) == mod(x, 2.0) == 0..2
@test mod(x, 2.5) == 0..2.5
@test mod(x, 0.5) == 0..0.5

@test_throws AssertionError mod(x, -1)
end

0 comments on commit ea00b23

Please sign in to comment.