Skip to content

Commit 24bbb8e

Browse files
authored
Fix 155 (#156)
1 parent 387d910 commit 24bbb8e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/diskarray.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ splitcs(::Tuple{}, csnow, csrem) = (csnow, csrem)
153153

154154
function getindex_disk(a, i::Union{Integer,CartesianIndex}...)
155155
checkscalar(i)
156+
checkbounds(a,i...)
156157
outputarray = Array{eltype(a)}(undef, map(_ -> 1, size(a))...)
157158
i = Base.to_indices(a, i)
158159
j = map(1:ndims(a)) do d

test/runtests.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ end
2828
@test DiskArrays.can_scalar() == true
2929
@test DiskArrays.checkscalar(Bool, 1, 2, 3) == true
3030
@test DiskArrays.checkscalar(Bool, :, 2:5, 3) == true
31+
a = AccessCountDiskArray(reshape(1:24,2,3,4),chunksize=(2,2,2))
32+
@test a[1,2,3] == 15
33+
@test a[1,2,3,1] == 15
34+
@test_throws BoundsError a[1,2]
35+
@test a[CartesianIndex(1,2),3] == 15
36+
@test a[CartesianIndex(1,2,3)] == 15
3137
end
3238

3339
function test_getindex(a)

0 commit comments

Comments
 (0)