@@ -215,12 +215,23 @@ end
215
215
b = blockedrange (Fill (2 ,3 ))
216
216
c = blockedrange ([2 ,2 ,2 ])
217
217
@test convert (BlockedUnitRange, b) === b
218
- @test blockisequal (convert (BlockedUnitRange, Base. OneTo (5 )), blockedrange ([5 ]))
219
- @test blockisequal (convert (BlockedUnitRange, Base. Slice (Base. OneTo (5 ))), blockedrange ([5 ]))
220
- @test blockisequal (convert (BlockedUnitRange, Base. IdentityUnitRange (- 2 : 2 )), BlockArrays. _BlockedUnitRange (- 2 ,[2 ]))
221
- @test convert (BlockedUnitRange{Vector{Int}}, c) === c
222
- @test blockisequal (convert (BlockedUnitRange{Vector{Int}}, b),b)
223
- @test blockisequal (convert (BlockedUnitRange{Vector{Int}}, Base. OneTo (5 )), blockedrange ([5 ]))
218
+ @test convert (typeof (b), b) === b
219
+ @test convert (BlockedUnitRange, c) === c
220
+ @test convert (typeof (c), c) === c
221
+ function test_type_and_blocks (T, r, res)
222
+ s = convert (T, r)
223
+ @test s isa T
224
+ @test blockisequal (s, res)
225
+ end
226
+ for T in (BlockedUnitRange, BlockedUnitRange{Vector{Int}})
227
+ test_type_and_blocks (T, blockedrange (5 : 5 ), blockedrange (5 : 5 ))
228
+ test_type_and_blocks (T, Base. OneTo (5 ), blockedrange ([5 ]))
229
+ test_type_and_blocks (T, Base. Slice (Base. OneTo (5 )), blockedrange ([5 ]))
230
+ test_type_and_blocks (T, - 2 : 2 , BlockArrays. _BlockedUnitRange (- 2 ,[2 ]))
231
+ test_type_and_blocks (T, Base. IdentityUnitRange (- 2 : 2 ), BlockArrays. _BlockedUnitRange (- 2 ,[2 ]))
232
+ test_type_and_blocks (T, b, b)
233
+ test_type_and_blocks (T, Base. OneTo (5 ), blockedrange ([5 ]))
234
+ end
224
235
end
225
236
226
237
@testset " findblock" begin
0 commit comments