Skip to content

Commit 385ff5e

Browse files
committed
Some tests to nail down desired behavior
1 parent b889962 commit 385ff5e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/arrayops.jl

+27
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,33 @@ end
591591
@test findprev(b, T(1)) isa keytype(b)
592592
@test findprev(b, T(2)) isa keytype(b)
593593
end
594+
595+
@testset "issue #36938" begin
596+
# 👎 denotes tests that are broken.
597+
@test findfirst(fill(true, (0, 2))) === nothing # 👎
598+
@test findfirst(fill(true, (2, 0))) === nothing
599+
@test findfirst(fill(true, (0, 0))) === nothing
600+
601+
@test findlast(fill(true, (0, 2))) === nothing # 👎
602+
@test findlast(fill(true, (2, 0))) === nothing
603+
@test findlast(fill(true, (0, 0))) === nothing
604+
605+
@test findnext(fill(true, (2, 2)), CartesianIndex(1, 3)) === nothing
606+
@test findnext(fill(true, (2, 2)), CartesianIndex(3, 1)) === nothing # 👎
607+
@test findnext(fill(true, (2, 2)), CartesianIndex(3, 3)) === nothing
608+
609+
@test_throws BoundsError findnext(fill(true, (2, 2)), CartesianIndex(1, 0))
610+
@test_throws BoundsError findnext(fill(true, (2, 2)), CartesianIndex(0, 1))
611+
@test_throws BoundsError findnext(fill(true, (2, 2)), CartesianIndex(0, 0))
612+
613+
@test_throws BoundsError findprev(fill(true, (2, 2)), CartesianIndex(1, 3))
614+
@test_throws BoundsError findprev(fill(true, (2, 2)), CartesianIndex(3, 1))
615+
@test_throws BoundsError findprev(fill(true, (2, 2)), CartesianIndex(3, 3))
616+
617+
@test findprev(fill(true, (2, 2)), CartesianIndex(1, 0)) === nothing
618+
@test findprev(fill(true, (2, 2)), CartesianIndex(0, 1)) === nothing
619+
@test findprev(fill(true, (2, 2)), CartesianIndex(0, 0)) === nothing
620+
end
594621
end
595622
@testset "find with Matrix" begin
596623
A = [1 2 0; 3 4 0]

0 commit comments

Comments
 (0)