Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaodaigh committed May 22, 2020
1 parent bcd9a5c commit 1930cc7
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions test/test_writer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,31 @@ function test_write()
# the file is very small so only one rowgroup
col_chunks = columns(pf, 1)

colnum=12
col_chunk=col_chunks[colnum]

correct_vals = tbl[colnum]
coltype = eltype(correct_vals)
vals_from_file = values(pf, col_chunk)

if Missing <: coltype
@test ismissing.(correct_vals) == (vals_from_file[2] .== 0)
end

for (colnum, col_chunk) in enumerate(col_chunks)
println(colnum)
correct_vals = tbl[colnum]
coltype = eltype(correct_vals)
vals_from_file = values(pf, col_chunk)
if Missing <: coltype
@test ismissing.(correct_vals) == (vals_from_file[2] .== 0)
end

non_missing_vals = collect(skipmissing(correct_vals))

if nonmissingtype(coltype) == String
@test all(skipmissing(correct_vals) .== String.(vals_from_file[1]))
non_missing_vals_read = String.(vals_from_file[1][1:sum(vals_from_file[2])])
@test all(non_missing_vals .== non_missing_vals_read)
else
non_missing_vals = collect(skipmissing(correct_vals))
non_missing_vals_read = vals_from_file[1][1:sum(vals_from_file[2])]
@test all(non_missing_vals .== non_missing_vals_read)
end
Expand Down

0 comments on commit 1930cc7

Please sign in to comment.