Skip to content

Commit 1df46cc

Browse files
committed
Add more tests
1 parent bbb35b9 commit 1df46cc

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/indexing.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,8 @@ end
745745
@test (1:10)[1+Begin:End-1] == 2:9
746746
@test (1:10)[Begin()+1:End()-1] == 2:9
747747
@test (1:10)[Begin:End÷2] == 1:5
748+
@test (1:10)[2:2:End] == 2:2:10
749+
@test_broken (1:10)[2:2:End-1] == 2:2:8
748750
@test (1:10)[Begin|3:End] == 3:10
749751
@test (1:10)[Begin:End&3] == 1:2
750752
@test (1:10)[Begin()+1:End()-1] == 2:9
@@ -755,6 +757,10 @@ end
755757
@test (1:10)[max(Begin, 3)] == 3
756758
@test (1:10)[min(End, 12)] == 10
757759
@test (1:10)[min(End, 3)] == 3
760+
@test (1:10)[max(-1, Begin)] == 1
761+
@test (1:10)[max(3, Begin)] == 3
762+
@test (1:10)[min(12,End)] == 10
763+
@test (1:10)[min(3, End)] == 3
758764
end
759765
@testset "dimension indexing" begin
760766
A = DimArray((1:5)*(6:3:20)', (X, Y))
@@ -778,5 +784,7 @@ end
778784
@test last(c) == Begin+6
779785
d = Begin()+2:End()
780786
@test first(d) == Begin+2
787+
@test Base.checkindex(Bool, 1:10, Begin-1:End) == false
788+
@test Base.checkindex(Bool, 1:10, Begin:2:8)
781789
end
782790
end

0 commit comments

Comments
 (0)