mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-12-25 18:15:29 +01:00
test show methods
This commit is contained in:
parent
8cb64d947d
commit
39f4ef4b5f
@ -31,12 +31,11 @@ end
|
|||||||
|
|
||||||
function Base.show(io::IO, t::Transvection)
|
function Base.show(io::IO, t::Transvection)
|
||||||
id = if t.id === :ϱ
|
id = if t.id === :ϱ
|
||||||
"ϱ"
|
'ϱ'
|
||||||
else # if t.id === :λ
|
else # if t.id === :λ
|
||||||
"λ"
|
'λ'
|
||||||
end
|
end
|
||||||
# print(io, id, Groups.subscriptify(t.i), ".", Groups.subscriptify(t.j))
|
print(io, id, subscriptify(t.i), '.', subscriptify(t.j))
|
||||||
print(io, id, "_", t.i, ",", t.j)
|
|
||||||
t.inv && print(io, "^-1")
|
t.inv && print(io, "^-1")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -211,3 +211,8 @@ end
|
|||||||
|
|
||||||
abstract type GSymbol end
|
abstract type GSymbol end
|
||||||
Base.literal_pow(::typeof(^), t::GSymbol, ::Val{-1}) = inv(t)
|
Base.literal_pow(::typeof(^), t::GSymbol, ::Val{-1}) = inv(t)
|
||||||
|
|
||||||
|
function subscriptify(n::Integer)
|
||||||
|
subscript_0 = Int(0x2080) # Char(0x2080) -> subscript 0
|
||||||
|
return join([Char(subscript_0 + i) for i in reverse(digits(n))], "")
|
||||||
|
end
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
@test New.gersten_alphabet(3) isa Alphabet
|
@test New.gersten_alphabet(3) isa Alphabet
|
||||||
A = New.gersten_alphabet(3)
|
A = New.gersten_alphabet(3)
|
||||||
@test length(A) == 12
|
@test length(A) == 12
|
||||||
|
|
||||||
|
@test sprint(show, New.ϱ(1, 2)) == "ϱ₁.₂"
|
||||||
|
@test sprint(show, New.λ(3, 2)) == "λ₃.₂"
|
||||||
end
|
end
|
||||||
|
|
||||||
A4 = Alphabet(
|
A4 = Alphabet(
|
||||||
@ -36,8 +39,6 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
F4 = New.FreeGroup([:a, :b, :c, :d], A4)
|
F4 = New.FreeGroup([:a, :b, :c, :d], A4)
|
||||||
A = New.SpecialAutomorphismGroup(F4, maxrules=1000)
|
|
||||||
|
|
||||||
a,b,c,d = gens(F4)
|
a,b,c,d = gens(F4)
|
||||||
D = ntuple(i->gens(F4, i), 4)
|
D = ntuple(i->gens(F4, i), 4)
|
||||||
|
|
||||||
@ -78,12 +79,14 @@
|
|||||||
@test inv(l)(deepcopy(D)) == (a, d^-1*b,c, d)
|
@test inv(l)(deepcopy(D)) == (a, d^-1*b,c, d)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
A = New.SpecialAutomorphismGroup(F4, maxrules=1000)
|
||||||
|
|
||||||
@testset "AutomorphismGroup constructors" begin
|
@testset "AutomorphismGroup constructors" begin
|
||||||
@test A isa New.AbstractFPGroup
|
@test A isa New.AbstractFPGroup
|
||||||
@test A isa New.AutomorphismGroup
|
@test A isa New.AutomorphismGroup
|
||||||
@test KnuthBendix.alphabet(A) isa Alphabet
|
@test KnuthBendix.alphabet(A) isa Alphabet
|
||||||
@test New.relations(A) isa Vector{<:Pair}
|
@test New.relations(A) isa Vector{<:Pair}
|
||||||
|
@test sprint(show, A) == "automorphism group of free group on 4 generators"
|
||||||
end
|
end
|
||||||
|
|
||||||
@testset "Automorphisms: hash and evaluate" begin
|
@testset "Automorphisms: hash and evaluate" begin
|
||||||
@ -93,6 +96,8 @@
|
|||||||
@test New.evaluate(g*h) == New.evaluate(h*g)
|
@test New.evaluate(g*h) == New.evaluate(h*g)
|
||||||
@test (g*h).savedhash == zero(UInt)
|
@test (g*h).savedhash == zero(UInt)
|
||||||
|
|
||||||
|
@test sprint(show, typeof(g)) == "Automorphism{Groups.New.FreeGroup{Symbol},…}"
|
||||||
|
|
||||||
a = g*h
|
a = g*h
|
||||||
b = h*g
|
b = h*g
|
||||||
@test hash(a) != zero(UInt)
|
@test hash(a) != zero(UInt)
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
G = New.FPGroup(F, [a*b=>b*a, a*c=>c*a, b*c=>c*b])
|
G = New.FPGroup(F, [a*b=>b*a, a*c=>c*a, b*c=>c*b])
|
||||||
|
|
||||||
@test G isa New.FPGroup
|
@test G isa New.FPGroup
|
||||||
|
@test sprint(show, G) == "⟨a, b, c | a*b => b*a, a*c => c*a, b*c => c*b⟩"
|
||||||
@test rand(G) isa New.FPGroupElement
|
@test rand(G) isa New.FPGroupElement
|
||||||
|
|
||||||
f = a*c*b
|
f = a*c*b
|
||||||
@ -33,6 +34,11 @@
|
|||||||
New.normalform!(g)
|
New.normalform!(g)
|
||||||
@test New.word(g) == [1, 3, 5]
|
@test New.word(g) == [1, 3, 5]
|
||||||
|
|
||||||
|
let g = aG*cG*bG
|
||||||
|
# test that we normalize g before printing
|
||||||
|
@test sprint(show, g) == "a*b*c"
|
||||||
|
end
|
||||||
|
|
||||||
# quotient of G
|
# quotient of G
|
||||||
H = New.FPGroup(G, [aG^2=>cG, bG*cG=>aG], maxrules=200)
|
H = New.FPGroup(G, [aG^2=>cG, bG*cG=>aG], maxrules=200)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user