-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from kalmarek/codecov
Increasing code coverage
- Loading branch information
Showing
6 changed files
with
279 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
using Pkg | ||
Pkg.add(PackageSpec(url="https://github.com/kalmarek/PermutationGroups.jl")) | ||
using PermutationGroups | ||
|
||
function generic_tests_ccmatrix(C) | ||
r = length(C) | ||
for i = 1:r | ||
ccm = SymbolicWedderburn.CCMatrix(C, i) | ||
l = length(C[i]) | ||
@test all([sum(ccm[:,j]) == l for j = 1:r]) | ||
end | ||
ccm1 = SymbolicWedderburn.CCMatrix(C, 1) | ||
@test all([isone(ccm1[i,i]) for i = 1:r]) | ||
end | ||
|
||
@testset "ConjClassMatrix" begin | ||
@testset "example: Symmetric group (4)" begin | ||
G = SymbolicWedderburn.AbstractAlgebra.SymmetricGroup(4) | ||
C = conjugacy_classes(G) | ||
generic_tests_ccmatrix(C) | ||
@test SymbolicWedderburn.CCMatrix(C, 2) == [0 1 0 0 0; | ||
6 0 3 0 2; | ||
0 4 0 4 0; | ||
0 0 3 0 4; | ||
0 1 0 2 0] | ||
@test SymbolicWedderburn.CCMatrix(C, 3) == [0 0 1 0 0; | ||
0 4 0 4 0; | ||
8 0 4 0 8; | ||
0 4 0 4 0; | ||
0 0 3 0 0] | ||
@test SymbolicWedderburn.CCMatrix(C, 4) == [0 0 0 1 0; | ||
0 0 3 0 4; | ||
0 4 0 4 0; | ||
6 0 3 0 2; | ||
0 2 0 1 0] | ||
@test SymbolicWedderburn.CCMatrix(C, 5) == [0 0 0 0 1; | ||
0 1 0 2 0; | ||
0 0 3 0 0; | ||
0 2 0 1 0; | ||
3 0 0 0 2] | ||
end | ||
@testset "example: Alternating group (4)" begin | ||
a = PermutationGroups.perm"(1,2,3)(4)" | ||
b = PermutationGroups.perm"(1,2,4)" | ||
G = PermutationGroups.PermGroup([a,b]) | ||
C = [ | ||
Orbit([a,b], one(G)), | ||
Orbit([a,b], PermutationGroups.perm"(1,2)(3,4)"), | ||
Orbit([a,b], PermutationGroups.perm"(1,2,3)(4)"), | ||
Orbit([a,b], PermutationGroups.perm"(1,3,2)(4)"), | ||
] | ||
|
||
generic_tests_ccmatrix(C) | ||
@test SymbolicWedderburn.CCMatrix(C, 1) == [1 0 0 0 | ||
0 1 0 0 | ||
0 0 1 0 | ||
0 0 0 1] | ||
@test SymbolicWedderburn.CCMatrix(C, 2) == [0 1 0 0 | ||
3 2 0 0 | ||
0 0 3 0 | ||
0 0 0 3] | ||
@test SymbolicWedderburn.CCMatrix(C, 3) == [0 0 1 0 | ||
0 0 3 0 | ||
0 0 0 4 | ||
4 4 0 0] | ||
@test SymbolicWedderburn.CCMatrix(C, 4) == [0 0 0 1 | ||
0 0 0 3 | ||
4 4 0 0 | ||
0 0 4 0] | ||
end | ||
|
||
@testset "example: C₅ ⋊ C₄" begin | ||
S = [PermutationGroups.perm"(1,2,4,5,3)", PermutationGroups.perm"(2,5,3,4)"] | ||
G = PermGroup(S); | ||
|
||
ccG = [ | ||
Orbit(S, one(G)), | ||
Orbit(S, PermutationGroups.perm"(2,3)(4,5)"), | ||
Orbit(S, PermutationGroups.perm"(2,4,3,5)"), | ||
Orbit(S, PermutationGroups.perm"(2,5,3,4)"), | ||
Orbit(S, PermutationGroups.perm"(1,2,4,5,3)"), | ||
] | ||
# the order of cclasses is taken from GAP | ||
|
||
@assert sum(length, ccG) == PermutationGroups.order(G) | ||
|
||
@test SymbolicWedderburn.CCMatrix(ccG, 1) == | ||
[ 1 0 0 0 0 | ||
0 1 0 0 0 | ||
0 0 1 0 0 | ||
0 0 0 1 0 | ||
0 0 0 0 1 ] | ||
@test SymbolicWedderburn.CCMatrix(ccG, 2) == | ||
[ 0 1 0 0 0 | ||
5 0 0 0 5 | ||
0 0 0 5 0 | ||
0 0 5 0 0 | ||
0 4 0 0 0 ] | ||
@test SymbolicWedderburn.CCMatrix(ccG, 3) == | ||
[ 0 0 1 0 0 | ||
0 0 0 5 0 | ||
0 5 0 0 0 | ||
5 0 0 0 5 | ||
0 0 4 0 0 ] | ||
@test SymbolicWedderburn.CCMatrix(ccG, 4) == | ||
[ 0 0 0 1 0 | ||
0 0 5 0 0 | ||
5 0 0 0 5 | ||
0 5 0 0 0 | ||
0 0 0 4 0 ] | ||
@test SymbolicWedderburn.CCMatrix(ccG, 5) == | ||
[ 0 0 0 0 1 | ||
0 4 0 0 0 | ||
0 0 4 0 0 | ||
0 0 0 4 0 | ||
4 0 0 0 3 ] | ||
|
||
generic_tests_ccmatrix(ccG) | ||
generic_tests_ccmatrix(conjugacy_classes(G)) # might be in different order | ||
end | ||
|
||
@testset "random subgroups of SymetricGroup(N)" begin | ||
for i in 2:6 | ||
G = SymbolicWedderburn.AbstractAlgebra.SymmetricGroup(i) | ||
for _ in 1:5 | ||
PG = PermutationGroups.PermGroup(rand(G, 2)) | ||
generic_tests_ccmatrix(SymbolicWedderburn.conjugacy_classes(PG)) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,30 @@ | ||
function _dixon_prime(n::Int) | ||
F = SymbolicWedderburn.Primes.factor(n) | ||
e = lcm(collect(keys(F))) | ||
p = SymbolicWedderburn.dixon_prime(n, e) | ||
@test mod(p, e) == 1 | ||
@test p > 2*floor(sqrt(n)) | ||
end | ||
|
||
|
||
@testset "DixonPrime" begin | ||
@testset "DixonPrimeNumbers" begin | ||
@testset "examples" begin | ||
@test SymbolicWedderburn.dixon_prime(20, 20) == 41 | ||
end | ||
|
||
@testset "random" begin | ||
for i in abs.(rand(2:1000, 10)) | ||
_dixon_prime(i) | ||
end | ||
end | ||
end | ||
|
||
@testset "DixonPrimeGroups" begin | ||
G = SymbolicWedderburn.AbstractAlgebra.SymmetricGroup(4) | ||
ccG = SymbolicWedderburn.PermutationGroups.conjugacy_classes(G) | ||
@test exponent(G) == 12 | ||
@test exponent(ccG) == 12 | ||
|
||
@test SymbolicWedderburn.dixon_prime(G) == SymbolicWedderburn.dixon_prime(ccG) | ||
@test SymbolicWedderburn.dixon_prime(20, 20) == 41 | ||
end | ||
|
||
@testset "DixonPrimeGroups" begin | ||
end | ||
end | ||
@warn "This section needs more tests!" |
Oops, something went wrong.