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 @@ -184,6 +184,45 @@ void test_sys_put_be16(void)
184184 zassert_mem_equal (tmp , buf , sizeof (u16_t ), "sys_put_be16() failed" );
185185}
186186
187+ /**
188+ * @brief Test sys_get_le16() functionality
189+ *
190+ * @details Test if sys_get_le16() correctly handles endianness.
191+ *
192+ * @see sys_get_le16()
193+ */
194+ void test_sys_get_le16 (void )
195+ {
196+ u32_t val = 0xf0e1 , tmp ;
197+ u8_t buf [] = {
198+ 0xe1 , 0xf0
199+ };
200+
201+ tmp = sys_get_le16 (buf );
202+
203+ zassert_equal (tmp , val , "sys_get_le16() failed" );
204+ }
205+
206+ /**
207+ * @brief Test sys_put_le16() functionality
208+ *
209+ * @details Test if sys_put_le16() correctly handles endianness.
210+ *
211+ * @see sys_put_le16()
212+ */
213+ void test_sys_put_le16 (void )
214+ {
215+ u64_t val = 0xf0e1 ;
216+ u8_t buf [] = {
217+ 0xe1 , 0xf0
218+ };
219+ u8_t tmp [sizeof (u16_t )];
220+
221+ sys_put_le16 (val , tmp );
222+
223+ zassert_mem_equal (tmp , buf , sizeof (u16_t ), "sys_put_le16() failed" );
224+ }
225+
187226/**
188227 * @}
189228 */
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ extern void test_sys_get_be32(void);
1818extern void test_sys_put_be32 (void );
1919extern void test_sys_get_be16 (void );
2020extern void test_sys_put_be16 (void );
21+ extern void test_sys_get_le16 (void );
22+ extern void test_sys_put_le16 (void );
2123extern void test_atomic (void );
2224extern void test_intmath (void );
2325extern void test_printk (void );
@@ -107,6 +109,8 @@ void test_main(void)
107109 ztest_unit_test (test_sys_put_be32 ),
108110 ztest_unit_test (test_sys_get_be16 ),
109111 ztest_unit_test (test_sys_put_be16 ),
112+ ztest_unit_test (test_sys_get_le16 ),
113+ ztest_unit_test (test_sys_put_le16 ),
110114 ztest_user_unit_test (test_atomic ),
111115 ztest_unit_test (test_bitfield ),
112116 ztest_unit_test (test_printk ),
You can’t perform that action at this time.
0 commit comments