Skip to content

Commit 324253a

Browse files
authored
add tests
1 parent 937b222 commit 324253a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/ArrayInterfaceCore/test/runtests.jl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,22 @@ using Test
1111
using Aqua
1212
Aqua.test_all(ArrayInterfaceCore)
1313

14-
@test zeromatrix(rand(4,4,4)) == zeros(4*4*4,4*4*4)
14+
@testset "zeromatrix and unsafematrix" begin
15+
for T in (Int, Float32, Float64)
16+
for (vectype, mattype) in ((Vector{T}, Matrix{T}), (SparseVector{T}, SparseMatrix{T}))
17+
v = vecttype(rand(4))
18+
um = undefmatrix(v)
19+
@test size(um) == (length(v),length(v))
20+
@test typeof(um) == mattype
21+
@test zeromatrix(v) == zeros(T,length(v),length(v))
22+
end
23+
v = rand(T,4,4,4)
24+
um = undefmatrix(v)
25+
@test size(um) == (length(v),length(v))
26+
@test typeof(um) == Matrix{T}
27+
@test zeromatrix(v) == zeros(T,4*4*4,4*4*4)
28+
end
29+
end
1530

1631
@testset "matrix colors" begin
1732
@test ArrayInterfaceCore.fast_matrix_colors(1) == false

0 commit comments

Comments
 (0)