Skip to content

Commit ea00b23

Browse files
committed
Imrpove test coverage + use zero()
1 parent b56f4be commit ea00b23

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/intervals/functions.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ end
378378
Calculate `x mod y` where `x` is an interval and `y` is a positive divisor.
379379
"""
380380
function mod(x::Interval, y::Real)
381-
@assert y > 0 "modulo is currently implemented only for a positive divisor."
381+
@assert y > zero(y) "modulo is currently implemented only for a positive divisor."
382382
division = x / y
383383
fl = floor(division)
384384
fl.lo < fl.hi ? Interval(zero(y), y) : y * (division - fl)

test/interval_tests/numeric.jl

+2
Original file line numberDiff line numberDiff line change
@@ -458,4 +458,6 @@ end
458458
@test mod(x, 2) == mod(x, 2.0) == 0..2
459459
@test mod(x, 2.5) == 0..2.5
460460
@test mod(x, 0.5) == 0..0.5
461+
462+
@test_throws AssertionError mod(x, -1)
461463
end

0 commit comments

Comments
 (0)