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)
184
184
zassert_mem_equal (tmp , buf , sizeof (u16_t ), "sys_put_be16() failed" );
185
185
}
186
186
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
+
187
226
/**
188
227
* @}
189
228
*/
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ extern void test_sys_get_be32(void);
18
18
extern void test_sys_put_be32 (void );
19
19
extern void test_sys_get_be16 (void );
20
20
extern void test_sys_put_be16 (void );
21
+ extern void test_sys_get_le16 (void );
22
+ extern void test_sys_put_le16 (void );
21
23
extern void test_atomic (void );
22
24
extern void test_intmath (void );
23
25
extern void test_printk (void );
@@ -107,6 +109,8 @@ void test_main(void)
107
109
ztest_unit_test (test_sys_put_be32 ),
108
110
ztest_unit_test (test_sys_get_be16 ),
109
111
ztest_unit_test (test_sys_put_be16 ),
112
+ ztest_unit_test (test_sys_get_le16 ),
113
+ ztest_unit_test (test_sys_put_le16 ),
110
114
ztest_user_unit_test (test_atomic ),
111
115
ztest_unit_test (test_bitfield ),
112
116
ztest_unit_test (test_printk ),
You can’t perform that action at this time.
0 commit comments