Skip to content

Commit f0aebf5

Browse files
committed
Test shape checks for sparse elementwise binary operations equivalent to map.
1 parent 70c4b5d commit f0aebf5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/sparse/sparse.jl

+8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ do33 = ones(3)
2424
# check sparse binary op
2525
@test all(Array(se33 + convert(SparseMatrixCSC{Float32,Int32}, se33)) == 2*eye(3))
2626
@test all(Array(se33 * convert(SparseMatrixCSC{Float32,Int32}, se33)) == eye(3))
27+
# Test shape checks for sparse elementwise binary operations equivalent to map
28+
@test_throws DimensionMismatch (+)(speye(3), speye(4))
29+
@test_throws DimensionMismatch (-)(speye(3), speye(4))
30+
@test_throws DimensionMismatch min(speye(3), speye(4))
31+
@test_throws DimensionMismatch max(speye(3), speye(4))
32+
@test_throws DimensionMismatch (&)(speye(Bool, 3), speye(Bool, 4))
33+
@test_throws DimensionMismatch (|)(speye(Bool, 3), speye(Bool, 4))
34+
@test_throws DimensionMismatch xor(speye(Bool, 3), speye(Bool, 4))
2735

2836
# check horiz concatenation
2937
@test all([se33 se33] == sparse([1, 2, 3, 1, 2, 3], [1, 2, 3, 4, 5, 6], ones(6)))

0 commit comments

Comments
 (0)