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)
106
106
zassert_mem_equal (tmp , buf , sizeof (u64_t ), "sys_put_be64() failed" );
107
107
}
108
108
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
+
109
148
/**
110
149
* @}
111
150
*/
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ extern void test_byteorder_memcpy_swap(void);
14
14
extern void test_byteorder_mem_swap (void );
15
15
extern void test_sys_get_be64 (void );
16
16
extern void test_sys_put_be64 (void );
17
+ extern void test_sys_get_be32 (void );
18
+ extern void test_sys_put_be32 (void );
17
19
extern void test_atomic (void );
18
20
extern void test_intmath (void );
19
21
extern void test_printk (void );
@@ -99,6 +101,8 @@ void test_main(void)
99
101
ztest_unit_test (test_byteorder_mem_swap ),
100
102
ztest_unit_test (test_sys_get_be64 ),
101
103
ztest_unit_test (test_sys_put_be64 ),
104
+ ztest_unit_test (test_sys_get_be32 ),
105
+ ztest_unit_test (test_sys_put_be32 ),
102
106
ztest_user_unit_test (test_atomic ),
103
107
ztest_unit_test (test_bitfield ),
104
108
ztest_unit_test (test_printk ),
You can’t perform that action at this time.
0 commit comments