@@ -119,6 +119,9 @@ function test_view(a)
119
119
@test trueparent (a)[2 : 3 , 3 : 4 ] == [4 4 ; 4 4 ]
120
120
@test getindex_count (a) == 2
121
121
@test setindex_count (a) == 2
122
+
123
+ v2 = view (a, 2 : 3 , 2 : 4 , Int[])
124
+ @test size (eachchunk (v2)) == (1 , 1 , 0 )
122
125
end
123
126
124
127
function test_reductions (af)
@@ -204,10 +207,12 @@ end
204
207
@test a1[3 ] == 9 : 10
205
208
@test length (a1) == 3
206
209
@test size (a1) == (3 ,)
207
- v1 = subsetchunks (a1, 1 : 10 )
208
- v2 = subsetchunks (a1, 4 : 9 )
209
- @test v1 === a1
210
- @test v2 === RegularChunks (5 , 0 , 6 )
210
+ @test subsetchunks (a1, 1 : 10 ) === a1
211
+ @test subsetchunks (a1, 4 : 9 ) === RegularChunks (5 , 0 , 6 )
212
+ @test subsetchunks (a1, Int[]) === RegularChunks (1 , 0 , 0 )
213
+ @test subsetchunks (a1, 5 : 4 ) === RegularChunks (1 , 0 , 0 )
214
+ @test subsetchunks (a1, 2 : 2 : 8 ) === RegularChunks (3 , 2 , 4 )
215
+ @test subsetchunks (a1, 10 : - 2 : 1 ) === RegularChunks (3 , 2 , 5 )
211
216
a2 = RegularChunks (2 , 0 , 20 )
212
217
@test a2[1 ] == 1 : 2
213
218
@test a2[2 ] == 3 : 4
232
237
@test_throws BoundsError b1[6 ]
233
238
@test subsetchunks (b1, 1 : 15 ) == IrregularChunks (; chunksizes= [3 , 3 , 4 , 3 , 2 ])
234
239
@test subsetchunks (b1, 3 : 10 ) == IrregularChunks (; chunksizes= [1 , 3 , 4 ])
240
+ @test subsetchunks (b1, Int[]) == IrregularChunks (; chunksizes= Int[])
241
+ @test subsetchunks (b1, 5 : 4 ) == IrregularChunks (; chunksizes= Int[])
242
+ @test subsetchunks (b1, 2 : 2 : 15 ) == IrregularChunks (; chunksizes= [1 , 2 , 2 , 1 , 1 ])
243
+ @test subsetchunks (b1, 14 : - 2 : 1 ) == IrregularChunks (; chunksizes= [1 , 1 , 2 , 2 , 1 ])
235
244
gridc = GridChunks (a1, a2, b1)
236
245
@test eltype (gridc) <: Tuple{UnitRange,UnitRange,UnitRange}
237
246
@test gridc[1 , 1 , 1 ] == (1 : 3 , 1 : 2 , 1 : 3 )
0 commit comments