1
0
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:
kalmar 2017-05-18 17:58:31 +02:00
parent ca3ec95ea2
commit 45fc421da7

View File

@ -70,17 +70,28 @@ using Nemo
@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])
a = RG(p) a = RG(p)
@test length(a) == 6 @test length(a) == 1
@test isa(a.coeffs, SparseVector) @test isa(a.coeffs, SparseVector)
@test a.coeffs[5] == 1 @test a.coeffs[5] == 1
@test a[5] == 1 @test a[5] == 1
@test a[p] == 1 @test a[p] == 1
@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 @test RG([0,0,0,0,1,0]) == a
s = G([1,2,3])
@test a[s] == 0
a[s] = 2
@test a.coeffs[1] == 2
@test a[1] == 2
@test a[s] == 2
@test string(a) == "2*[1, 2, 3] + 1*[2, 3, 1]"
@test length(a) == 2
end end
@testset "Arithmetic" begin @testset "Arithmetic" begin
@ -128,7 +139,7 @@ using Nemo
@test RG(ones(Int, order(G))) == sum(RG(g) for g in elements(G)) @test RG(ones(Int, order(G))) == sum(RG(g) for g in elements(G))
a = RG(ones(Int, order(G))) a = RG(ones(Int, order(G)))
b = sum((-1)^parity(g)*RG(g) for g in elements(G)) b = sum((-1)^parity(g)*RG(g) for g in elements(G))
@test 1/2*(a+b).coeffs == [1.0, 0.0, 1.0, 0.0, 1.0, 0.0]
end end
@testset "Multiplicative structure" begin @testset "Multiplicative structure" begin
@ -137,8 +148,20 @@ using Nemo
b = RG(h) b = RG(h)
@test a*b == RG(g*h) @test a*b == RG(g*h)
@test (a+b)*(a+b) == a*a + a*b + b*a + b*b @test (a+b)*(a+b) == a*a + a*b + b*a + b*b
@test
end end
for g in elements(G)
@test GroupRings.star(RG(g)) == RG(inv(g))
@test (one(RG)-RG(g))*GroupRings.star(one(RG)-RG(g)) ==
2*one(RG) - RG(g) - RG(inv(g))
@test GroupRings.augmentation((one(RG)-RG(g))) == 0
end
z = sum((one(RG)-RG(g))*GroupRings.star(one(RG)-RG(g)) for g in elements(G))
@test GroupRings.augmentation(z) == 0
@test rationalize(Int, z) == convert(Rational{Int}, z)
end end
end end