diff --git a/Project.toml b/Project.toml index d6743ec9..46911515 100644 --- a/Project.toml +++ b/Project.toml @@ -2,7 +2,6 @@ name = "SparseArrays" uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [deps] -DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" @@ -16,4 +15,4 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Dates", "Test", "Printf", "InteractiveUtils"] +test = ["Dates", "InteractiveUtils", "Printf", "Test"] diff --git a/test/cholmod.jl b/test/cholmod.jl index 6614bc74..d08c67ef 100644 --- a/test/cholmod.jl +++ b/test/cholmod.jl @@ -4,7 +4,6 @@ module CHOLMODTests using Test using SparseArrays.CHOLMOD -using DelimitedFiles using Random using Serialization using LinearAlgebra: @@ -216,20 +215,29 @@ end end @testset "test Sparse constructor and read_sparse" begin + # avoid dependenting on delimited files + function writedlm(fn, title="", xs...) + open(fn, "w") do file + println(file, title) + for i in xs + println(file, i) + end + end + end mktempdir() do temp_dir testfile = joinpath(temp_dir, "tmp.mtx") - writedlm(testfile, ["%%MatrixMarket matrix coordinate real symmetric","3 3 4","1 1 1","2 2 1","3 2 0.5","3 3 1"]) + writedlm(testfile, "%%MatrixMarket matrix coordinate real symmetric","3 3 4","1 1 1","2 2 1","3 2 0.5","3 3 1") @test sparse(CHOLMOD.Sparse(testfile)) == [1 0 0;0 1 0.5;0 0.5 1] rm(testfile) - writedlm(testfile, ["%%MatrixMarket matrix coordinate complex Hermitian", - "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"]) + writedlm(testfile, "%%MatrixMarket matrix coordinate complex Hermitian", + "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") @test sparse(CHOLMOD.Sparse(testfile)) == [1 0 0;0 1 0.5-0.5im;0 0.5+0.5im 1] rm(testfile) # this also tests that the error message is correctly retrieved from the library - writedlm(testfile, ["%%MatrixMarket matrix coordinate real symmetric","%3 3 4","1 1 1","2 2 1","3 2 0.5","3 3 1"]) + writedlm(testfile, "%%MatrixMarket matrix coordinate real symmetric","%3 3 4","1 1 1","2 2 1","3 2 0.5","3 3 1") @test_throws CHOLMOD.CHOLMODException("indices out of range") sparse(CHOLMOD.Sparse(testfile)) rm(testfile) end