Skip to content

Commit fd37e71

Browse files
authored
Merge pull request #4076 from JuliaReach/schillic/tests
Revise tolerance tests and comments
2 parents 3077e1d + 8139fca commit fd37e71

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
@@ -432,7 +432,7 @@ for N in @tN([Float64, Float32, Rational{Int}])
432432
@test isidentical(Z2, Zonotope(N[4, 5, 6], N[3 7; 3 7; 3 7]))
433433

434434
# distance (between point and set)
435-
@test_broken distance(Z, N[0, 0]) isa LazySet{N} # TODO this should work
435+
@test_broken distance(Z, N[0, 0]) isa LazySet{N} # TODO implement `distance` for polytopes
436436
# @test_throws DimensionMismatch distance(Z, N[0])
437437
# @test_throws ArgumentError distance(Z, N[0]; p=N(1 // 2))
438438
# for (x, v) in ((N[1], N(0)), (N[4], N(2)))
@@ -606,10 +606,10 @@ for N in @tN([Float64, Float32, Rational{Int}])
606606
end
607607

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

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

614614
# exact_sum
615615
@test_throws DimensionMismatch exact_sum(Z, Z3)
@@ -662,8 +662,9 @@ for N in @tN([Float64, Float32, Rational{Int}])
662662
Z2 = Zonotope(N[6 + 1e-9, 8], N[1 0; 0 1])
663663
@test !isdisjoint(Z, Z2)
664664
r = LazySets._rtol(N)
665+
@assert r > N(1e-10) "default tolerance changed; adapt test"
665666
LazySets.set_rtol(N, N(1e-10))
666-
@test_broken isdisjoint(Z, Z2) # TODO this should work
667+
@test_broken isdisjoint(Z, Z2) # cannot adapt tolerance of LP solver
667668
# restore tolerance
668669
LazySets.set_rtol(N, r)
669670
end
@@ -705,8 +706,8 @@ for N in @tN([Float64, Float32, Rational{Int}])
705706

706707
# linear_combination
707708
@test_throws DimensionMismatch linear_combination(Z, Z3)
708-
@test_broken linear_combination(Z, Xnc) # TODO implement `linear_combination` for non-convex sets
709-
@test_broken linear_combination(Xnc, Z)
709+
@test_broken linear_combination(Z, Xnc) isa LazySet{N} # TODO implement `linear_combination` for non-convex sets
710+
@test_broken linear_combination(Xnc, Z) isa LazySet{N}
710711
for X in (linear_combination(Z, Z), linear_combination(Z, P), linear_combination(P, Z))
711712
@test X isa LazySet{N} && isequivalent(X, Z)
712713
end

0 commit comments

Comments
 (0)