tests: ztest: Added return data test case
Added test case to test ztest_return_data and ztest_copy_return_data. Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
This commit is contained in:
parent
4a9a49a185
commit
4db2ecae2e
1 changed files with 18 additions and 1 deletions
|
@ -52,12 +52,29 @@ static void test_multi_value_tests(void)
|
|||
expect_two_parameters(2, 3);
|
||||
}
|
||||
|
||||
static void returns_data(uint8_t *buf, size_t buf_size)
|
||||
{
|
||||
ztest_copy_return_data(buf, buf_size);
|
||||
}
|
||||
|
||||
static void test_return_data_tests(void)
|
||||
{
|
||||
uint8_t expected_data[] = { 0x5A, 0xA5, 0xDE, 0xAD };
|
||||
uint8_t data[] = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
|
||||
ztest_expect_data(returns_data, buf, expected_data);
|
||||
|
||||
returns_data(data, sizeof(data));
|
||||
zassert_mem_equal(expected_data, data, sizeof(data), NULL);
|
||||
}
|
||||
|
||||
void test_main(void)
|
||||
{
|
||||
ztest_test_suite(mock_framework_tests,
|
||||
ztest_unit_test(test_parameter_tests),
|
||||
ztest_unit_test(test_return_value_tests),
|
||||
ztest_unit_test(test_multi_value_tests)
|
||||
ztest_unit_test(test_multi_value_tests),
|
||||
ztest_unit_test(test_return_data_tests)
|
||||
);
|
||||
|
||||
ztest_run_test_suite(mock_framework_tests);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue