Skip to content

Commit

Permalink
fix FileIO depwarn
Browse files Browse the repository at this point in the history
johnnychen94 committed Apr 16, 2021
1 parent 8a6f796 commit fd4c114
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ using Test
for fmt in (format"PBMBinary", format"PBMText")
for T in (Bool, Int)
ac = convert(Array{T}, af)
fn = File(fmt, joinpath(workdir, "20by3.pbm"))
fn = File{fmt}(joinpath(workdir, "20by3.pbm"))
Netpbm.save(fn, ac)
b = Netpbm.load(fn)
@test b == ac
@@ -26,7 +26,7 @@ using Test
for T in (N0f8, N4f12, N0f16,
Gray{N0f8}, Gray{N4f12}, Gray{N0f16})
ac = convert(Array{T}, af)
fn = File(fmt, joinpath(workdir, "3by2.pgm"))
fn = File{fmt}(joinpath(workdir, "3by2.pgm"))
Netpbm.save(fn, ac)
b = Netpbm.load(fn)
@test b == ac
@@ -36,7 +36,7 @@ using Test
for fmt in (format"PGMBinary", format"PGMText")
for T in (Float32, Float64, Gray{Float32}, Gray{Float64})
ac = convert(Array{T}, af)
fn = File(fmt, joinpath(workdir, "3by2.pgm"))
fn = File{fmt}(joinpath(workdir, "3by2.pgm"))
Netpbm.save(fn, ac)
b = Netpbm.load(fn)
@test b == a8
@@ -52,7 +52,7 @@ using Test
for fmt in (format"PPMBinary", format"PPMText")
for T in (RGB{N0f8}, RGB{N4f12}, RGB{N0f16})
ac = convert(Array{T}, af)
fn = File(fmt, joinpath(workdir, "3by2.ppm"))
fn = File{fmt}(joinpath(workdir, "3by2.ppm"))
Netpbm.save(fn, ac)
b = Netpbm.load(fn)
@test b == ac
@@ -62,7 +62,7 @@ using Test
for fmt in (format"PPMBinary", format"PPMText")
for T in (RGB{Float32}, RGB{Float64}, HSV{Float64})
ac = convert(Array{T}, af)
fn = File(fmt, joinpath(workdir, "3by2.ppm"))
fn = File{fmt}(joinpath(workdir, "3by2.ppm"))
Netpbm.save(fn, ac)
b = Netpbm.load(fn)
@test b == a8
@@ -82,7 +82,7 @@ using Test
cmaprgb[1:128] = [(1-x)*b + x*w for x in f]
cmaprgb[129:end] = [(1-x)*w + x*r for x in f[2:end]]
img = IndirectArray(dataint, cmaprgb)
fn = File(format"PPMBinary", joinpath(workdir,"cmap.ppm"))
fn = File{format"PPMBinary"}(joinpath(workdir,"cmap.ppm"))
Netpbm.save(fn, img)
imgr = Netpbm.load(fn)
@test imgr == img
@@ -103,7 +103,7 @@ using Test
@testset "Clamping" begin
A = rand(2,3)
A[1,1] = -0.4
fn = File(format"PGMBinary", joinpath(workdir, "2by3.pgm"))
fn = File{format"PGMBinary"}(joinpath(workdir, "2by3.pgm"))
@test_throws InexactError Netpbm.save(fn, A)
Netpbm.save(fn, A, mapf=clamp01nan)
B = Netpbm.load(fn)
@@ -113,19 +113,19 @@ using Test

@testset "OffsetArrays" begin
ac = OffsetArray(rand(Bool, 3, 20), -1:1, 0:19)
fn = File(format"PBMText", joinpath(workdir, "20by3.pbm"))
fn = File{format"PBMText"}(joinpath(workdir, "20by3.pbm"))
Netpbm.save(fn, ac)
b = Netpbm.load(fn)
@test b[1:end] == ac[1:end]

ac = OffsetArray(rand(Gray{N0f8}, 2, 3), 0:1, -1:1)
fn = File(format"PGMText", joinpath(workdir, "3by2.pgm"))
fn = File{format"PGMText"}(joinpath(workdir, "3by2.pgm"))
Netpbm.save(fn, ac)
b = Netpbm.load(fn)
@test b[1:end] == ac[1:end]

ac = OffsetArray(rand(RGB{N0f8}, 2, 3), 0:1, -1:1)
fn = File(format"PPMText", joinpath(workdir, "3by2.ppm"))
fn = File{format"PPMText"}(joinpath(workdir, "3by2.ppm"))
Netpbm.save(fn, ac)
b = Netpbm.load(fn)
@test b[1:end] == ac[1:end]

0 comments on commit fd4c114

Please sign in to comment.