tests: kernel: Add unit test for sys_get_be64()
Make sure sys_get_be64() works as expected. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
0a6a10d0c4
commit
bbac6e5ca0
2 changed files with 22 additions and 0 deletions
|
@ -66,6 +66,26 @@ void test_byteorder_mem_swap(void)
|
|||
zassert_true((memcmp(buf_orig_2, buf_chk_2, 11) == 0),
|
||||
"Swapping buffer failed");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test sys_get_be64() functionality
|
||||
*
|
||||
* @details Test if sys_get_be64() correctly handles endianness.
|
||||
*
|
||||
* @see sys_get_be64()
|
||||
*/
|
||||
void test_sys_get_be64(void)
|
||||
{
|
||||
u64_t val = 0xf0e1d2c3b4a59687, tmp;
|
||||
u8_t buf[] = {
|
||||
0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87
|
||||
};
|
||||
|
||||
tmp = sys_get_be64(buf);
|
||||
|
||||
zassert_equal(tmp, val, "sys_get_be64() failed");
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -12,6 +12,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_atomic(void);
|
||||
extern void test_intmath(void);
|
||||
extern void test_printk(void);
|
||||
|
@ -95,6 +96,7 @@ void test_main(void)
|
|||
ztest_unit_test(test_irq_offload),
|
||||
ztest_unit_test(test_byteorder_memcpy_swap),
|
||||
ztest_unit_test(test_byteorder_mem_swap),
|
||||
ztest_unit_test(test_sys_get_be64),
|
||||
ztest_user_unit_test(test_atomic),
|
||||
ztest_unit_test(test_bitfield),
|
||||
ztest_unit_test(test_printk),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue