mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-12-26 02:20:30 +01:00
update tests
This commit is contained in:
parent
3b1694f851
commit
65d6a75bcb
@ -130,7 +130,6 @@
|
|||||||
f = Groups.perm_autsymbol([2,1,4,3])
|
f = Groups.perm_autsymbol([2,1,4,3])
|
||||||
@test isa(inv(f), Groups.AutSymbol)
|
@test isa(inv(f), Groups.AutSymbol)
|
||||||
|
|
||||||
@test_throws MethodError f^-1
|
|
||||||
@test_throws MethodError f*f
|
@test_throws MethodError f*f
|
||||||
|
|
||||||
@test A(f)^-1 == A(inv(f))
|
@test A(f)^-1 == A(inv(f))
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
@testset "DirectProducts" begin
|
@testset "DirectProducts" begin
|
||||||
|
|
||||||
|
×(a,b) = Groups.pow(a,b)
|
||||||
|
|
||||||
@testset "Constructors" begin
|
@testset "Constructors" begin
|
||||||
G = PermutationGroup(3)
|
G = PermutationGroup(3)
|
||||||
g = G([2,3,1])
|
g = G([2,3,1])
|
||||||
@ -33,7 +35,6 @@
|
|||||||
@test_throws DomainError GG(g,g,g)
|
@test_throws DomainError GG(g,g,g)
|
||||||
@test GG(g,g^2) == h
|
@test GG(g,g^2) == h
|
||||||
|
|
||||||
@test size(h) == (2,)
|
|
||||||
@test h[1] == g
|
@test h[1] == g
|
||||||
@test h[2] == g^2
|
@test h[2] == g^2
|
||||||
h[2] = G()
|
h[2] = G()
|
||||||
@ -62,10 +63,10 @@
|
|||||||
@test parent_type(typeof((G×G)(g,g^2))) == Groups.DirectProductGroup{typeof(G)}
|
@test parent_type(typeof((G×G)(g,g^2))) == Groups.DirectProductGroup{typeof(G)}
|
||||||
@test parent((G×G)(g,g^2)) == DirectProductGroup(G,2)
|
@test parent((G×G)(g,g^2)) == DirectProductGroup(G,2)
|
||||||
|
|
||||||
F = GF(13)
|
F = AdditiveGroup(GF(13))
|
||||||
|
|
||||||
@test elem_type(F×F) == DirectProductGroupElem{Groups.AddGrpElem{elem_type(F)}}
|
@test elem_type(F×F) == DirectProductGroupElem{Groups.AddGrpElem{AbstractAlgebra.gfelem{Int}}}
|
||||||
@test parent_type(typeof((F×F)(1,5))) == Groups.DirectProductGroup{AddGrp{typeof(F)}}
|
@test parent_type(typeof((F×F)(1,5))) == Groups.DirectProductGroup{Groups.AddGrp{AbstractAlgebra.GFField{Int}}}
|
||||||
parent((F×F)(1,5)) == DirectProductGroup(F,2)
|
parent((F×F)(1,5)) == DirectProductGroup(F,2)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -160,22 +161,20 @@
|
|||||||
@testset "Misc" begin
|
@testset "Misc" begin
|
||||||
F = GF(5)
|
F = GF(5)
|
||||||
|
|
||||||
|
FF = DirectProductGroup(AdditiveGroup(F),2)
|
||||||
FF = DirectProductGroup(F,2)
|
|
||||||
@test order(FF) == 25
|
@test order(FF) == 25
|
||||||
|
|
||||||
elts = vec(collect(elements(FF)))
|
elts = vec(collect(elements(FF)))
|
||||||
@test length(elts) == 25
|
@test length(elts) == 25
|
||||||
@test all([g*inv(g) for g in elts] .== FF())
|
@test all([g*inv(g) == FF() for g in elts])
|
||||||
@test all(inv(g*h) == inv(h)*inv(g) for g in elts for h in elts)
|
@test all(inv(g*h) == inv(h)*inv(g) for g in elts for h in elts)
|
||||||
|
|
||||||
|
|
||||||
FF = DirectProductGroup(MultiplicativeGroup(F), 3)
|
FF = DirectProductGroup(MultiplicativeGroup(F), 3)
|
||||||
@test order(FF) == 64
|
@test order(FF) == 64
|
||||||
|
|
||||||
elts = vec(collect(elements(FF)))
|
elts = vec(collect(elements(FF)))
|
||||||
@test length(elts) == 64
|
@test length(elts) == 64
|
||||||
@test all([g*inv(g) for g in elts] .== FF())
|
@test all([g*inv(g) == FF() for g in elts])
|
||||||
@test all(inv(g*h) == inv(h)*inv(g) for g in elts for h in elts)
|
@test all(inv(g*h) == inv(h)*inv(g) for g in elts for h in elts)
|
||||||
|
|
||||||
|
|
||||||
@ -187,7 +186,7 @@
|
|||||||
elts = vec(collect(elements(GG)))
|
elts = vec(collect(elements(GG)))
|
||||||
|
|
||||||
@test length(elts) == 36
|
@test length(elts) == 36
|
||||||
@test all([g*inv(g) for g in elts] .== GG())
|
@test all([g*inv(g) == GG() for g in elts])
|
||||||
@test all(inv(g*h) == inv(h)*inv(g) for g in elts for h in elts)
|
@test all(inv(g*h) == inv(h)*inv(g) for g in elts for h in elts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
@testset "WreathProducts" begin
|
@testset "WreathProducts" begin
|
||||||
S_3 = PermutationGroup(3)
|
S_3 = PermutationGroup(3)
|
||||||
R, x = PolynomialRing(QQ, "x")
|
S_2 = PermutationGroup(2)
|
||||||
F, a = NumberField(x^2 + 1, "a")
|
|
||||||
b = S_3([2,3,1])
|
b = S_3([2,3,1])
|
||||||
|
a = S_2([2,1])
|
||||||
|
|
||||||
@testset "Constructors" begin
|
@testset "Constructors" begin
|
||||||
@test isa(Groups.WreathProduct(F, S_3), AbstractAlgebra.Group)
|
@test isa(Groups.WreathProduct(S_2, S_3), AbstractAlgebra.Group)
|
||||||
@test isa(Groups.WreathProduct(F, S_3), Groups.WreathProduct)
|
B3 = Groups.WreathProduct(S_2, S_3)
|
||||||
@test isa(Groups.WreathProduct(F, S_3), Groups.WreathProduct{AddGrp{Generic.ResField{Generic.Poly{Rational{BigInt}}}}, Int64})
|
@test B3 isa Groups.WreathProduct
|
||||||
|
@test B3 isa WreathProduct{AbstractAlgebra.Generic.PermGroup{Int}, Int}
|
||||||
|
|
||||||
aa = Groups.DirectProductGroupElem([a^0 ,a, a^2])
|
aa = Groups.DirectProductGroupElem([a^0 ,a, a^2])
|
||||||
|
|
||||||
@test isa(Groups.WreathProductElem(aa, b), AbstractAlgebra.GroupElem)
|
@test isa(Groups.WreathProductElem(aa, b), AbstractAlgebra.GroupElem)
|
||||||
@test isa(Groups.WreathProductElem(aa, b), Groups.WreathProductElem)
|
x = Groups.WreathProductElem(aa, b)
|
||||||
@test isa(Groups.WreathProductElem(aa, b), Groups.WreathProductElem{AddGrpElem{Generic.ResF{Generic.Poly{Rational{BigInt}}}}, Int64})
|
@test x isa Groups.WreathProductElem
|
||||||
|
@test x isa Groups.WreathProductElem{AbstractAlgebra.Generic.perm{Int}, Int}
|
||||||
|
|
||||||
B3 = Groups.WreathProduct(F, S_3)
|
@test B3.N == Groups.DirectProductGroup(S_2, 3)
|
||||||
|
|
||||||
@test B3.N == Groups.DirectProductGroup(F, 3)
|
|
||||||
@test B3.P == S_3
|
@test B3.P == S_3
|
||||||
|
|
||||||
@test B3(aa, b) == Groups.WreathProductElem(aa, b)
|
@test B3(aa, b) == Groups.WreathProductElem(aa, b)
|
||||||
@ -30,23 +30,23 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
@testset "Types" begin
|
@testset "Types" begin
|
||||||
B3 = Groups.WreathProduct(F, S_3)
|
B3 = Groups.WreathProduct(S_2, S_3)
|
||||||
|
|
||||||
@test elem_type(B3) == Groups.WreathProductElem{AddGrpElem{elem_type(F)}, Int}
|
@test elem_type(B3) == Groups.WreathProductElem{perm{Int}, Int}
|
||||||
|
|
||||||
@test parent_type(typeof(B3())) == Groups.WreathProduct{parent_type(typeof(B3.N.group())), Int}
|
@test parent_type(typeof(B3())) == Groups.WreathProduct{parent_type(typeof(B3.N.group())), Int}
|
||||||
|
|
||||||
@test parent(B3()) == Groups.WreathProduct(F,S_3)
|
@test parent(B3()) == Groups.WreathProduct(S_2,S_3)
|
||||||
@test parent(B3()) == B3
|
@test parent(B3()) == B3
|
||||||
end
|
end
|
||||||
|
|
||||||
@testset "Basic operations on WreathProductElem" begin
|
@testset "Basic operations on WreathProductElem" begin
|
||||||
aa = Groups.DirectProductGroupElem([a^0 ,a, a^2])
|
aa = Groups.DirectProductGroupElem([a^0 ,a, a^2])
|
||||||
B3 = Groups.WreathProduct(F, S_3)
|
B3 = Groups.WreathProduct(S_2, S_3)
|
||||||
g = B3(aa, b)
|
g = B3(aa, b)
|
||||||
|
|
||||||
@test g.p == b
|
@test g.p == b
|
||||||
@test g.n == DirectProductGroupElem(AddGrpElem.(aa.elts))
|
@test g.n == DirectProductGroupElem(aa.elts)
|
||||||
|
|
||||||
h = deepcopy(g)
|
h = deepcopy(g)
|
||||||
@test h == g
|
@test h == g
|
||||||
@ -66,9 +66,8 @@
|
|||||||
@test hash(g) != hash(h)
|
@test hash(g) != hash(h)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@testset "Group arithmetic" begin
|
@testset "Group arithmetic" begin
|
||||||
B4 = Groups.WreathProduct(GF(3), PermutationGroup(4))
|
B4 = Groups.WreathProduct(AdditiveGroup(GF(3)), PermutationGroup(4))
|
||||||
|
|
||||||
x = B4([0,1,2,0], perm"(1,2,3)(4)")
|
x = B4([0,1,2,0], perm"(1,2,3)(4)")
|
||||||
@test inv(x) == B4([1,0,2,0], perm"(1,3,2)(4)")
|
@test inv(x) == B4([1,0,2,0], perm"(1,3,2)(4)")
|
||||||
@ -91,8 +90,8 @@
|
|||||||
B3 = Groups.WreathProduct(GF(3), S_3)
|
B3 = Groups.WreathProduct(GF(3), S_3)
|
||||||
@test order(B3) == 3^3*6
|
@test order(B3) == 3^3*6
|
||||||
|
|
||||||
B3 = Groups.WreathProduct(MultiplicativeGroup(GF(3)), S_3)
|
# B3 = Groups.WreathProduct(MultiplicativeGroup(GF(3)), S_3)
|
||||||
@test order(B3) == 2^3*6
|
# @test order(B3) == 2^3*6
|
||||||
|
|
||||||
Wr = WreathProduct(PermutationGroup(2),PermutationGroup(4))
|
Wr = WreathProduct(PermutationGroup(2),PermutationGroup(4))
|
||||||
|
|
||||||
@ -102,7 +101,7 @@
|
|||||||
elts = [elements(Wr)...]
|
elts = [elements(Wr)...]
|
||||||
|
|
||||||
@test length(elts) == order(Wr)
|
@test length(elts) == order(Wr)
|
||||||
@test all([g*inv(g) for g in elts] .== Wr())
|
@test all([g*inv(g) == Wr() for g in elts])
|
||||||
@test all(inv(g*h) == inv(h)*inv(g) for g in elts for h in elts)
|
@test all(inv(g*h) == inv(h)*inv(g) for g in elts for h in elts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user