Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit 26dee6f

Browse files
committed
Cleanup tests
1 parent 99e33e2 commit 26dee6f

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

test/bc_coeff_compositions.jl

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,29 @@ end
8686
u = rand(22)
8787
@test (L + L2) * u convert(AbstractMatrix,L + L2) * u (BandedMatrix(L) + BandedMatrix(L2)) * u
8888

89-
# Test concretization
90-
@test Array(A)[1] (Array(L)*Array(Q,N)[1], Array(L)*Array(Q,N)[2])[1]
91-
@test Array(A)[2] (Array(L)*Array(Q,N)[1], Array(L)*Array(Q,N)[2])[2]
92-
@test SparseMatrixCSC(A)[1] (SparseMatrixCSC(L)*SparseMatrixCSC(Q,N)[1], SparseMatrixCSC(L)*SparseMatrixCSC(Q,N)[2])[1]
93-
@test SparseMatrixCSC(A)[2] (SparseMatrixCSC(L)*SparseMatrixCSC(Q,N)[1], SparseMatrixCSC(L)*SparseMatrixCSC(Q,N)[2])[2]
94-
@test sparse(A)[1] (sparse(L)*sparse(Q,N)[1], sparse(L)*sparse(Q,N)[2])[1]
95-
@test sparse(A)[2] (sparse(L)*sparse(Q,N)[1], sparse(L)*sparse(Q,N)[2])[2]
96-
@test BandedMatrix(A)[1] (BandedMatrix(L)*BandedMatrix(Q,N)[1], BandedMatrix(L)*BandedMatrix(Q,N)[2])[1]
97-
@test BandedMatrix(A)[2] (BandedMatrix(L)*BandedMatrix(Q,N)[1], BandedMatrix(L)*BandedMatrix(Q,N)[2])[2]
98-
99-
# Test that concretization works with multiplication
100-
u = rand(20)
101-
@test Array(A)[1]*u + Array(A)[2] L*(Q*u) A*u
102-
@test sparse(A)[1]*u + sparse(A)[2] L*(Q*u) A*u
89+
@testset "$mode concretization" for (mode,Mat) in [("Dense", Array),
90+
("Sparse", SparseMatrixCSC),
91+
("Best sparse", sparse),
92+
("BandedMatrix", BandedMatrix)]
93+
Am,Au = Mat(A)
94+
Lm = Mat(L)
95+
Qm,Qu = Mat(Q,N)
96+
97+
@test Am Lm*Qm
98+
@test Au Lm*Qu
99+
end
100+
101+
@testset "$mode concrete multiplication" for (mode,Mat) in [("Dense", Array),
102+
("Sparse", SparseMatrixCSC),
103+
("Best sparse", sparse),
104+
("BandedMatrix", BandedMatrix)]
105+
u = rand(20)
106+
Am,Au = Mat(A)
107+
Lm = Mat(L)
108+
Qm,Qu = Mat(Q,N)
109+
110+
@test Am*u + Au L*(Q*u) A*u
111+
end
103112
end
104113

105114
@testset "Test Left Division L2 (second order)" begin

0 commit comments

Comments
 (0)