Skip to content

Commit 315907c

Browse files
committed
use at-testset-for with RINGS
1 parent d879afd commit 315907c

File tree

1 file changed

+14
-85
lines changed

1 file changed

+14
-85
lines changed

test/generic/Matrix-test.jl

Lines changed: 14 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -942,92 +942,21 @@ end
942942

943943
@test A == inv(P)*(P*A)
944944

945-
# Exact ring
946-
R = ZZ
947-
S = MatrixSpace(R, rand(1:9), rand(0:9))
948-
949-
A = rand(S, -1000:1000)
950-
T = PermutationGroup(nrows(A))
951-
P = rand(T)
952-
Q = inv(P)
953-
954-
PA = P*A
955-
@test PA == reduce(vcat, [A[Q[i], :] for i in 1:nrows(A)])
956-
if VERSION >= v"1.3"
957-
@test PA == reduce(vcat, A[Q[i], :] for i in 1:nrows(A))
945+
@testset "$name" for (name, (R, randparams)) in RINGS
946+
S = MatrixSpace(R, rand(1:9), rand(0:9))
947+
A = rand(S, randparams...)
948+
T = PermutationGroup(nrows(A))
949+
P = rand(T)
950+
Q = inv(P)
951+
952+
PA = P*A
953+
@test PA == reduce(vcat, [A[Q[i], :] for i in 1:nrows(A)])
954+
if VERSION >= v"1.3"
955+
@test PA == reduce(vcat, A[Q[i], :] for i in 1:nrows(A))
956+
end
957+
@test PA == S(reduce(vcat, A.entries[Q[i], :] for i in 1:nrows(A)))
958+
@test A == Q*(P*A)
958959
end
959-
@test PA == S(reduce(vcat, A.entries[Q[i], :] for i in 1:nrows(A)))
960-
@test A == Q*(P*A)
961-
962-
# Exact field
963-
R = GF(7)
964-
S = MatrixSpace(R, rand(1:9), rand(0:9))
965-
966-
A = rand(S)
967-
T = PermutationGroup(nrows(A))
968-
P = rand(T)
969-
Q = inv(P)
970-
971-
PA = P*A
972-
@test PA == reduce(vcat, [A[Q[i], :] for i in 1:nrows(A)])
973-
@test PA == S(reduce(vcat, A.entries[Q[i], :] for i in 1:nrows(A)))
974-
@test A == Q*(P*A)
975-
976-
# Inexact ring
977-
R = RealField["t"][1]
978-
S = MatrixSpace(R, rand(1:9), rand(0:9))
979-
980-
A = rand(S, 0:200, -1000:1000)
981-
T = PermutationGroup(nrows(A))
982-
P = rand(T)
983-
Q = inv(P)
984-
985-
PA = P*A
986-
@test PA == reduce(vcat, [A[Q[i], :] for i in 1:nrows(A)])
987-
@test PA == S(reduce(vcat, A.entries[Q[i], :] for i in 1:nrows(A)))
988-
@test A == Q*(P*A)
989-
990-
# Inexact field
991-
R = RealField
992-
S = MatrixSpace(R, rand(1:9), rand(0:9))
993-
994-
A = rand(S, -1000:1000)
995-
T = PermutationGroup(nrows(A))
996-
P = rand(T)
997-
Q = inv(P)
998-
999-
PA = P*A
1000-
@test PA == reduce(vcat, [A[Q[i], :] for i in 1:nrows(A)])
1001-
@test PA == S(reduce(vcat, A.entries[Q[i], :] for i in 1:nrows(A)))
1002-
@test A == Q*(P*A)
1003-
1004-
# Non-integral domain
1005-
R = ResidueRing(ZZ, 6)
1006-
S = MatrixSpace(R, rand(1:9), rand(0:9))
1007-
1008-
A = rand(S, 0:5)
1009-
T = PermutationGroup(nrows(A))
1010-
P = rand(T)
1011-
Q = inv(P)
1012-
1013-
PA = P*A
1014-
@test PA == reduce(vcat, [A[Q[i], :] for i in 1:nrows(A)])
1015-
@test PA == S(reduce(vcat, A.entries[Q[i], :] for i in 1:nrows(A)))
1016-
@test A == Q*(P*A)
1017-
1018-
# Fraction field
1019-
R = QQ
1020-
S = MatrixSpace(R, rand(1:9), rand(0:9))
1021-
1022-
A = rand(S, -1000:1000)
1023-
T = PermutationGroup(nrows(A))
1024-
P = rand(T)
1025-
Q = inv(P)
1026-
1027-
PA = P*A
1028-
@test PA == reduce(vcat, [A[Q[i], :] for i in 1:nrows(A)])
1029-
@test PA == S(reduce(vcat, A.entries[Q[i], :] for i in 1:nrows(A)))
1030-
@test A == Q*(P*A)
1031960
end
1032961

1033962
@testset "Generic.Mat.comparison..." begin

0 commit comments

Comments
 (0)