From 47f0734228ff4c9f379b907e71b914da1bc41da7 Mon Sep 17 00:00:00 2001 From: bvrb Date: Mon, 6 Oct 2025 19:31:08 +0200 Subject: [PATCH 1/7] Add Supposition.jl to test dependencies --- test/Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Project.toml b/test/Project.toml index 25e3ead7..165b883d 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" +Supposition = "5a0628fe-1738-4658-9b6d-0b7605a9755b" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" From c68c6380de09fdb708e54cdde6828fe60d01f82a Mon Sep 17 00:00:00 2001 From: bvrb Date: Mon, 6 Oct 2025 19:34:09 +0200 Subject: [PATCH 2/7] Add Supposition-based test for construction of degenerate intervals using Rationals --- test/interval_tests/supposition/numeric.jl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/interval_tests/supposition/numeric.jl diff --git a/test/interval_tests/supposition/numeric.jl b/test/interval_tests/supposition/numeric.jl new file mode 100644 index 00000000..7193b35e --- /dev/null +++ b/test/interval_tests/supposition/numeric.jl @@ -0,0 +1,21 @@ +using Test +using IntervalArithmetic +using Supposition, Supposition.Data + +@testset "Rational tests" begin + # Define number generators + #intgen = Data.Integers(typemin(Int)+1,typemax(Int)) # Don't allow den==typemin(Int) to avoid overflow + intgen = Data.Integers(typemin(Int8)+Int8(1),typemax(Int8)) # Don't allow den==typemin(Int8) to avoid overflow + rationalgen = @composed function generate_rational(num=intgen, den=intgen) + assume!(!(iszero(num) && iszero(den))) + return num // den + end + + # Check properties + @check function degenerate_interval(r=rationalgen) + x = interval(r) + y = interval(r, r) + assume!(!any(decoration.((x,y)) .== ill)) # Exclude ill-formed intervals + isequal_interval(x, y) + end +end From ce375dd85cfff6b63d92df36a9cd8afacf2d0e5c Mon Sep 17 00:00:00 2001 From: bvrb Date: Mon, 6 Oct 2025 19:35:13 +0200 Subject: [PATCH 3/7] Add test to runtests.jl --- test/runtests.jl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 62d506da..d5a0fd1d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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 From cecb913653f6d8c655c4992a7a078663ca984e0b Mon Sep 17 00:00:00 2001 From: bvrb Date: Fri, 17 Oct 2025 15:19:34 +0200 Subject: [PATCH 4/7] Update Supposition test for degenerate interval construction - decrease number of random samples - add test for floats - switch from Int8 to Int - change equality check --- test/interval_tests/supposition/numeric.jl | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/test/interval_tests/supposition/numeric.jl b/test/interval_tests/supposition/numeric.jl index 7193b35e..42a60165 100644 --- a/test/interval_tests/supposition/numeric.jl +++ b/test/interval_tests/supposition/numeric.jl @@ -2,20 +2,29 @@ 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 den==typemin(Int) to avoid overflow - intgen = Data.Integers(typemin(Int8)+Int8(1),typemax(Int8)) # Don't allow den==typemin(Int8) to avoid overflow + 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 function degenerate_interval(r=rationalgen) - x = interval(r) - y = interval(r, r) - assume!(!any(decoration.((x,y)) .== ill)) # Exclude ill-formed intervals - isequal_interval(x, y) - end + @check max_examples = 1000 degenerate_interval(rationalgen) end From 72b211e496648ef3f205ad436b9ddcd15ede19cb Mon Sep 17 00:00:00 2001 From: bvrb Date: Fri, 17 Oct 2025 15:20:32 +0200 Subject: [PATCH 5/7] Add Rational tests for 1//0 and -1//0 edge cases --- test/interval_tests/construction.jl | 6 ++++++ 1 file changed, 6 insertions(+) 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))) From ac94ed5cad0e886a71974dee308ccd8167088ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Richard?= Date: Sat, 1 Nov 2025 22:41:29 +0100 Subject: [PATCH 6/7] Limit supposition test to 64 bit --- test/runtests.jl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index d5a0fd1d..c6f0ee35 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -16,9 +16,13 @@ for f ∈ filter(isfile, readdir("interval_tests"; join = true)) end # interval tests using Supposition -for f ∈ filter(isfile, readdir("interval_tests/supposition"; join = true)) - @testset "$f" begin - include(f) +if Int == Int32 + @warn "Suppositions.jl currently does not support 32 bit execution" +else + for f ∈ filter(isfile, readdir("interval_tests/supposition"; join = true)) + @testset "$f" begin + include(f) + end end end From fad6be74157658bd110094e61d068d55f1f8a637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Richard?= Date: Sat, 1 Nov 2025 22:46:26 +0100 Subject: [PATCH 7/7] Realize that supposition is failing at precompile time and change CI instead --- .github/workflows/CI.yml | 2 +- test/runtests.jl | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7c7f06cf..937b318f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -21,7 +21,7 @@ jobs: - windows-latest arch: - x64 - - x86 + # - x86 exclude: - os: macOS-latest arch: x86 diff --git a/test/runtests.jl b/test/runtests.jl index c6f0ee35..d5a0fd1d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -16,13 +16,9 @@ for f ∈ filter(isfile, readdir("interval_tests"; join = true)) end # interval tests using Supposition -if Int == Int32 - @warn "Suppositions.jl currently does not support 32 bit execution" -else - for f ∈ filter(isfile, readdir("interval_tests/supposition"; join = true)) - @testset "$f" begin - include(f) - end +for f ∈ filter(isfile, readdir("interval_tests/supposition"; join = true)) + @testset "$f" begin + include(f) end end