diff --git a/tests/kernel/common/src/byteorder.c b/tests/kernel/common/src/byteorder.c index 52a3d3ba075..ef22f2acef3 100644 --- a/tests/kernel/common/src/byteorder.c +++ b/tests/kernel/common/src/byteorder.c @@ -86,6 +86,26 @@ void test_sys_get_be64(void) zassert_equal(tmp, val, "sys_get_be64() failed"); } +/** + * @brief Test sys_put_be64() functionality + * + * @details Test if sys_put_be64() correctly handles endianness. + * + * @see sys_put_be64() + */ +void test_sys_put_be64(void) +{ + u64_t val = 0xf0e1d2c3b4a59687; + u8_t buf[] = { + 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 + }; + u8_t tmp[sizeof(u64_t)]; + + sys_put_be64(val, tmp); + + zassert_mem_equal(tmp, buf, sizeof(u64_t), "sys_put_be64() failed"); +} + /** * @} */ diff --git a/tests/kernel/common/src/main.c b/tests/kernel/common/src/main.c index 5c0e7bf5042..300a8de87da 100644 --- a/tests/kernel/common/src/main.c +++ b/tests/kernel/common/src/main.c @@ -13,6 +13,7 @@ extern void test_byteorder_memcpy_swap(void); extern void test_byteorder_mem_swap(void); extern void test_sys_get_be64(void); +extern void test_sys_put_be64(void); extern void test_atomic(void); extern void test_intmath(void); extern void test_printk(void); @@ -97,6 +98,7 @@ void test_main(void) ztest_unit_test(test_byteorder_memcpy_swap), ztest_unit_test(test_byteorder_mem_swap), ztest_unit_test(test_sys_get_be64), + ztest_unit_test(test_sys_put_be64), ztest_user_unit_test(test_atomic), ztest_unit_test(test_bitfield), ztest_unit_test(test_printk),