Skip to content

Commit ee8a95b

Browse files
author
Luis Benet
committed
Add tests
1 parent 32030a3 commit ee8a95b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/interval_tests/numeric.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,30 @@ end
284284
end
285285
=#
286286
end
287+
288+
@testset "`mod`" begin
289+
r = 0.0625
290+
a = r..(1+r)
291+
@test mod(a, 1) == mod(a, 1.0) == interval(0,1)
292+
@test mod(a, 2) == mod(a, 2.0) == a
293+
@test mod(a, 2.5) == a
294+
@test mod(a, -1) == mod(a, -1.0) == interval(-1,0)
295+
@test mod(a, -2) == mod(a, -2.0) == -2+a
296+
@test mod(a, -2.5) == -2.5+a
297+
298+
a = (-1+r) .. -r
299+
@test mod(a, 1) == mod(a, 1.0) == 1+a
300+
@test mod(a, 2) == mod(a, 2.0) == 2+a
301+
@test mod(a, 2.5) == 2.5+a
302+
@test mod(a, -1) == mod(a, -1.0) == a
303+
@test mod(a, -2) == mod(a, -2.0) == a
304+
@test mod(a, -2.5) == a
305+
306+
a = -r .. 1-r
307+
@test mod(a, 1) == mod(a, 1.0) == interval(0,1)
308+
@test mod(a, 2) == mod(a, 2.0) == interval(0,2)
309+
@test mod(a, 2.5) == interval(0,2.5)
310+
@test mod(a, -1) == mod(a, -1.0) == interval(-1,0)
311+
@test mod(a, -2) == mod(a, -2.0) == interval(-2,0)
312+
@test mod(a, -2.5) == interval(-2.5,0)
313+
end

0 commit comments

Comments
 (0)