Skip to content

Commit fdbaa68

Browse files
committed
2 parents bd318ff + 3496461 commit fdbaa68

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

.DS_Store

0 Bytes
Binary file not shown.

experiment/test.jl

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using JLD2
2+
# using CodecZlib
3+
4+
mutable struct A
5+
m::Matrix{Float64}
6+
n::Matrix{Float64}
7+
end
8+
9+
N = 100
10+
a = A(rand(N, N), rand(N, N))
11+
save("test2.jld2", Dict("a" => a), compress = true)

test/Project.toml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[deps]
2+
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
3+
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
4+
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
5+
Lehmann = "95bf888a-8996-4655-9f35-1c0506bdfefe"
6+
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
7+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

test/dlr.jl

+15
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,18 @@ end
247247
@test dlr_load.Λ dlr.Λ
248248
rm(file)
249249
end
250+
251+
@testset "JLD2 IO" begin
252+
dlr = DLRGrid(isFermi = true, beta = 10.0)
253+
save("test.jld2", Dict("dlr" => dlr), compress = true)
254+
dlr_new = load("test.jld2")["dlr"]
255+
println(dlr_new)
256+
@test dlr.isFermi == dlr_new.isFermi
257+
@test dlr.Euv dlr_new.Euv
258+
@test dlr.β dlr_new.β
259+
@test dlr.τ dlr_new.τ
260+
@test dlr.n dlr_new.n
261+
@test dlr.ωn dlr_new.ωn
262+
@test dlr.symmetry == dlr_new.symmetry
263+
rm("test.jld2")
264+
end

test/runtests.jl

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ using Base: BufferStream
22
using Lehmann
33
using Test
44
using Printf
5+
using JLD2
6+
using CodecZlib #it is important to import CodecZlib explicitly. Otherwise, the code may try to dynamically load this package, and sometimes leads to error
57

68
include("spectral.jl")
79
include("dlr.jl")

0 commit comments

Comments
 (0)