Skip to content

Commit

Permalink
Merge pull request #483 from oscar-system/lk/booktests
Browse files Browse the repository at this point in the history
allow type parameter for bigobject graphs
  • Loading branch information
benlorenz authored Apr 16, 2024
2 parents 526521b + 37ffa60 commit e851a4b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Polymake"
uuid = "d720cf60-89b5-51f5-aff5-213f193123e7"
repo = "https://github.com/oscar-system/Polymake.jl.git"
version = "0.11.15"
version = "0.11.16"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand Down
3 changes: 2 additions & 1 deletion src/meta.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Meta
import JSON
import Polymake: appname_module_dict, module_appname_dict, shell_context_help
import Polymake: Rational, PolymakeType, PropertyValue, OptionSet, QuadraticExtension, OscarNumber
import Polymake: Rational, PolymakeType, PropertyValue, OptionSet, QuadraticExtension, OscarNumber, DirType

struct UnparsablePolymakeFunction <: Exception
msg::String
Expand Down Expand Up @@ -34,6 +34,7 @@ translate_type_to_pm_string(::Type{<:Base.Integer}) = "Integer"
translate_type_to_pm_string(::Type{<:OscarNumber}) = "OscarNumber"
translate_type_to_pm_string(::typeof(min)) = "Min"
translate_type_to_pm_string(::typeof(max)) = "Max"
translate_type_to_pm_string(::Type{T}) where T <: DirType = string(nameof(T))
translate_type_to_pm_string(::Type{<:QuadraticExtension{T}}) where T = string("QuadraticExtension<", translate_type_to_pm_string(T), ">")

translate_type_to_pm_string(T) = throw(DomainError(T, "$T has been passed as a type parameter but no translation to a C++ template was defined. You may define such translation by appropriately extending
Expand Down
10 changes: 10 additions & 0 deletions test/graphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
@test Polymake.ne(g) == 0
end

@testset verbose=true "bigobjects" begin
c = Polymake.polytope.cube(3)
eg = c.GRAPH.ADJACENCY
g = Polymake.Graph{Polymake.Directed}(5)
bg = Polymake.graph.Graph{Polymake.Directed}(ADJACENCY=g)
@test bg.N_NODES == 5
bg2 = Polymake.graph.Graph(ADJACENCY=eg)
@test bg2.N_NODES == 8
end

@testset verbose=true "manipulating edges and vertices" begin
g = Polymake.Graph{Polymake.Directed}(5)
Polymake._add_edge(g, 0, 1)
Expand Down

0 comments on commit e851a4b

Please sign in to comment.