Skip to content

Commit 7e6ef91

Browse files
kshyattdkarrasch
authored andcommitted
Two little tests for sparse arrays (#34337)
1 parent edc1b7d commit 7e6ef91

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

stdlib/SparseArrays/test/sparse.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ end
8282
SparseMatrixCSC(6, 6, big.([1,2,4,7,8,9,9]), big.([1,1,2,1,2,3,4,5]), big.([1,2,3,4,5,6,7,8])))
8383
@test sparse(Any[1,2,3], Any[1,2,3], Any[1,1,1]) == sparse([1,2,3], [1,2,3], [1,1,1])
8484
@test sparse(Any[1,2,3], Any[1,2,3], Any[1,1,1], 5, 4) == sparse([1,2,3], [1,2,3], [1,1,1], 5, 4)
85+
# with combine
86+
@test sparse([1, 1, 2, 2, 2], [1, 2, 1, 2, 2], 1.0, 2, 2, +) == sparse([1, 1, 2, 2], [1, 2, 1, 2], [1.0, 1.0, 1.0, 2.0], 2, 2)
87+
@test sparse([1, 1, 2, 2, 2], [1, 2, 1, 2, 2], -1.0, 2, 2, *) == sparse([1, 1, 2, 2], [1, 2, 1, 2], [-1.0, -1.0, -1.0, 1.0], 2, 2)
8588
end
8689

8790
@testset "SparseMatrixCSC construction from UniformScaling" begin
@@ -2518,6 +2521,7 @@ end
25182521
@test permutedims(S, (2,1)) == SP
25192522
@test permutedims(S, (1,2)) == S
25202523
@test permutedims(S, (1,2)) !== S
2524+
@test_throws ArgumentError permutedims(S, (1,3))
25212525
MC = reshape([[(1+im) 2; 3 4], [9 10; 11 12], [(5 + 2im) 6; 7 8], [13 14; 15 16]], (2,2))
25222526
SC = sparse(MC)
25232527
@test isa(adjoint(SC), Adjoint)

0 commit comments

Comments
 (0)