Skip to content

Commit f753b3c

Browse files
Luis Benetdpsanders
authored andcommitted
Add tests
1 parent 7f233b2 commit f753b3c

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

0 commit comments

Comments
 (0)