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)
|
||||
id = if t.id === :ϱ
|
||||
"ϱ"
|
||||
'ϱ'
|
||||
else # if t.id === :λ
|
||||
"λ"
|
||||
'λ'
|
||||
end
|
||||
# print(io, id, Groups.subscriptify(t.i), ".", Groups.subscriptify(t.j))
|
||||
print(io, id, "_", t.i, ",", t.j)
|
||||
print(io, id, subscriptify(t.i), '.', subscriptify(t.j))
|
||||
t.inv && print(io, "^-1")
|
||||
end
|
||||
|
||||
|
@ -211,3 +211,8 @@ end
|
||||
|
||||
abstract type GSymbol end
|
||||
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
|
||||
A = New.gersten_alphabet(3)
|
||||
@test length(A) == 12
|
||||
|
||||
@test sprint(show, New.ϱ(1, 2)) == "ϱ₁.₂"
|
||||
@test sprint(show, New.λ(3, 2)) == "λ₃.₂"
|
||||
end
|
||||
|
||||
A4 = Alphabet(
|
||||
@ -36,8 +39,6 @@
|
||||
)
|
||||
|
||||
F4 = New.FreeGroup([:a, :b, :c, :d], A4)
|
||||
A = New.SpecialAutomorphismGroup(F4, maxrules=1000)
|
||||
|
||||
a,b,c,d = gens(F4)
|
||||
D = ntuple(i->gens(F4, i), 4)
|
||||
|
||||
@ -78,12 +79,14 @@
|
||||
@test inv(l)(deepcopy(D)) == (a, d^-1*b,c, d)
|
||||
end
|
||||
|
||||
A = New.SpecialAutomorphismGroup(F4, maxrules=1000)
|
||||
|
||||
@testset "AutomorphismGroup constructors" begin
|
||||
@test A isa New.AbstractFPGroup
|
||||
@test A isa New.AutomorphismGroup
|
||||
@test KnuthBendix.alphabet(A) isa Alphabet
|
||||
@test New.relations(A) isa Vector{<:Pair}
|
||||
|
||||
@test sprint(show, A) == "automorphism group of free group on 4 generators"
|
||||
end
|
||||
|
||||
@testset "Automorphisms: hash and evaluate" begin
|
||||
@ -93,6 +96,8 @@
|
||||
@test New.evaluate(g*h) == New.evaluate(h*g)
|
||||
@test (g*h).savedhash == zero(UInt)
|
||||
|
||||
@test sprint(show, typeof(g)) == "Automorphism{Groups.New.FreeGroup{Symbol},…}"
|
||||
|
||||
a = g*h
|
||||
b = h*g
|
||||
@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])
|
||||
|
||||
@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
|
||||
|
||||
f = a*c*b
|
||||
@ -33,6 +34,11 @@
|
||||
New.normalform!(g)
|
||||
@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
|
||||
H = New.FPGroup(G, [aG^2=>cG, bG*cG=>aG], maxrules=200)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user