Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Supposition = "5a0628fe-1738-4658-9b6d-0b7605a9755b"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
6 changes: 6 additions & 0 deletions test/interval_tests/construction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
@test sup(IntervalArithmetic._unsafe_bareinterval(Float64, Inf, Inf)) == Inf
@test isempty_interval(bareinterval(Inf, Inf))
@test isnai(interval(Inf, Inf))
@test isnai(interval(1//0, 1//0))
@test isnai(interval(-1//0, -1//0))
@test isnai(interval(1//0, -1//0))
end

@testset "Basics" begin
Expand Down Expand Up @@ -70,6 +73,9 @@ end
@test isnai(interval(1, NaN))
@test isnai(interval(NaN))

@test isnai(interval(1//0))
@test isnai(interval(-1//0))

# check no issue with `Integer` modular arithmetic
@test bounds(interval(typemin(Int64), typemax(Int64))) == (float(typemin(Int64)), float(typemax(Int64)))

Expand Down
30 changes: 30 additions & 0 deletions test/interval_tests/supposition/numeric.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Test
using IntervalArithmetic
using Supposition, Supposition.Data

# Define properties to be checked
function degenerate_interval(a)
x = interval(a)
y = interval(a, a)
x === y
end

@testset "Float tests" begin
# Define number generators
floatgen = Data.Floats()

# Check properties
@check max_examples=1000 degenerate_interval(floatgen)
end

@testset "Rational tests" begin
# Define number generators
intgen = Data.Integers(typemin(Int)+1,typemax(Int)) # Don't allow typemin(Int) to avoid overflow
rationalgen = @composed function generate_rational(num=intgen, den=intgen)
assume!(!(iszero(num) && iszero(den)))
return num // den
end

# Check properties
@check max_examples = 1000 degenerate_interval(rationalgen)
end
9 changes: 8 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ import IntervalSets as IS
include("generate_ITF1788.jl")

# interval tests
for f ∈ readdir("interval_tests"; join = true)
for f ∈ filter(isfile, readdir("interval_tests"; join = true))
@testset "$f" begin
include(f)
end
end

# interval tests using Supposition
for f ∈ filter(isfile, readdir("interval_tests/supposition"; join = true))
@testset "$f" begin
include(f)
end
Expand Down