1212
1313typedef struct {
1414 int8_t ndim ;
15- int64_t shape1 [B2ND_MAX_DIM ];
16- int32_t chunkshape1 [B2ND_MAX_DIM ];
17- int32_t blockshape1 [B2ND_MAX_DIM ];
18- int64_t shape2 [B2ND_MAX_DIM ];
19- int32_t chunkshape2 [B2ND_MAX_DIM ];
20- int32_t blockshape2 [B2ND_MAX_DIM ];
15+ int8_t axis ;
16+ int64_t shape1 [B2ND_MAX_DIM ];
17+ int32_t chunkshape1 [B2ND_MAX_DIM ];
18+ int32_t blockshape1 [B2ND_MAX_DIM ];
19+ int64_t shape2 [B2ND_MAX_DIM ];
20+ int32_t chunkshape2 [B2ND_MAX_DIM ];
21+ int32_t blockshape2 [B2ND_MAX_DIM ];
2122} test_shapes_t ;
2223
2324
@@ -78,44 +79,56 @@ CUTEST_TEST_SETUP(concatenate) {
7879 // Add parametrization
7980 CUTEST_PARAMETRIZE (typesize , uint8_t , CUTEST_DATA (
8081 1 ,
81- // 2,
82- // 4,
83- // 8,
82+ // 2,
83+ // 4,
84+ 8 ,
85+ 13 ,
8486 ));
8587
8688 CUTEST_PARAMETRIZE (backend , _test_backend , CUTEST_DATA (
8789 {false, false},
88- // {true, false},
89- // {true, true},
90- // {false, true},
90+ {true, false},
91+ {true, true},
92+ {false, true},
9193 ));
9294
9395
9496 CUTEST_PARAMETRIZE (shapes , test_shapes_t , CUTEST_DATA (
95- // {0, {0}, {0}, {0}, {0}, {0}}, // 0-dim
96- // {1, {5}, {3}, {2}, {2}, {5}}, // 1-idim
97- // {2, {20, 0}, {7, 0}, {3, 0}, {2, 0}, {8, 0}}, // 0-shape
98- // {2, {20, 10}, {7, 5}, {3, 5}, {2, 0}, {18, 0}}, // 0-shape
99- // {2, {14, 10}, {8, 5}, {2, 2}, {5, 3}, {9, 10}},
100- // {3, {12, 10, 14}, {3, 5, 9}, {3, 4, 4}, {3, 0, 3}, {6, 7, 10}},
101- // {4, {10, 21, 30, 5}, {8, 7, 15, 3}, {5, 5, 10, 1}, {5, 4, 3, 3}, {10, 8, 8, 4}},
102- {2 , {50 , 50 }, {25 , 13 }, {5 , 8 }, {50 , 50 }, {25 , 13 }, {5 , 8 }},
103- // {2, {150, 45}, {15, 15}, {7, 7}, {4, 2}, {6, 5}},
104- // {2, {10, 10}, {5, 7}, {2, 2}, {0, 0}, {5, 5}},
105- // // Checks for fast path in setting a single chunk that is C contiguous
106- // {2, {20, 20}, {10, 10}, {5, 10}, {10, 10}, {20, 20}},
107- // {3, {3, 4, 5}, {1, 4, 5}, {1, 2, 5}, {1, 0, 0}, {2, 4, 5}},
108- // {3, {3, 8, 5}, {1, 4, 5}, {1, 2, 5}, {1, 4, 0}, {2, 8, 5}},
97+ // 0-dim is not supported in concatenate
98+ // {0, 0, {0}, {0}, {0}, {0}, {0}, {0}},
99+ // 1-dim
100+ {1 , 0 , {50 }, {25 }, {5 }, {20 }, {25 }, {5 }},
101+ {1 , 0 , {2 }, {25 }, {5 }, {49 }, {25 }, {5 }},
102+ // 2-dim
103+ {2 , 0 , {50 , 50 }, {25 , 13 }, {5 , 8 }, {50 , 50 }, {25 , 13 }, {5 , 8 }},
104+ {2 , 1 , {50 , 50 }, {25 , 13 }, {5 , 8 }, {50 , 50 }, {25 , 13 }, {5 , 8 }},
105+ {2 , 0 , {25 , 50 }, {25 , 25 }, {5 , 5 }, {2 , 50 }, {25 , 25 }, {5 , 5 }},
106+ {2 , 1 , {25 , 50 }, {25 , 25 }, {5 , 5 }, {25 , 5 }, {25 , 25 }, {5 , 5 }},
107+ // 3-dim
108+ {3 , 0 , {50 , 5 , 50 }, {25 , 13 , 10 }, {5 , 8 , 5 }, {50 , 5 , 50 }, {25 , 13 , 10 }, {5 , 8 , 5 }},
109+ {3 , 1 , {50 , 5 , 50 }, {25 , 13 , 10 }, {5 , 8 , 5 }, {50 , 5 , 50 }, {25 , 13 , 10 }, {5 , 8 , 5 }},
110+ {3 , 2 , {50 , 5 , 50 }, {25 , 13 , 10 }, {5 , 8 , 5 }, {50 , 5 , 50 }, {25 , 13 , 10 }, {5 , 8 , 5 }},
111+ {3 , 0 , {5 , 5 , 50 }, {25 , 13 , 10 }, {5 , 8 , 5 }, {51 , 5 , 50 }, {25 , 13 , 10 }, {5 , 8 , 5 }},
112+ // Inner 0-dims are supported
113+ {3 , 1 , {50 , 1 , 50 }, {25 , 13 , 10 }, {5 , 8 , 5 }, {50 , 0 , 50 }, {25 , 13 , 10 }, {5 , 8 , 5 }},
114+ // TODO: the next is not working yet
115+ // {3, 2, {50, 50, 0}, {25, 13, 10}, {5, 8, 5}, {50, 50, 49}, {25, 13, 10}, {5, 8, 5}},
116+ // 4-dim
117+ {4 , 0 , {5 , 5 , 5 , 5 }, {2 , 5 , 10 , 5 }, {5 , 2 , 5 , 2 }, {5 , 5 , 5 , 5 }, {5 , 5 , 10 , 5 }, {5 , 2 , 5 , 2 }},
118+ {4 , 1 , {5 , 5 , 5 , 5 }, {2 , 5 , 10 , 5 }, {5 , 2 , 5 , 2 }, {5 , 5 , 5 , 5 }, {5 , 5 , 10 , 5 }, {5 , 2 , 5 , 2 }},
119+ {4 , 2 , {5 , 5 , 5 , 5 }, {2 , 13 , 10 , 5 }, {5 , 8 , 5 , 2 }, {5 , 5 , 5 , 5 }, {5 , 13 , 10 , 5 }, {5 , 8 , 5 , 2 }},
120+ {4 , 3 , {5 , 5 , 5 , 5 }, {2 , 13 , 10 , 5 }, {5 , 8 , 5 , 2 }, {5 , 5 , 5 , 5 }, {5 , 13 , 10 , 5 }, {5 , 8 , 5 , 2 }},
121+ {4 , 0 , {5 , 5 , 5 , 5 }, {2 , 13 , 10 , 5 }, {5 , 8 , 5 , 2 }, {6 , 5 , 5 , 5 }, {15 , 13 , 10 , 5 }, {5 , 8 , 5 , 2 }},
122+ {4 , 1 , {5 , 5 , 5 , 5 }, {2 , 13 , 10 , 5 }, {5 , 8 , 5 , 2 }, {5 , 6 , 5 , 5 }, {15 , 13 , 10 , 5 }, {5 , 8 , 5 , 2 }},
123+ {4 , 2 , {5 , 5 , 5 , 5 }, {2 , 13 , 10 , 5 }, {5 , 8 , 5 , 2 }, {5 , 5 , 6 , 5 }, {15 , 13 , 10 , 5 }, {5 , 8 , 5 , 2 }},
124+ {4 , 3 , {5 , 5 , 5 , 5 }, {2 , 13 , 10 , 5 }, {5 , 8 , 5 , 2 }, {5 , 5 , 5 , 6 }, {15 , 13 , 10 , 5 }, {5 , 8 , 5 , 2 }},
125+
109126 ));
110127 CUTEST_PARAMETRIZE (fill_value , int8_t , CUTEST_DATA (
111128 3 ,
129+ -5 ,
112130// 113,
113131// 33,
114- // -5
115- ));
116- CUTEST_PARAMETRIZE (axis , int8_t , CUTEST_DATA (
117- 0 ,
118- 1 ,
119132 ));
120133 CUTEST_PARAMETRIZE (copy , bool , CUTEST_DATA (
121134 true,
@@ -129,9 +142,9 @@ CUTEST_TEST_TEST(concatenate) {
129142 CUTEST_GET_PARAMETER (shapes , test_shapes_t );
130143 CUTEST_GET_PARAMETER (typesize , uint8_t );
131144 CUTEST_GET_PARAMETER (fill_value , int8_t );
132- CUTEST_GET_PARAMETER (axis , int8_t );
133145 CUTEST_GET_PARAMETER (copy , bool );
134146
147+ int axis = shapes .axis ;
135148 char * urlpath = "test_concatenate.b2frame" ;
136149 char * urlpath1 = "test_concatenate1.b2frame" ;
137150 char * urlpath2 = "test_concatenate2.b2frame" ;
@@ -258,8 +271,9 @@ CUTEST_TEST_TEST(concatenate) {
258271 }
259272
260273 // Check the data in the concatenated array
261- printf ("Array shapes: %d x %d\n" , (int )array -> shape [0 ], (int )array -> shape [1 ]);
262- printf ("Helperbuffer shapes: %d x %d\n" , (int )helpershape [0 ], (int )helpershape [1 ]);
274+ printf ("Array ndim: %d\n" , array -> ndim );
275+ printf ("Array shapes: %d x %d x %d x %d\n" , (int )array -> shape [0 ], (int )array -> shape [1 ], (int )array -> shape [2 ], (int )array -> shape [3 ]);
276+ printf ("Helperbuffer shapes: %d x %d x %d x %d\n" , (int )helpershape [0 ], (int )helpershape [1 ], (int )helpershape [2 ], (int )helpershape [3 ]);
263277 printf ("Axis: %d\n" , axis );
264278
265279 int64_t start [B2ND_MAX_DIM ] = {0 };
0 commit comments