Skip to content

Commit 6f56f73

Browse files
committed
Add Supposition-based test for construction of degenerate intervals using Rationals
1 parent 84b5f38 commit 6f56f73

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Test
2+
using IntervalArithmetic
3+
using Supposition, Supposition.Data
4+
5+
@testset "Rational tests" begin
6+
# Define number generators
7+
#intgen = Data.Integers(typemin(Int)+1,typemax(Int)) # Don't allow den==typemin(Int) to avoid overflow
8+
intgen = Data.Integers(typemin(Int8)+Int8(1),typemax(Int8)) # Don't allow den==typemin(Int8) to avoid overflow
9+
rationalgen = @composed function generate_rational(num=intgen, den=intgen)
10+
assume!(!(iszero(num) && iszero(den)))
11+
return num // den
12+
end
13+
14+
# Check properties
15+
@check function degenerate_interval(r=rationalgen)
16+
x = interval(r)
17+
y = interval(r, r)
18+
assume!(!any(decoration.((x,y)) .== ill)) # Exclude ill-formed intervals
19+
isequal_interval(x, y)
20+
end
21+
end

0 commit comments

Comments
 (0)