diff --git a/Project.toml b/Project.toml index 6e3d788..ae94c70 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PermutationGroups" uuid = "8bc5a954-2dfc-11e9-10e6-cd969bffa420" authors = ["Marek Kaluba ", "tweisser "] -version = "0.4.2" +version = "0.4.3" [deps] GroupsCore = "d5909c97-4eac-4ecc-a3dc-fdd0858a4120" diff --git a/src/io.jl b/src/io.jl index 7c9a963..a93e823 100644 --- a/src/io.jl +++ b/src/io.jl @@ -1,9 +1,3 @@ -function Base.show(io::IO, ::Type{<:PermGroup{I}}) where {I} - return print(io, PermGroup, "{$I, …}") -end -# function Base.show(io::IO, ::Type{<:Permutation{I, G}}) where {I, G} -# return print(io, Permutation, "{$I, …}") -# end function Base.show(io::IO, G::PermGroup) print(io, "PermGroup( ") join(io, gens(G), ", ") @@ -25,5 +19,3 @@ function Base.show(io::IO, ::MIME"text/plain", G::PermGroup) ) return Base.print_array(io, gens(G)) end - -# Base.show(io::IO, g::Permutation) = show(io, Perm.perm(g)) diff --git a/src/perm_group.jl b/src/perm_group.jl index d004962..9f650f5 100644 --- a/src/perm_group.jl +++ b/src/perm_group.jl @@ -16,6 +16,7 @@ and stabilizer chain are computed (and cached) _when needed_. T::Type{<:AbstractTransversal}, gens::AbstractVector{<:AbstractPermutation}, ) + @assert !isempty(gens) "groups need to have at least one generator" gens_raw = [Perms.perm(s) for s in gens] return new{eltype(gens_raw),T(eltype(gens_raw))}(gens_raw) end @@ -31,6 +32,7 @@ else T::Type{<:AbstractTransversal}, gens::AbstractVector{<:AbstractPermutation}, ) + @assert !isempty(gens) "groups need to have at least one generator" gens_raw = [Perms.perm(s) for s in gens] return new{eltype(gens_raw),T(eltype(gens_raw))}(gens_raw) end diff --git a/test/perm_groups.jl b/test/perm_groups.jl index ec53943..ad99ece 100644 --- a/test/perm_groups.jl +++ b/test/perm_groups.jl @@ -8,6 +8,8 @@ @test order(Int, G) isa Int @test isdefined(G, :stabchain) == true + @test_throws AssertionError PermGroup() + G = PermGroup(perm"(1,2)", perm"(1,2,3,4)") @test StabilizerChain(G) isa StabilizerChain sc = StabilizerChain(G) @@ -40,8 +42,6 @@ @test sprint(show, G) == "PermGroup( (1,2), (1,2,3,4) )" @test sprint(show, MIME"text/plain"(), G) == "Permutation group on 2 generators generated by\n (1,2)\n (1,2,3,4)" - @test sprint(show, [G]) == - "PermGroup{Perm{UInt16}, …}[PermGroup( (1,2), (1,2,3,4) )]" m = match(r"order (\d+)", sprint(show, MIME"text/plain"(), G)) @test m === nothing