Skip to content

Commit 4e503d4

Browse files
committed
Add field (property) unit tests
1 parent b7a9950 commit 4e503d4

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/test_CellArray.jl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Test
22
using CUDA, AMDGPU, StaticArrays
33
import CellArrays
4-
import CellArrays: CPUCellArray, @define_CuCellArray, @define_ROCCellArray, cellsize, blocklength, _N
4+
import CellArrays: CPUCellArray, @define_CuCellArray, @define_ROCCellArray, cellsize, blocklength, field, _N
55
import CellArrays: IncoherentArgumentError, ArgumentError
66

77
@define_CuCellArray
@@ -292,6 +292,24 @@ end
292292
@test blocklength(G) == 1
293293
@test blocklength(H) == 4
294294
end;
295+
@testset "field" begin
296+
@test size(field(A, 1)) == dims
297+
@test size(field(C, 3,4)) == dims
298+
@test size(field(E, 2,2,2,2)) == dims
299+
@test size(field(G, 3,4)) == dims
300+
@test size(field(E, :xxxx)) == dims
301+
@test size(field(E, :yxxx)) == dims
302+
@test size(field(E, :xyxx)) == dims
303+
@test size(field(E, :yyxx)) == dims
304+
@test size(field(E, :yyyy)) == dims
305+
end;
306+
@testset "field property" begin
307+
@test E.xxxx == field(E, :xxxx)
308+
@test E.yxxx == field(E, :yxxx)
309+
@test E.xyxx == field(E, :xyxx)
310+
@test E.yyxx == field(E, :yyxx)
311+
@test E.yyyy == field(E, :yyyy)
312+
end;
295313
end;
296314
@testset "3. Exceptions ($array_type arrays)" for (array_type, Array, CellArray) in zip(array_types, ArrayConstructors, CellArrayConstructors)
297315
dims = (2,3)

0 commit comments

Comments
 (0)