Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Benet committed May 3, 2018
1 parent c69803f commit 583f97d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/interval_tests/numeric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,30 @@ end
end
=#
end

@testset "`mod`" begin
r = 0.0625
a = r..(1+r)
@test mod(a, 1) == mod(a, 1.0) == interval(0,1)
@test mod(a, 2) == mod(a, 2.0) == a
@test mod(a, 2.5) == a
@test mod(a, -1) == mod(a, -1.0) == interval(-1,0)
@test mod(a, -2) == mod(a, -2.0) == -2+a
@test mod(a, -2.5) == -2.5+a

a = (-1+r) .. -r
@test mod(a, 1) == mod(a, 1.0) == 1+a
@test mod(a, 2) == mod(a, 2.0) == 2+a
@test mod(a, 2.5) == 2.5+a
@test mod(a, -1) == mod(a, -1.0) == a
@test mod(a, -2) == mod(a, -2.0) == a
@test mod(a, -2.5) == a

a = -r .. 1-r
@test mod(a, 1) == mod(a, 1.0) == interval(0,1)
@test mod(a, 2) == mod(a, 2.0) == interval(0,2)
@test mod(a, 2.5) == interval(0,2.5)
@test mod(a, -1) == mod(a, -1.0) == interval(-1,0)
@test mod(a, -2) == mod(a, -2.0) == interval(-2,0)
@test mod(a, -2.5) == interval(-2.5,0)
end

0 comments on commit 583f97d

Please sign in to comment.