Skip to content

Commit

Permalink
searchsorted: add tests for issue #10966 (#41874)
Browse files Browse the repository at this point in the history
  • Loading branch information
sostock authored Aug 16, 2021
1 parent 9ae49bc commit cd43dda
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/sorting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,26 @@ end
@test searchsortedlast(500:1.0:600, 1.0e20) == 101
end

@testset "issue 10966" begin
for R in numTypes, T in numTypes
@test searchsortedfirst(R(2):R(2), T(0)) == 1
@test searchsortedfirst(R(2):R(2), T(2)) == 1
@test searchsortedfirst(R(2):R(2), T(3)) == 2
@test searchsortedfirst(R(1):1//2:R(5), T(0)) == 1
@test searchsortedfirst(R(1):1//2:R(5), T(2)) == 3
@test searchsortedfirst(R(1):1//2:R(5), T(6)) == 10
@test searchsortedlast(R(2):R(2), T(0)) == 0
@test searchsortedlast(R(2):R(2), T(2)) == 1
@test searchsortedlast(R(2):R(2), T(3)) == 1
@test searchsortedlast(R(1):1//2:R(5), T(0)) == 0
@test searchsortedlast(R(1):1//2:R(5), T(2)) == 3
@test searchsortedlast(R(1):1//2:R(5), T(6)) == 9
@test searchsorted(R(2):R(2), T(0)) === 1:0
@test searchsorted(R(2):R(2), T(2)) == 1:1
@test searchsorted(R(2):R(2), T(3)) === 2:1
end
end

@testset "issue 32568" begin
for R in numTypes, T in numTypes
for arr in Any[R[1:5;], R(1):R(5), R(1):2:R(5)]
Expand Down

0 comments on commit cd43dda

Please sign in to comment.