diff --git a/test/Project.toml b/test/Project.toml index 25e3ead7..f87fa2aa 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -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" +Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/interval_tests/construction.jl b/test/interval_tests/construction.jl index df57db64..d40d5d5f 100644 --- a/test/interval_tests/construction.jl +++ b/test/interval_tests/construction.jl @@ -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 @@ -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))) diff --git a/test/interval_tests/supposition/numeric.jl b/test/interval_tests/supposition/numeric.jl new file mode 100644 index 00000000..fb1dab29 --- /dev/null +++ b/test/interval_tests/supposition/numeric.jl @@ -0,0 +1,29 @@ +using Test +using IntervalArithmetic + +# 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 diff --git a/test/runtests.jl b/test/runtests.jl index 62d506da..5363fd41 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -9,12 +9,25 @@ 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 +# We use Pkg.add to add a specific version of Supposition +using Pkg +Pkg.add(url = "https://github.com/Seelengrab/Supposition.jl.git", rev = "feat/support_x86") +using Supposition, Supposition.Data + +for f ∈ filter(isfile, readdir("interval_tests/supposition"; join = true)) + @testset "$f" begin + include(f) + end +end +Pkg.rm("Supposition") + # ITF1788 tests # these tests were generated using: # for f ∈ readdir("itl")