Skip to content

Commit 8139fca

Browse files
committed
revise tolerance tests and comments
1 parent f51f592 commit 8139fca

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

test/Sets/Interval.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ for N in @tN([Float64, Float32, Rational{Int}])
529529
# TODO ∈ and isdisjoint should be consistent
530530
@test_broken !res && w isa Vector{N} && w X && w Y
531531
r = LazySets._rtol(N)
532+
@assert r > N(1e-10) "default tolerance changed; adapt test"
532533
LazySets.set_rtol(N, N(1e-10))
533534
@test isdisjoint(X, Y)
534535
res, w = isdisjoint(X, Y, true)

test/Sets/LineSegment.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ for N in @tN([Float64, Float32, Rational{Int}])
4040

4141
# approximate membership test
4242
if N == Float64
43-
@test N[1.5, 1.5] LineSegment(N[1.5, 1.50000000000001], N[1.5, 2.0])
43+
@test N[1.5, 1.5] LineSegment(N[1.5, 1.500000001], N[1.5, 2.0])
4444
r = LazySets._rtol(N)
45-
LazySets.set_rtol(N, N(1e-20))
46-
@test !(N[1.5, 1.5] LineSegment(N[1.5, 1.50000000000001], N[1.5, 2.0]))
45+
@assert r > N(1e-10) "default tolerance changed; adapt test"
46+
LazySets.set_rtol(N, N(1e-10))
47+
@test N[1.5, 1.5] LineSegment(N[1.5, 1.500000001], N[1.5, 2.0])
4748
LazySets.set_rtol(N, r)
4849
end
4950

test/Sets/Zonotope.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ for N in @tN([Float64, Float32, Rational{Int}])
428428
@test isidentical(Z2, Zonotope(N[4, 5, 6], N[3 7; 3 7; 3 7]))
429429

430430
# distance (between point and set)
431-
@test_broken distance(Z, N[0, 0]) isa LazySet{N} # TODO this should work
431+
@test_broken distance(Z, N[0, 0]) isa LazySet{N} # TODO implement `distance` for polytopes
432432
# @test_throws DimensionMismatch distance(Z, N[0])
433433
# @test_throws ArgumentError distance(Z, N[0]; p=N(1 // 2))
434434
# for (x, v) in ((N[1], N(0)), (N[4], N(2)))
@@ -602,10 +602,10 @@ for N in @tN([Float64, Float32, Rational{Int}])
602602
end
603603

604604
# difference
605-
@test_broken difference(Z, Z3) isa LazySet{N} # TODO this should work (add more tests later)
605+
@test_broken difference(Z, Z3) isa LazySet{N} # TODO implement `difference` for polytopes (add more tests later)
606606

607607
# distance (between two sets)
608-
@test_broken distance(Z, Z3) isa LazySet{N} # TODO this should work (add more tests later)
608+
@test_broken distance(Z, Z3) isa LazySet{N} # TODO implement `distance` for polytopes (add more tests later)
609609

610610
# exact_sum
611611
@test_throws DimensionMismatch exact_sum(Z, Z3)
@@ -658,8 +658,9 @@ for N in @tN([Float64, Float32, Rational{Int}])
658658
Z2 = Zonotope(N[6 + 1e-9, 8], N[1 0; 0 1])
659659
@test !isdisjoint(Z, Z2)
660660
r = LazySets._rtol(N)
661+
@assert r > N(1e-10) "default tolerance changed; adapt test"
661662
LazySets.set_rtol(N, N(1e-10))
662-
@test_broken isdisjoint(Z, Z2) # TODO this should work
663+
@test_broken isdisjoint(Z, Z2) # cannot adapt tolerance of LP solver
663664
# restore tolerance
664665
LazySets.set_rtol(N, r)
665666
end
@@ -701,8 +702,8 @@ for N in @tN([Float64, Float32, Rational{Int}])
701702

702703
# linear_combination
703704
@test_throws DimensionMismatch linear_combination(Z, Z3)
704-
@test_broken linear_combination(Z, Xnc) # TODO implement `linear_combination` for non-convex sets
705-
@test_broken linear_combination(Xnc, Z)
705+
@test_broken linear_combination(Z, Xnc) isa LazySet{N} # TODO implement `linear_combination` for non-convex sets
706+
@test_broken linear_combination(Xnc, Z) isa LazySet{N}
706707
for X in (linear_combination(Z, Z), linear_combination(Z, P), linear_combination(P, Z))
707708
@test X isa LazySet{N} && isequivalent(X, Z)
708709
end

0 commit comments

Comments
 (0)