Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
meggart committed Oct 18, 2024
1 parent 1ee307c commit 96107ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/diskarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function process_index(i::AbstractUnitRange{<:Integer}, cs, ::NoBatch)
DiskIndex((length(i),), (length(i),), (Colon(),), (Colon(),), (i,)), Base.tail(cs)
end
function process_index(i::AbstractArray{<:Integer}, cs, ::NoBatch)
indmin, indmax = extrema(i)
indmin, indmax = isempty(i) ? (1,0) : extrema(i)
DiskIndex(size(i), ((indmax - indmin + 1),), map(_->Colon(),size(i)), ((i .- (indmin - 1)),), (indmin:indmax,)), Base.tail(cs)
end
function process_index(i::AbstractArray{Bool,N}, cs, ::NoBatch) where {N}
Expand Down
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,13 @@ end
a = AccessCountDiskArray(reshape(1:20, 4, 5, 1); chunksize=(4, 1, 1))
@test a[:, [1, 4], 1] == trueparent(a)[:, [1, 4], 1]
@test getindex_count(a) == 1

#Test with empty vectors
@test a[Int[]] == Int[]
@test a[:,Int[],:] == zeros(Int,4,0,1)
@test a[Int[],:,:] == zeros(Int,0,5,1)
@test getindex_count(a) == 4

coords = CartesianIndex.([(1, 1, 1), (3, 1, 1), (2, 4, 1), (4, 4, 1)])
@test a[coords] == trueparent(a)[coords]
@test_broken getindex_count(a) == 4
Expand Down

0 comments on commit 96107ac

Please sign in to comment.