File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,45 @@ void test_sys_put_le16(void)
223
223
zassert_mem_equal (tmp , buf , sizeof (u16_t ), "sys_put_le16() failed" );
224
224
}
225
225
226
+ /**
227
+ * @brief Test sys_get_le32() functionality
228
+ *
229
+ * @details Test if sys_get_le32() correctly handles endianness.
230
+ *
231
+ * @see sys_get_le32()
232
+ */
233
+ void test_sys_get_le32 (void )
234
+ {
235
+ u32_t val = 0xf0e1d2c3 , tmp ;
236
+ u8_t buf [] = {
237
+ 0xc3 , 0xd2 , 0xe1 , 0xf0
238
+ };
239
+
240
+ tmp = sys_get_le32 (buf );
241
+
242
+ zassert_equal (tmp , val , "sys_get_le32() failed" );
243
+ }
244
+
245
+ /**
246
+ * @brief Test sys_put_le32() functionality
247
+ *
248
+ * @details Test if sys_put_le32() correctly handles endianness.
249
+ *
250
+ * @see sys_put_le32()
251
+ */
252
+ void test_sys_put_le32 (void )
253
+ {
254
+ u64_t val = 0xf0e1d2c3 ;
255
+ u8_t buf [] = {
256
+ 0xc3 , 0xd2 , 0xe1 , 0xf0
257
+ };
258
+ u8_t tmp [sizeof (u32_t )];
259
+
260
+ sys_put_le32 (val , tmp );
261
+
262
+ zassert_mem_equal (tmp , buf , sizeof (u32_t ), "sys_put_le32() failed" );
263
+ }
264
+
226
265
/**
227
266
* @}
228
267
*/
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ extern void test_sys_get_be16(void);
20
20
extern void test_sys_put_be16 (void );
21
21
extern void test_sys_get_le16 (void );
22
22
extern void test_sys_put_le16 (void );
23
+ extern void test_sys_get_le32 (void );
24
+ extern void test_sys_put_le32 (void );
23
25
extern void test_atomic (void );
24
26
extern void test_intmath (void );
25
27
extern void test_printk (void );
@@ -111,6 +113,8 @@ void test_main(void)
111
113
ztest_unit_test (test_sys_put_be16 ),
112
114
ztest_unit_test (test_sys_get_le16 ),
113
115
ztest_unit_test (test_sys_put_le16 ),
116
+ ztest_unit_test (test_sys_get_le32 ),
117
+ ztest_unit_test (test_sys_put_le32 ),
114
118
ztest_user_unit_test (test_atomic ),
115
119
ztest_unit_test (test_bitfield ),
116
120
ztest_unit_test (test_printk ),
You can’t perform that action at this time.
0 commit comments