Skip to content

Commit

Permalink
allow all Integer types in RegularChunks
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Oct 8, 2023
1 parent 2022dc0 commit 48b1306
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/chunks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ struct RegularChunks <: ChunkType
cs::Int
offset::Int
s::Int
function RegularChunks(cs::Int,offset::Int,s::Int)
function RegularChunks(cs::Integer, offset::Integer, s::Integer)
cs>0 || throw(ArgumentError("Chunk sizes must be strictly positive"))
-1 < offset < cs || throw(ArgumentError("Offsets must be positive and smaller than the chunk size"))
s >= 0 || throw(ArgumentError("Negative dimension lengths are not allowed"))
new(cs,offset,s)
new(Int(cs), Int(offset), Int(s))
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 @@ -273,6 +273,8 @@ end
@test DiskArrays.max_chunksize(gridc) == (5, 2, 4)
@test_throws ArgumentError IrregularChunks([1,2,3])
@test_throws ArgumentError IrregularChunks([0,5,4])
# Make sure mixed Integer types work
@test RegularChunks(Int32(5), 2, UInt32(10)) == RegularChunks(5, 2, 10)
end

@testset "SubsetChunks" begin
Expand Down

0 comments on commit 48b1306

Please sign in to comment.