Skip to content

Commit

Permalink
Merge pull request #15 from RalphAS/ras/finaledge
Browse files Browse the repository at this point in the history
correct EdgeIterator when inner abuts outer at final edge
  • Loading branch information
timholy authored Aug 5, 2018
2 parents 71d0eb6 + 83a1f47 commit 8e3a657
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/TiledIteration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function Base.iterate(iter::EdgeIterator, state)
iterouter = iterate(iter.outer, state)
iterouter === nothing && return nothing
item = nextedgeitem(iter, iterouter[2])
item.I[end] > last(iter.outer.indices[end]) && return nothing
return item, item
end

Expand Down
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ end
iter = EdgeIterator(CartesianIndices((0:4,)), CartesianIndices(1:3))
@test collect(iter) == [CartesianIndex(0,),
CartesianIndex(4,)]
iter = EdgeIterator((Base.OneTo(2),Base.OneTo(3)),(2:2,1:3))
for it in iter
@test it iter.outer
end
iter = EdgeIterator(CartesianIndices((1:4,)),CartesianIndices((2:4,)))
for it in iter
@test it iter.outer
end
end

@testset "padded sizes" begin
Expand Down

0 comments on commit 8e3a657

Please sign in to comment.