From 714c581cd6a6fa0c15284453f5b8360c59621a9e Mon Sep 17 00:00:00 2001 From: "Ralph A. Smith" Date: Sat, 4 Aug 2018 12:12:31 -0400 Subject: [PATCH 1/2] add test for unprotected edge iterator --- test/runtests.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 3fa73bf..aad1f8a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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 From 83a1f475d6b996a506f649e6af3fe41c7793dfc4 Mon Sep 17 00:00:00 2001 From: "Ralph A. Smith" Date: Sat, 4 Aug 2018 12:04:44 -0400 Subject: [PATCH 2/2] correct termination of EdgeIterator for final abutment case This change adds a check similar to the MD array iterator in Base. --- src/TiledIteration.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/TiledIteration.jl b/src/TiledIteration.jl index 17b0ed5..d99b6d9 100644 --- a/src/TiledIteration.jl +++ b/src/TiledIteration.jl @@ -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