Skip to content

Commit f3033dc

Browse files
committed
remove depedency on DelimitedFiles
1 parent e96eee4 commit f3033dc

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Project.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name = "SparseArrays"
22
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
33

44
[deps]
5-
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
65
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
76
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
87
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
@@ -16,4 +15,4 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1615
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1716

1817
[targets]
19-
test = ["Dates", "Test", "Printf", "InteractiveUtils"]
18+
test = ["Dates", "InteractiveUtils", "Printf", "Test"]

test/cholmod.jl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module CHOLMODTests
44

55
using Test
66
using SparseArrays.CHOLMOD
7-
using DelimitedFiles
87
using Random
98
using Serialization
109
using LinearAlgebra:
@@ -216,20 +215,29 @@ end
216215
end
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

Comments
 (0)