Skip to content

Commit

Permalink
make size typestable and test for it (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
gdkrmr authored Jul 5, 2022
1 parent 7f9b5c3 commit 6703dbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/metadata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ https://zarr.readthedocs.io/en/stable/spec/v2.html#metadata
"""
struct Metadata{T, N, C, F}
zarr_format::Int
shape::Ref{NTuple{N, Int}}
shape::Base.RefValue{NTuple{N, Int}}
chunks::NTuple{N, Int}
dtype::String # structured data types not yet supported
compressor::C
Expand All @@ -136,7 +136,7 @@ struct Metadata{T, N, C, F}
any(<(0), shape) && throw(ArgumentError("Size must be positive"))
any(<(1), chunks) && throw(ArgumentError("Chunk size must be >= 1 along each dimension"))
order === 'C' || throw(ArgumentError("Currently only 'C' storage order is supported"))
new{T2, N, C, F}(zarr_format, shape, chunks, dtype, compressor,fill_value, order, filters)
new{T2, N, C, F}(zarr_format, Base.RefValue{NTuple{N,Int}}(shape), chunks, dtype, compressor,fill_value, order, filters)
end
end

Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ end
@test ndims(z) === 2
@test size(z) === (2, 3)
@test size(z, 2) === 3
@inferred size(z)
@inferred size(z, 2)
@test length(z) === 2 * 3
@test lastindex(z, 2) === 3
@test Zarr.zname(z) === "root"
Expand Down

0 comments on commit 6703dbf

Please sign in to comment.