Skip to content

Commit db66c7a

Browse files
committed
Remove invalid state test.
(These were introduced for performance.)
1 parent ba01acd commit db66c7a

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

test/cartesian.jl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,7 @@ end
295295
# check iteration behavior on boundary
296296
R = CartesianIndex(1, 1):CartesianIndex(2, 3):CartesianIndex(4, 5)
297297
@test R.indices == (1:2:3, 1:3:4)
298-
i = CartesianIndex(4, 1)
299-
i_next = CartesianIndex(1, 4)
300-
@test !(i in R) && iterate(R, i) == (i_next, i_next)
298+
@test last(R) == CartesianIndex(3, 4) && iterate(R, last(R)) == nothing
301299

302300
for R in [
303301
CartesianIndices((1:-1:-1, 1:2:5)),
@@ -398,31 +396,31 @@ end
398396
@test iterate(I, i) === nothing
399397

400398
I = CartesianIndices((1:2:typemax(Int), ))
401-
i = CartesianIndex(typemax(Int)-1)
399+
i = CartesianIndex(typemax(Int))
402400
@test iterate(I, i) === nothing
403401

404402
I = CartesianIndices((1:(typemax(Int)-1),))
405-
i = CartesianIndex(typemax(Int))
403+
i = CartesianIndex(typemax(Int)-1)
406404
@test iterate(I, i) === nothing
407405

408406
I = CartesianIndices((1:2:typemax(Int)-1, ))
409-
i = CartesianIndex(typemax(Int)-1)
407+
i = CartesianIndex(typemax(Int)-2)
410408
@test iterate(I, i) === nothing
411409

412410
I = CartesianIndices((1:typemax(Int), 1:typemax(Int)))
413411
i = last(I)
414412
@test iterate(I, i) === nothing
415413

416414
I = CartesianIndices((1:2:typemax(Int), 1:2:typemax(Int)))
417-
i = CartesianIndex(typemax(Int)-1, typemax(Int)-1)
415+
i = last(I)
418416
@test iterate(I, i) === nothing
419417

420418
I = CartesianIndices((1:typemax(Int), 1:typemax(Int)))
421419
i = CartesianIndex(typemax(Int), 1)
422420
@test iterate(I, i) === (CartesianIndex(1, 2), CartesianIndex(1,2))
423421

424422
I = CartesianIndices((1:2:typemax(Int), 1:2:typemax(Int)))
425-
i = CartesianIndex(typemax(Int)-1, 1)
423+
i = CartesianIndex(typemax(Int), 1)
426424
@test iterate(I, i) === (CartesianIndex(1, 3), CartesianIndex(1, 3))
427425

428426
I = CartesianIndices((typemin(Int):(typemin(Int)+3),))
@@ -496,9 +494,7 @@ end
496494

497495
# test invalid state
498496
I = CartesianIndices((2:4, 3:5))
499-
@test iterate(I, CartesianIndex(typemax(Int), 3))[1] == CartesianIndex(2,4)
500-
@test iterate(I, CartesianIndex(typemax(Int), 4))[1] == CartesianIndex(2,5)
501-
@test iterate(I, CartesianIndex(typemax(Int), 5)) === nothing
497+
@test iterate(I, CartesianIndex(4, typemax(Int))) === nothing
502498

503499
@test iterate(I, CartesianIndex(3, typemax(Int)))[1] == CartesianIndex(4,typemax(Int))
504500
@test iterate(I, CartesianIndex(4, typemax(Int))) === nothing

0 commit comments

Comments
 (0)