Skip to content

Commit

Permalink
split tests for Universe
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Feb 11, 2025
1 parent 19b5cb4 commit 9c383d8
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions test/Sets/Universe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -300,20 +300,11 @@ for N in [Float64, Float32, Rational{Int}]
@test v isa N && v == N(Inf)
end

# exact_sum / minkowski_sum
for f in (exact_sum, minkowski_sum)
@test_throws AssertionError f(U, U3)
@test_throws AssertionError f(U3, U)
for U2 in (f(U, U), f(U, B), f(B, U))
@test isidentical(U, U2)
end
for X in (f(U, Pe), f(Pe, U))
@test X isa HPolygon{N} && X == Pe
end
end
for U2 in (minkowski_sum(U, Z), minkowski_sum(Z, U), minkowski_sum(U, B), minkowski_sum(B, U),
minkowski_sum(U, Pnc), minkowski_sum(Pnc, U))
@test U2 isa Universe{N} && U2 == U
# exact_sum
@test_throws AssertionError exact_sum(U, U3)
@test_throws AssertionError exact_sum(U3, U)
for U2 in (exact_sum(U, U), exact_sum(U, B), exact_sum(B, U))
@test isidentical(U, U2)
end

# intersection
Expand Down Expand Up @@ -385,7 +376,7 @@ for N in [Float64, Float32, Rational{Int}]
@test !res && w isa Vector{N} && w X && w U
end
end
# TODO test with non-Universe `X` for which `isuniversal(X) == true` (currently n/a)
# TODO test `U ⊆ X` with non-Universe `X` for which `isuniversal(X) == true` (currently n/a)

# linear_combination
@test_throws AssertionError linear_combination(U, U3)
Expand All @@ -405,7 +396,21 @@ for N in [Float64, Float32, Rational{Int}]
end
E2 = minkowski_difference(B, U)
@test E2 isa EmptySet{N} && dim(E2) == 2
# TODO test with non-Universe `X` for which `isuniversal(X) == true` (currently n/a)
# TODO test `minkowski_difference(X, U)` with non-Universe `X` for which `isuniversal(X) == true` (currently n/a)

# minkowski_sum
@test_throws AssertionError minkowski_sum(U, U3)
@test_throws AssertionError minkowski_sum(U3, U)
for U2 in (minkowski_sum(U, U), minkowski_sum(U, B), minkowski_sum(B, U))
@test isidentical(U, U2)
end
for X in (minkowski_sum(U, Pe), minkowski_sum(Pe, U))
@test X isa HPolygon{N} && X == Pe
end
for U2 in (minkowski_sum(U, Z), minkowski_sum(Z, U), minkowski_sum(U, B), minkowski_sum(B, U),
minkowski_sum(U, Pnc), minkowski_sum(Pnc, U))
@test U2 isa Universe{N} && U2 == U
end
end

for N in [Float64, Float32]
Expand Down

0 comments on commit 9c383d8

Please sign in to comment.