Skip to content

Commit

Permalink
Remove mod tests for non existant function
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolaru committed Sep 10, 2023
1 parent 939e8b0 commit ddbafd2
Showing 1 changed file with 1 addition and 42 deletions.
43 changes: 1 addition & 42 deletions test/interval_tests/numeric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -397,45 +397,4 @@ end
@test nthroot(interval(BigFloat, -27, 27), -3) interval(BigFloat, -Inf, Inf)
@test nthroot(interval(BigFloat, -81, -16), -4)
@test nthroot(interval(BigFloat, -81, -16), 1) interval(BigFloat, -81, -16)
end

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

@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, 0.5) == 0..0.5
@test mod(x, -1) == mod(x, -1.0) == -1..0
@test mod(x, -2) == mod(x, -2.0) -2+x
@test mod(x, -2.5) -2.5+x
@test mod(x, -0.5) == -0.5..0

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, 0.5) == 0..0.5
@test mod(x, -1) == mod(x, -1.0) x
@test mod(x, -2) == mod(x, -2.0) x
@test mod(x, -2.5) x
@test mod(x, -0.5) == -0.5..0

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

# TODO - implement mod for two intervals
@test_throws ArgumentError mod(1..2, 1.4..1.5)
@test_throws ArgumentError mod(1.0, 1.4..1.5)
end
end

0 comments on commit ddbafd2

Please sign in to comment.