Skip to content

Commit b455f76

Browse files
committed
Add tests
1 parent d8ac9fb commit b455f76

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/testutils.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ function pdtest_basics(C::AbstractPDMat, Cmat::Matrix, d::Int, verbose::Int)
7878

7979
_pdt(verbose, "eltype")
8080
@test eltype(C) == eltype(Cmat)
81-
# @test eltype(typeof(C)) == eltype(typeof(Cmat))
81+
# @test eltype(typeof(C)) == eltype(typeof(Cmat))
82+
83+
_pdt(verbose, "index")
84+
@test all(C[i] == Cmat[i] for i in 1:(d^2))
85+
@test all(C[i, j] == Cmat[i, j] for j in 1:d, i in 1:d)
8286
end
8387

8488

@@ -180,9 +184,15 @@ function pdtest_mul(C::AbstractPDMat, Cmat::Matrix, X::Matrix, verbose::Int)
180184
_pdt(verbose, "multiply")
181185
@test C * X Cmat * X
182186

187+
y = similar(C * X, size(C, 1))
188+
ymat = similar(Cmat * X, size(Cmat, 1))
183189
for i = 1:size(X,2)
184190
xi = vec(copy(X[:,i]))
185191
@test C * xi Cmat * xi
192+
193+
mul!(y, C, xi)
194+
mul!(ymat, Cmat, xi)
195+
@test y ymat
186196
end
187197
end
188198

0 commit comments

Comments
 (0)