@@ -4,7 +4,6 @@ module CHOLMODTests
44
55using Test
66using SparseArrays. CHOLMOD
7- using DelimitedFiles
87using Random
98using Serialization
109using LinearAlgebra:
@@ -216,20 +215,29 @@ end
216215end
217216
218217@testset " test Sparse constructor and read_sparse" begin
218+ # avoid dependenting on delimited files
219+ function writedlm (fn, title= " " , xs... )
220+ open (fn, " w" ) do file
221+ println (file, title)
222+ for i in xs
223+ println (file, i)
224+ end
225+ end
226+ end
219227 mktempdir () do temp_dir
220228 testfile = joinpath (temp_dir, " tmp.mtx" )
221229
222- writedlm (testfile, [ " %%MatrixMarket matrix coordinate real symmetric" ," 3 3 4" ," 1 1 1" ," 2 2 1" ," 3 2 0.5" ," 3 3 1" ] )
230+ writedlm (testfile, " %%MatrixMarket matrix coordinate real symmetric" ," 3 3 4" ," 1 1 1" ," 2 2 1" ," 3 2 0.5" ," 3 3 1" )
223231 @test sparse (CHOLMOD. Sparse (testfile)) == [1 0 0 ;0 1 0.5 ;0 0.5 1 ]
224232 rm (testfile)
225233
226- writedlm (testfile, [ " %%MatrixMarket matrix coordinate complex Hermitian" ,
227- " 3 3 4" ," 1 1 1.0 0.0" ," 2 2 1.0 0.0" ," 3 2 0.5 0.5" ," 3 3 1.0 0.0" ] )
234+ writedlm (testfile, " %%MatrixMarket matrix coordinate complex Hermitian" ,
235+ " 3 3 4" ," 1 1 1.0 0.0" ," 2 2 1.0 0.0" ," 3 2 0.5 0.5" ," 3 3 1.0 0.0" )
228236 @test sparse (CHOLMOD. Sparse (testfile)) == [1 0 0 ;0 1 0.5 - 0.5im ;0 0.5 + 0.5im 1 ]
229237 rm (testfile)
230238
231239 # this also tests that the error message is correctly retrieved from the library
232- writedlm (testfile, [ " %%MatrixMarket matrix coordinate real symmetric" ," %3 3 4" ," 1 1 1" ," 2 2 1" ," 3 2 0.5" ," 3 3 1" ] )
240+ writedlm (testfile, " %%MatrixMarket matrix coordinate real symmetric" ," %3 3 4" ," 1 1 1" ," 2 2 1" ," 3 2 0.5" ," 3 3 1" )
233241 @test_throws CHOLMOD. CHOLMODException (" indices out of range" ) sparse (CHOLMOD. Sparse (testfile))
234242 rm (testfile)
235243 end
0 commit comments