Skip to content

Commit 22b6fc9

Browse files
authored
add dimension checking tests
1 parent 46489e1 commit 22b6fc9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/linearmaps.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ using Test, LinearMaps, LinearAlgebra, SparseArrays, BenchmarkTools
4747
@test @inferred mul!(copy(W), M, V) AV
4848
@test typeof(M * V) <: LinearMap
4949
end
50+
51+
@testset "dimension checking" begin
52+
@test_throws DimensionMismatch M * similar(v, length(v) + 1)
53+
@test_throws DimensionMismatch mul!(similar(w, length(w) + 1), M, v)
54+
@test_throws DimensionMismatch similar(w, length(w) + 1)' * M
55+
@test_throws DimensionMismatch mul!(copy(v)', similar(w, length(w) + 1)', M)
56+
@test_throws DimensionMismatch mul!(similar(W, size(W).+(0,1)), M, V)
57+
@test_throws DimensionMismatch mul!(copy(W), M, similar(V, size(V).+(0,1)))
58+
end
5059
end
5160

5261
# new type

0 commit comments

Comments
 (0)