From 65d6a75bcb07943b25d8f9f5f1ead4bf82169a77 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Fri, 21 Sep 2018 19:11:37 +0200 Subject: [PATCH] update tests --- test/AutGroup-tests.jl | 1 - test/DirectProd-tests.jl | 19 +++++++++---------- test/WreathProd-tests.jl | 39 +++++++++++++++++++-------------------- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/test/AutGroup-tests.jl b/test/AutGroup-tests.jl index ed582b9..b0eff17 100644 --- a/test/AutGroup-tests.jl +++ b/test/AutGroup-tests.jl @@ -130,7 +130,6 @@ f = Groups.perm_autsymbol([2,1,4,3]) @test isa(inv(f), Groups.AutSymbol) - @test_throws MethodError f^-1 @test_throws MethodError f*f @test A(f)^-1 == A(inv(f)) diff --git a/test/DirectProd-tests.jl b/test/DirectProd-tests.jl index 439ba65..5e9437e 100644 --- a/test/DirectProd-tests.jl +++ b/test/DirectProd-tests.jl @@ -1,5 +1,7 @@ @testset "DirectProducts" begin + ×(a,b) = Groups.pow(a,b) + @testset "Constructors" begin G = PermutationGroup(3) g = G([2,3,1]) @@ -33,7 +35,6 @@ @test_throws DomainError GG(g,g,g) @test GG(g,g^2) == h - @test size(h) == (2,) @test h[1] == g @test h[2] == g^2 h[2] = G() @@ -62,10 +63,10 @@ @test parent_type(typeof((G×G)(g,g^2))) == Groups.DirectProductGroup{typeof(G)} @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 parent_type(typeof((F×F)(1,5))) == Groups.DirectProductGroup{AddGrp{typeof(F)}} + @test elem_type(F×F) == DirectProductGroupElem{Groups.AddGrpElem{AbstractAlgebra.gfelem{Int}}} + @test parent_type(typeof((F×F)(1,5))) == Groups.DirectProductGroup{Groups.AddGrp{AbstractAlgebra.GFField{Int}}} parent((F×F)(1,5)) == DirectProductGroup(F,2) end @@ -160,22 +161,20 @@ @testset "Misc" begin F = GF(5) - - FF = DirectProductGroup(F,2) + FF = DirectProductGroup(AdditiveGroup(F),2) @test order(FF) == 25 elts = vec(collect(elements(FF))) @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) - FF = DirectProductGroup(MultiplicativeGroup(F), 3) @test order(FF) == 64 elts = vec(collect(elements(FF))) @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) @@ -187,7 +186,7 @@ elts = vec(collect(elements(GG))) @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) end end diff --git a/test/WreathProd-tests.jl b/test/WreathProd-tests.jl index a1443a6..e371f33 100644 --- a/test/WreathProd-tests.jl +++ b/test/WreathProd-tests.jl @@ -1,23 +1,23 @@ @testset "WreathProducts" begin S_3 = PermutationGroup(3) - R, x = PolynomialRing(QQ, "x") - F, a = NumberField(x^2 + 1, "a") + S_2 = PermutationGroup(2) b = S_3([2,3,1]) + a = S_2([2,1]) @testset "Constructors" begin - @test isa(Groups.WreathProduct(F, S_3), AbstractAlgebra.Group) - @test isa(Groups.WreathProduct(F, S_3), Groups.WreathProduct) - @test isa(Groups.WreathProduct(F, S_3), Groups.WreathProduct{AddGrp{Generic.ResField{Generic.Poly{Rational{BigInt}}}}, Int64}) + @test isa(Groups.WreathProduct(S_2, S_3), AbstractAlgebra.Group) + B3 = Groups.WreathProduct(S_2, S_3) + @test B3 isa Groups.WreathProduct + @test B3 isa WreathProduct{AbstractAlgebra.Generic.PermGroup{Int}, Int} aa = Groups.DirectProductGroupElem([a^0 ,a, a^2]) @test isa(Groups.WreathProductElem(aa, b), AbstractAlgebra.GroupElem) - @test isa(Groups.WreathProductElem(aa, b), Groups.WreathProductElem) - @test isa(Groups.WreathProductElem(aa, b), Groups.WreathProductElem{AddGrpElem{Generic.ResF{Generic.Poly{Rational{BigInt}}}}, Int64}) + x = Groups.WreathProductElem(aa, b) + @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(F, 3) + @test B3.N == Groups.DirectProductGroup(S_2, 3) @test B3.P == S_3 @test B3(aa, b) == Groups.WreathProductElem(aa, b) @@ -30,23 +30,23 @@ end @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(B3()) == Groups.WreathProduct(F,S_3) + @test parent(B3()) == Groups.WreathProduct(S_2,S_3) @test parent(B3()) == B3 end @testset "Basic operations on WreathProductElem" begin 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) @test g.p == b - @test g.n == DirectProductGroupElem(AddGrpElem.(aa.elts)) + @test g.n == DirectProductGroupElem(aa.elts) h = deepcopy(g) @test h == g @@ -66,9 +66,8 @@ @test hash(g) != hash(h) end - @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)") @test inv(x) == B4([1,0,2,0], perm"(1,3,2)(4)") @@ -91,8 +90,8 @@ B3 = Groups.WreathProduct(GF(3), S_3) @test order(B3) == 3^3*6 - B3 = Groups.WreathProduct(MultiplicativeGroup(GF(3)), S_3) - @test order(B3) == 2^3*6 + # B3 = Groups.WreathProduct(MultiplicativeGroup(GF(3)), S_3) + # @test order(B3) == 2^3*6 Wr = WreathProduct(PermutationGroup(2),PermutationGroup(4)) @@ -102,7 +101,7 @@ elts = [elements(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) end