Skip to content

Commit

Permalink
Improve testing
Browse files Browse the repository at this point in the history
  • Loading branch information
petvana committed May 24, 2022
1 parent fea1b34 commit 153d749
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/interval_tests/numeric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -435,21 +435,22 @@ end
@test nthroot(Interval{BigFloat}(-81, -16), 1) == Interval{BigFloat}(-81, -16)
end

# approximation used in this testing (not to rely on ≈ for intervals)
(x::Interval, y::Interval) = x.lo y.lo && x.hi y.hi
# approximation used for testing (not to rely on ≈ for intervals)
# ⪆(x, y) = (x ≈ y) && (y ⊆ x)
(x::Interval, y::Interval) = x.lo y.lo && x.hi y.hi && y x

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

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

x = -r .. 1-r
Expand Down

0 comments on commit 153d749

Please sign in to comment.