Skip to content

Commit

Permalink
make SymEngine tests more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Nov 20, 2024
1 parent 3fa947a commit b46c039
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
15 changes: 8 additions & 7 deletions test/Sets/HalfSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,14 @@ for N in [Float64]
# tests that require SymEngine
@static if isdefined(@__MODULE__, :SymEngine)
# _ishalfspace
@test all(LazySets._ishalfspace.([:(x1 <= 0), :(x1 < 0), :(x1 > 0), :(x1 >= 0)]))
@test !LazySets._ishalfspace(:(x1 = 0))
@test LazySets._ishalfspace(:(2 * x1 <= 4))
@test LazySets._ishalfspace(:(6.1 <= 5.3 * f - 0.1 * g))
@test !LazySets._ishalfspace(:(2 * x1^2 <= 4))
@test !LazySets._ishalfspace(:(x1^2 > 4 * x2 - x3))
@test LazySets._ishalfspace(:(x1 > 4 * x2 - x3))
res = all(LazySets._ishalfspace.([:(x1 <= 0), :(x1 < 0), :(x1 > 0), :(x1 >= 0)]))
res &= !LazySets._ishalfspace(:(x1 = 0))
res &= LazySets._ishalfspace(:(2 * x1 <= 4))
res &= LazySets._ishalfspace(:(6.1 <= 5.3 * f - 0.1 * g))
res &= !LazySets._ishalfspace(:(2 * x1^2 <= 4))
res &= !LazySets._ishalfspace(:(x1^2 > 4 * x2 - x3))
res &= LazySets._ishalfspace(:(x1 > 4 * x2 - x3))
@test res

# convert
H = convert(HalfSpace, :(x1 <= -0.03))
Expand Down
15 changes: 8 additions & 7 deletions test/Sets/Hyperplane.jl
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,14 @@ for N in [Float64]
# tests that require SymEngine
@static if isdefined(@__MODULE__, :SymEngine)
# _ishalfspace
@test LazySets._ishyperplanar(:(x1 = 0))
@test !LazySets._ishyperplanar(:(x1 <= 0))
@test LazySets._ishyperplanar(:(2 * x1 = 4))
@test LazySets._ishyperplanar(:(6.1 = 5.3 * f - 0.1 * g))
@test !LazySets._ishyperplanar(:(2 * x1^2 = 4))
@test !LazySets._ishyperplanar(:(x1^2 = 4 * x2 - x3))
@test LazySets._ishyperplanar(:(x1 = 4 * x2 - x3))
res = LazySets._ishyperplanar(:(x1 = 0))
res &= !LazySets._ishyperplanar(:(x1 <= 0))
res &= LazySets._ishyperplanar(:(2 * x1 = 4))
res &= LazySets._ishyperplanar(:(6.1 = 5.3 * f - 0.1 * g))
res &= !LazySets._ishyperplanar(:(2 * x1^2 = 4))
res &= !LazySets._ishyperplanar(:(x1^2 = 4 * x2 - x3))
res &= LazySets._ishyperplanar(:(x1 = 4 * x2 - x3))
@test res

# convert
H = convert(Hyperplane, :(x1 = -0.03))
Expand Down

0 comments on commit b46c039

Please sign in to comment.