Skip to content

Commit

Permalink
Test module in place of function signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
krish8484 committed Aug 10, 2020
1 parent 101d03d commit ba320f9
Showing 1 changed file with 24 additions and 32 deletions.
56 changes: 24 additions & 32 deletions test/interval_tests/numeric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -393,48 +393,40 @@ end

@testset "function call for mathematical operators" begin

add = Tuple{typeof(+),IntervalArithmetic.Interval{T},S} where S<:AbstractFloat where T

@testset "+ operator" begin
@test which(+, (Interval{Float64}, Float32)).sig == add
@test which(+, (Interval{Float32}, Float64)).sig == add
@test which(+, (Interval{BigFloat}, Float64)).sig == add
@test which(+, (Interval{Float64}, BigFloat)).sig == add
@test which(+, (Interval{Float32}, BigFloat)).sig == add
@test which(+, (Interval{BigFloat}, Float32)).sig == add
@test which(+, (Interval{Float64}, Float32)).module == IntervalArithmetic
@test which(+, (Interval{Float32}, Float64)).module == IntervalArithmetic
@test which(+, (Interval{BigFloat}, Float64)).module == IntervalArithmetic
@test which(+, (Interval{Float64}, BigFloat)).module == IntervalArithmetic
@test which(+, (Interval{Float32}, Float64)).module == IntervalArithmetic
@test which(+, (Interval{BigFloat}, Float32)).module == IntervalArithmetic
end

sub = Tuple{typeof(-),IntervalArithmetic.Interval{T},S} where S<:AbstractFloat where T

@testset "- operator" begin
@test which(-, (Interval{Float64}, Float32)).sig == sub
@test which(-, (Interval{Float32}, Float64)).sig == sub
@test which(-, (Interval{BigFloat}, Float64)).sig == sub
@test which(-, (Interval{Float64}, BigFloat)).sig == sub
@test which(-, (Interval{Float32}, BigFloat)).sig == sub
@test which(-, (Interval{BigFloat}, Float32)).sig == sub
@test which(-, (Interval{Float64}, Float32)).module == IntervalArithmetic
@test which(-, (Interval{Float32}, Float64)).module == IntervalArithmetic
@test which(-, (Interval{BigFloat}, Float64)).module == IntervalArithmetic
@test which(-, (Interval{Float64}, BigFloat)).module == IntervalArithmetic
@test which(-, (Interval{Float32}, Float64)).module == IntervalArithmetic
@test which(-, (Interval{BigFloat}, Float32)).module == IntervalArithmetic
end

mul = Tuple{typeof(*),IntervalArithmetic.Interval{T},S} where S<:AbstractFloat where T

@testset "* operator" begin
@test which(*, (Interval{Float64}, Float32)).sig == mul
@test which(*, (Interval{Float32}, Float64)).sig == mul
@test which(*, (Interval{BigFloat}, Float64)).sig == mul
@test which(*, (Interval{Float64}, BigFloat)).sig == mul
@test which(*, (Interval{Float32}, BigFloat)).sig == mul
@test which(*, (Interval{BigFloat}, Float32)).sig == mul
@test which(*, (Interval{Float64}, Float32)).module == IntervalArithmetic
@test which(*, (Interval{Float32}, Float64)).module == IntervalArithmetic
@test which(*, (Interval{BigFloat}, Float64)).module == IntervalArithmetic
@test which(*, (Interval{Float64}, BigFloat)).module == IntervalArithmetic
@test which(*, (Interval{Float32}, Float64)).module == IntervalArithmetic
@test which(*, (Interval{BigFloat}, Float32)).module == IntervalArithmetic
end

div = Tuple{typeof(/),IntervalArithmetic.Interval{T},S} where S<:AbstractFloat where T

@testset "/ operator" begin
@test which(/, (Interval{Float64}, Float32)).sig == div
@test which(/, (Interval{Float32}, Float64)).sig == div
@test which(/, (Interval{BigFloat}, Float64)).sig == div
@test which(/, (Interval{Float64}, BigFloat)).sig == div
@test which(/, (Interval{Float32}, BigFloat)).sig == div
@test which(/, (Interval{BigFloat}, Float32)).sig == div
@test which(/, (Interval{Float64}, Float32)).module == IntervalArithmetic
@test which(/, (Interval{Float32}, Float64)).module == IntervalArithmetic
@test which(/, (Interval{BigFloat}, Float64)).module == IntervalArithmetic
@test which(/, (Interval{Float64}, BigFloat)).module == IntervalArithmetic
@test which(/, (Interval{Float32}, Float64)).module == IntervalArithmetic
@test which(/, (Interval{BigFloat}, Float32)).module == IntervalArithmetic
end
end

Expand Down

0 comments on commit ba320f9

Please sign in to comment.