Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added list_properties(::BigObject) #450

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/perlobj.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ end

Base.propertynames(p::BigObject) = Symbol.(Polymake.complete_property(p, ""))

function list_properties(obj::BigObject)
l = Polymake.call_method(Polymake.PropertyValue, obj, :list_properties; calltype = :list)
return Polymake.to_array_string(l)
end

function Base.setproperty!(obj::BigObject, prop::Symbol, val)
@assert prop != :cpp_object
return take(obj, string(prop), convert(PolymakeType, val))
Expand Down
6 changes: 6 additions & 0 deletions test/perlobj.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@

@testset verbose=true "properties" begin
test_polytope = @pm polytope.Polytope(POINTS=points_int)
@test Polymake.list_properties(test_polytope) isa Polymake.Array
@test Polymake.list_properties(test_polytope) == ["POINTS"]
@test test_polytope.F_VECTOR == [ 4, 4 ]
let prli = Polymake.list_properties(test_polytope)
@test "POINTS" in prli
@test "F_VECTOR" in prli
end
@test test_polytope.INTERIOR_LATTICE_POINTS ==
[ 1 1 1 ; 1 1 2 ; 1 2 1 ; 1 2 2 ]

Expand Down
Loading