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 @@ -106,6 +106,45 @@ void test_sys_put_be64(void)
106106 zassert_mem_equal (tmp , buf , sizeof (u64_t ), "sys_put_be64() failed" );
107107}
108108
109+ /**
110+ * @brief Test sys_get_be32() functionality
111+ *
112+ * @details Test if sys_get_be32() correctly handles endianness.
113+ *
114+ * @see sys_get_be32()
115+ */
116+ void test_sys_get_be32 (void )
117+ {
118+ u32_t val = 0xf0e1d2c3 , tmp ;
119+ u8_t buf [] = {
120+ 0xf0 , 0xe1 , 0xd2 , 0xc3
121+ };
122+
123+ tmp = sys_get_be32 (buf );
124+
125+ zassert_equal (tmp , val , "sys_get_be32() failed" );
126+ }
127+
128+ /**
129+ * @brief Test sys_put_be32() functionality
130+ *
131+ * @details Test if sys_put_be32() correctly handles endianness.
132+ *
133+ * @see sys_put_be32()
134+ */
135+ void test_sys_put_be32 (void )
136+ {
137+ u64_t val = 0xf0e1d2c3 ;
138+ u8_t buf [] = {
139+ 0xf0 , 0xe1 , 0xd2 , 0xc3
140+ };
141+ u8_t tmp [sizeof (u32_t )];
142+
143+ sys_put_be32 (val , tmp );
144+
145+ zassert_mem_equal (tmp , buf , sizeof (u32_t ), "sys_put_be32() failed" );
146+ }
147+
109148/**
110149 * @}
111150 */
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ extern void test_byteorder_memcpy_swap(void);
1414extern void test_byteorder_mem_swap (void );
1515extern void test_sys_get_be64 (void );
1616extern void test_sys_put_be64 (void );
17+ extern void test_sys_get_be32 (void );
18+ extern void test_sys_put_be32 (void );
1719extern void test_atomic (void );
1820extern void test_intmath (void );
1921extern void test_printk (void );
@@ -99,6 +101,8 @@ void test_main(void)
99101 ztest_unit_test (test_byteorder_mem_swap ),
100102 ztest_unit_test (test_sys_get_be64 ),
101103 ztest_unit_test (test_sys_put_be64 ),
104+ ztest_unit_test (test_sys_get_be32 ),
105+ ztest_unit_test (test_sys_put_be32 ),
102106 ztest_user_unit_test (test_atomic ),
103107 ztest_unit_test (test_bitfield ),
104108 ztest_unit_test (test_printk ),
You can’t perform that action at this time.
0 commit comments