Skip to content

Commit b6f6825

Browse files
author
Luis Benet
committed
Add tests
1 parent dc553f9 commit b6f6825

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
@@ -280,3 +280,30 @@ end
280280
end
281281
=#
282282
end
283+
284+
@testset "`mod`" begin
285+
r = 0.0625
286+
a = r..(1+r)
287+
@test mod(a, 1) == mod(a, 1.0) == interval(0,1)
288+
@test mod(a, 2) == mod(a, 2.0) == a
289+
@test mod(a, 2.5) == a
290+
@test mod(a, -1) == mod(a, -1.0) == interval(-1,0)
291+
@test mod(a, -2) == mod(a, -2.0) == -2+a
292+
@test mod(a, -2.5) == -2.5+a
293+
294+
a = (-1+r) .. -r
295+
@test mod(a, 1) == mod(a, 1.0) == 1+a
296+
@test mod(a, 2) == mod(a, 2.0) == 2+a
297+
@test mod(a, 2.5) == 2.5+a
298+
@test mod(a, -1) == mod(a, -1.0) == a
299+
@test mod(a, -2) == mod(a, -2.0) == a
300+
@test mod(a, -2.5) == a
301+
302+
a = -r .. 1-r
303+
@test mod(a, 1) == mod(a, 1.0) == interval(0,1)
304+
@test mod(a, 2) == mod(a, 2.0) == interval(0,2)
305+
@test mod(a, 2.5) == interval(0,2.5)
306+
@test mod(a, -1) == mod(a, -1.0) == interval(-1,0)
307+
@test mod(a, -2) == mod(a, -2.0) == interval(-2,0)
308+
@test mod(a, -2.5) == interval(-2.5,0)
309+
end

0 commit comments

Comments
 (0)