mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2024-12-29 11:00:28 +01:00
more tests
This commit is contained in:
parent
148c8e2611
commit
c7477dd25f
@ -3,8 +3,8 @@ using Base.Test
|
|||||||
|
|
||||||
using Nemo
|
using Nemo
|
||||||
|
|
||||||
# write your own tests here
|
@testset "GroupRings" begin
|
||||||
@testset "GroupRing constructors: PermutationGroup" begin
|
@testset "Constructors: PermutationGroup" begin
|
||||||
G = PermutationGroup(3)
|
G = PermutationGroup(3)
|
||||||
|
|
||||||
@test isa(GroupRing(G), Nemo.Ring)
|
@test isa(GroupRing(G), Nemo.Ring)
|
||||||
@ -32,9 +32,9 @@ using Nemo
|
|||||||
|
|
||||||
@test RG == A
|
@test RG == A
|
||||||
@test RG == B
|
@test RG == B
|
||||||
end
|
end
|
||||||
|
|
||||||
@testset "GroupRing constructors FreeGroup" begin
|
@testset "GroupRing constructors FreeGroup" begin
|
||||||
using Groups
|
using Groups
|
||||||
F = FreeGroup(3)
|
F = FreeGroup(3)
|
||||||
S = generators(F)
|
S = generators(F)
|
||||||
@ -53,14 +53,19 @@ end
|
|||||||
B = GroupRing(F, basis, d, pm)
|
B = GroupRing(F, basis, d, pm)
|
||||||
@test A == B
|
@test A == B
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@testset "GroupRingElems constructors/basic manipulation" begin
|
@testset "GroupRingElems constructors/basic manipulation" begin
|
||||||
G = PermutationGroup(3)
|
G = PermutationGroup(3)
|
||||||
RG = GroupRing(G, full=true)
|
RG = GroupRing(G, full=true)
|
||||||
a = rand(6)
|
a = rand(6)
|
||||||
@test isa(GroupRingElem(a, RG), GroupRingElem)
|
@test isa(GroupRingElem(a, RG), GroupRingElem)
|
||||||
@test isa(RG(a), GroupRingElem)
|
@test isa(RG(a), GroupRingElem)
|
||||||
|
|
||||||
|
for g in elements(G)
|
||||||
|
@test isa(RG(g), GroupRingElem)
|
||||||
|
end
|
||||||
|
|
||||||
@test_throws String GroupRingElem([1,2,3], RG)
|
@test_throws String GroupRingElem([1,2,3], RG)
|
||||||
@test isa(RG(G([2,3,1])), GroupRingElem)
|
@test isa(RG(G([2,3,1])), GroupRingElem)
|
||||||
p = G([2,3,1])
|
p = G([2,3,1])
|
||||||
@ -70,9 +75,71 @@ end
|
|||||||
|
|
||||||
@test a.coeffs[5] == 1
|
@test a.coeffs[5] == 1
|
||||||
@test a[5] == 1
|
@test a[5] == 1
|
||||||
@test RG([0,0,0,0,1,0]) == a
|
|
||||||
@test a[p] == 1
|
@test a[p] == 1
|
||||||
@test a[G([1,2,3])] == 0
|
@test a[G([1,2,3])] == 0
|
||||||
|
|
||||||
@test string(a) == "1*[2, 3, 1]"
|
@test string(a) == "1*[2, 3, 1]"
|
||||||
|
|
||||||
|
@test RG([0,0,0,0,1,0]) == a
|
||||||
|
end
|
||||||
|
|
||||||
|
@testset "Arithmetic" begin
|
||||||
|
G = PermutationGroup(3)
|
||||||
|
RG = GroupRing(G, full=true)
|
||||||
|
a = RG(ones(Int, order(G)))
|
||||||
|
|
||||||
|
@testset "scalar operators" begin
|
||||||
|
|
||||||
|
@test isa(-a, GroupRingElem)
|
||||||
|
@test (-a).coeffs == -(a.coeffs)
|
||||||
|
|
||||||
|
@test isa(2*a, GroupRingElem)
|
||||||
|
@test eltype(2*a) == typeof(2)
|
||||||
|
@test (2*a).coeffs == 2.*(a.coeffs)
|
||||||
|
|
||||||
|
@test isa(2.0*a, GroupRingElem)
|
||||||
|
@test eltype(2.0*a) == typeof(2.0)
|
||||||
|
@test (2.0*a).coeffs == 2.0.*(a.coeffs)
|
||||||
|
|
||||||
|
@test isa(a/2, GroupRingElem)
|
||||||
|
@test eltype(a/2) == typeof(1/2)
|
||||||
|
@test (a/2).coeffs == 0.5*(a.coeffs)
|
||||||
|
|
||||||
|
@test isa(convert(Rational{Int}, a), GroupRingElem)
|
||||||
|
@test eltype(convert(Rational{Int}, a)) == Rational{Int}
|
||||||
|
@test convert(Rational{Int}, a).coeffs ==
|
||||||
|
convert(Vector{Rational{Int}}, a.coeffs)
|
||||||
|
|
||||||
|
b = convert(Rational{Int}, a)
|
||||||
|
|
||||||
|
@test isa(b//4, GroupRingElem)
|
||||||
|
@test eltype(b//4) == Rational{Int}
|
||||||
|
|
||||||
|
@test isa(b//big(4), GroupElem)
|
||||||
|
@test eltype(b//(big(4)//1)) == Rational{BigInt}
|
||||||
|
|
||||||
|
@test isa(a//1, GroupRingElem)
|
||||||
|
@test eltype(a//1) == Rational{Int}
|
||||||
|
@test_throws MethodError (1.0*a)//1
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
@testset "Additive structure" begin
|
||||||
|
@test RG(ones(Int, order(G))) == sum(RG(g) for g in elements(G))
|
||||||
|
a = RG(ones(Int, order(G)))
|
||||||
|
b = sum((-1)^parity(g)*RG(g) for g in elements(G))
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
@testset "Multiplicative structure" begin
|
||||||
|
for g in elements(G), h in elements(G)
|
||||||
|
a = RG(g)
|
||||||
|
b = RG(h)
|
||||||
|
@test a*b == RG(g*h)
|
||||||
|
@test (a+b)*(a+b) == a*a + a*b + b*a + b*b
|
||||||
|
@test
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user