Skip to content

Commit 20a632d

Browse files
committed
fix 'an_element' fallback for unbounded sets
1 parent 66caa49 commit 20a632d

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/Interfaces/LazySet.jl

+5-1
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,11 @@ end
641641
function _an_element_lazySet(X::LazySet)
642642
N = eltype(X)
643643
e₁ = SingleEntryVector(1, dim(X), one(N))
644-
return σ(e₁, X)
644+
v = σ(e₁, X)
645+
if any(isinf, v)
646+
throw(ArgumentError("this implementation assumes a bounded set"))
647+
end
648+
return v
645649
end
646650

647651
# hook into random API

test/Interfaces/LazySet.jl

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
for N in [Float64, Float32, Rational{Int}]
2+
# an_element default implementation
3+
U = Universe{N}(2)
4+
@test_throws ArgumentError LazySets._an_element_lazySet(U)
5+
end

test/runtests.jl

+3
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ if test_suite_basic
251251
@testset "LazySets.CompactSet" begin
252252
include("Interfaces/CompactSet.jl")
253253
end
254+
@testset "LazySets.LazySet" begin
255+
include("Interfaces/LazySet.jl")
256+
end
254257

255258
# =======================
256259
# Concrete set operations

0 commit comments

Comments
 (0)