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

Commit e587bb0

Browse files
committed
Cleanup tests
1 parent 99e33e2 commit e587bb0

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

Project.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ ModelingToolkit = "0.8.0"
2222
julia = "1"
2323

2424
[extras]
25+
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
2526
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
2627
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
2728
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
@@ -30,4 +31,4 @@ SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
3031
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3132

3233
[targets]
33-
test = ["FillArrays", "OrdinaryDiffEq", "Random", "SafeTestsets", "SpecialFunctions", "Test"]
34+
test = ["Compat", "FillArrays", "OrdinaryDiffEq", "Random", "SafeTestsets", "SpecialFunctions", "Test"]

test/bc_coeff_compositions.jl

+23-14
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)