105
105
@test searchsorted (fill (R (1 ), 15 ), T (1 ), 6 , 10 , Forward) == 6 : 10
106
106
end
107
107
108
- for (rg,I) in [(49 : 57 ,47 : 59 ), (1 : 2 : 17 ,- 1 : 19 ), (- 3 : 0.5 : 2 ,- 5 : .5 : 4 )]
108
+ for (rg,I) in Any [(49 : 57 ,47 : 59 ), (1 : 2 : 17 ,- 1 : 19 ), (- 3 : 0.5 : 2 ,- 5 : .5 : 4 )]
109
109
rg_r = reverse (rg)
110
110
rgv, rgv_r = [rg;], [rg_r;]
111
111
for i = I
144
144
145
145
@testset " issue 32568" begin
146
146
for R in numTypes, T in numTypes
147
- for arr in [R[1 : 5 ;], R (1 ): R (5 ), R (1 ): 2 : R (5 )]
147
+ for arr in Any [R[1 : 5 ;], R (1 ): R (5 ), R (1 ): 2 : R (5 )]
148
148
@test eltype (searchsorted (arr, T (2 ))) == keytype (arr)
149
149
@test eltype (searchsorted (arr, T (2 ), big (1 ), big (4 ), Forward)) == keytype (arr)
150
150
@test searchsortedfirst (arr, T (2 )) isa keytype (arr)
@@ -164,35 +164,46 @@ end
164
164
@test searchsorted ([1 ,2 ], Inf ) === 3 : 2
165
165
@test searchsorted (1 : 2 , Inf ) === 3 : 2
166
166
167
- for coll in [
167
+ for coll in Any [
168
168
Base. OneTo (10 ),
169
169
1 : 2 ,
170
+ 0x01 : 0x02 ,
170
171
- 4 : 6 ,
171
172
5 : 2 : 10 ,
172
173
[1 ,2 ],
173
174
1.0 : 4 ,
174
175
[10.0 ,20.0 ],
175
176
]
176
- for huge in [Inf , 1e300 ]
177
+ for huge in Any [Inf , 1e300 , typemax (Int64), typemax (UInt64) ]
177
178
@test searchsortedfirst (coll, huge) === lastindex (coll) + 1
178
- @test searchsortedfirst (coll, - huge)=== firstindex (coll)
179
179
@test searchsortedlast (coll, huge) === lastindex (coll)
180
- @test searchsortedlast (coll, - huge) === firstindex (coll) - 1
181
180
@test searchsorted (coll, huge) === lastindex (coll)+ 1 : lastindex (coll)
182
- @test searchsorted (coll, - huge) === firstindex (coll) : firstindex (coll) - 1
183
-
184
- @test searchsortedfirst (reverse (coll), huge, rev= true ) === firstindex (coll)
185
- @test searchsortedfirst (reverse (coll), - huge, rev= true ) === lastindex (coll) + 1
186
- @test searchsortedlast (reverse (coll), huge, rev= true ) === firstindex (coll) - 1
187
- @test searchsortedlast (reverse (coll), - huge, rev= true ) === lastindex (coll)
188
- @test searchsorted (reverse (coll), huge, rev= true ) === firstindex (coll): firstindex (coll) - 1
189
- @test searchsorted (reverse (coll), - huge, rev= true ) === lastindex (coll)+ 1 : lastindex (coll)
181
+ if ! (eltype (coll) <: Unsigned )
182
+ @test searchsortedfirst (reverse (coll), huge, rev= true ) === firstindex (coll)
183
+ @test searchsortedlast (reverse (coll), huge, rev= true ) === firstindex (coll) - 1
184
+ @test searchsorted (reverse (coll), huge, rev= true ) === firstindex (coll): firstindex (coll) - 1
185
+ end
186
+
187
+ if ! (huge isa Unsigned)
188
+ @test searchsortedfirst (coll, - huge)=== firstindex (coll)
189
+ @test searchsortedlast (coll, - huge) === firstindex (coll) - 1
190
+ @test searchsorted (coll, - huge) === firstindex (coll) : firstindex (coll) - 1
191
+ if ! (eltype (coll) <: Unsigned )
192
+ @test searchsortedfirst (reverse (coll), - huge, rev= true ) === lastindex (coll) + 1
193
+ @test searchsortedlast (reverse (coll), - huge, rev= true ) === lastindex (coll)
194
+ @test searchsorted (reverse (coll), - huge, rev= true ) === lastindex (coll)+ 1 : lastindex (coll)
195
+ end
196
+ end
190
197
end
191
198
end
192
- @testset " issue ##34408" begin
199
+
200
+ @test_broken length (reverse (0x1 : 0x2 )) == 2
201
+ @testset " issue #34408" begin
193
202
r = 1f8 - 10 : 1f8
194
203
# collect(r) = Float32[9.999999e7, 9.999999e7, 9.999999e7, 9.999999e7, 1.0e8, 1.0e8, 1.0e8, 1.0e8, 1.0e8]
195
- @test_broken searchsorted (collect (r)) == searchsorted (r)
204
+ for i in r
205
+ @test_broken searchsorted (collect (r), i) == searchsorted (r, i)
206
+ end
196
207
end
197
208
end
198
209
@testset " issue #35272" begin
329
340
@test insorted (T (10 ), R .(collect (1 : 10 )), by= (>= (5 )))
330
341
end
331
342
332
- for (rg,I) in [(49 : 57 ,47 : 59 ), (1 : 2 : 17 ,- 1 : 19 ), (- 3 : 0.5 : 2 ,- 5 : .5 : 4 )]
343
+ for (rg,I) in Any [(49 : 57 ,47 : 59 ), (1 : 2 : 17 ,- 1 : 19 ), (- 3 : 0.5 : 2 ,- 5 : .5 : 4 )]
333
344
rg_r = reverse (rg)
334
345
rgv, rgv_r = collect (rg), collect (rg_r)
335
346
for i = I
0 commit comments