Skip to content

Commit

Permalink
Improve coverage (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy authored Oct 10, 2023
1 parent 3b8e44c commit 4abcb17
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ using IntervalArith

@testset "ThickNumbers generics" begin
# Test all the operations defined in ThickNumbers
x, y = Interval(1.0, 3.0), Interval(-1.0, 3.0)
@test valuetype(x) === valuetype(typeof(x)) === Float64
@test loval(x) === 1.0
@test hival(x) === 3.0
@test mid(x) === 2.0
@test wid(x) === 2.0
@test rad(x) === 1.0
@test typemin(x) Interval(-Inf, -Inf)
@test typemax(x) Interval(Inf, Inf)
@test mig(x) === 1.0
@test mig(y) === 0.0
@test mag(x) === 3.0
@test mag(y) === 3.0
@test mag(Interval(-5, 1)) === 5
@test lohi(Interval{Float64}, 1, 3) === x
@test midrad(Interval{Float64}, 2, 1) === x

@test isequal_tn(Interval(1, 2), Interval(1, 2))
@test_throws FPTNException isequal(Interval(1, 2), Interval(1, 2))
@test !isequal_tn(Interval(1, 2), Interval(1, 3))
Expand Down Expand Up @@ -83,16 +100,6 @@ using IntervalArith
@test !isnan_tn(Interval(1, 2))
@test !isnan_tn(Interval(1, Inf))

x, y = Interval(1.0, 3.0), Interval(-1.0, 3.0)
@test valuetype(x) === valuetype(typeof(x)) === Float64
@test typemin(x) Interval(-Inf, -Inf)
@test typemax(x) Interval(Inf, Inf)
@test mig(x) === 1.0
@test mig(y) === 0.0
@test mag(x) === 3.0
@test mag(y) === 3.0
@test mag(Interval(-5, 1)) === 5

@test x +x
@test -x Interval(-3.0, -1.0)
y = Interval(0x00, 0xff)
Expand Down

0 comments on commit 4abcb17

Please sign in to comment.