Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions test/matfile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ using MATLAB
using Base.Test

# test MMAT file I/O
fn = "$(tempname()).mat"

a32 = Int32[1 2 3; 4 5 6]
a64 = Int64[1 2 3; 4 5 6]
Expand All @@ -17,9 +18,9 @@ end

ss = S[S(1.0, true, [1., 2.]), S(2.0, false, [3., 4.])]

write_matfile("test.mat"; a32=a32, a64=a64, b=b, c=c, d=d, ss=mxstructarray(ss))
write_matfile(fn; a32=a32, a64=a64, b=b, c=c, d=d, ss=mxstructarray(ss))

r = read_matfile("test.mat")
r = read_matfile(fn)
@test isa(r, Dict{String, MxArray})
@test length(r) == 6

Expand Down Expand Up @@ -49,6 +50,8 @@ gc() # make sure that ra, rb, rc, rd remain valid
@test jvector(get_field(rss, 2, "z")) == ss[2].z

# segfault on deleted references
s = MatFile("test.mat", "r")
s = MatFile(fn)
close(s)
@test_throws UndefRefError close(s)

rm(fn)