@@ -152,6 +152,27 @@ TEST_F (PdoTest, PackWithPadding)
152
152
EXPECT_EQ (1u , frame[1 ]);
153
153
}
154
154
155
+ TEST_F (PdoTest, PackArray)
156
+ {
157
+ co_pdo_t pdo;
158
+ uint8_t * frame = (uint8_t *)&pdo.frame ;
159
+ const co_obj_t * obj2000 = find_obj (0x2000 );
160
+
161
+ memset (&pdo, 0 , sizeof (pdo));
162
+
163
+ pdo.number_of_mappings = 2 ;
164
+ pdo.mappings [0 ] = 0x20000308 ;
165
+ pdo.mappings [1 ] = 0x20000708 ;
166
+ pdo.entries [0 ] = find_entry (obj2000, 3 );
167
+ pdo.entries [1 ] = find_entry (obj2000, 7 );
168
+ pdo.objs [0 ] = obj2000;
169
+ pdo.objs [1 ] = obj2000;
170
+
171
+ co_pdo_pack (&net, &pdo);
172
+ EXPECT_EQ (3u , frame[0 ]);
173
+ EXPECT_EQ (7u , frame[1 ]);
174
+ }
175
+
155
176
TEST_F (PdoTest, Unpack)
156
177
{
157
178
co_pdo_t pdo;
@@ -236,6 +257,31 @@ TEST_F (PdoTest, UnpackWithPadding)
236
257
EXPECT_EQ (0x3322u , value6003_07);
237
258
}
238
259
260
+ TEST_F (PdoTest, UnpackArray)
261
+ {
262
+ co_pdo_t pdo;
263
+ uint8_t * frame = (uint8_t *)&pdo.frame ;
264
+ const co_obj_t * obj2000 = find_obj (0x2000 );
265
+
266
+ memset (&pdo, 0 , sizeof (pdo));
267
+
268
+ pdo.number_of_mappings = 2 ;
269
+ pdo.mappings [0 ] = 0x20000308 ;
270
+ pdo.mappings [1 ] = 0x20000708 ;
271
+ pdo.entries [0 ] = find_entry (obj2000, 3 );
272
+ pdo.entries [1 ] = find_entry (obj2000, 7 );
273
+ pdo.objs [0 ] = obj2000;
274
+ pdo.objs [1 ] = obj2000;
275
+
276
+ frame[0 ] = 0x00 ;
277
+ frame[1 ] = 0x11 ;
278
+
279
+ co_pdo_unpack (&net, &pdo);
280
+
281
+ EXPECT_EQ (0x00u , arr2000[2 ]);
282
+ EXPECT_EQ (0x11u , arr2000[6 ]);
283
+ }
284
+
239
285
TEST_F (PdoTest, CommParamsSet)
240
286
{
241
287
const co_obj_t * obj1400 = find_obj (0x1400 );
0 commit comments