tests: drivers: can: api: add test for can_set_bitrate()
Add test for the can_set_bitrate() syscall. Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
parent
d5f3f20edb
commit
77fa7709e4
1 changed files with 17 additions and 0 deletions
|
@ -15,6 +15,11 @@
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test bitrate in bits/second.
|
||||||
|
*/
|
||||||
|
#define TEST_BITRATE 125000
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Test timeouts.
|
* @brief Test timeouts.
|
||||||
*/
|
*/
|
||||||
|
@ -634,6 +639,17 @@ static void test_set_bitrate_too_high(void)
|
||||||
zassert_equal(err, -ENOTSUP, "too high bitrate accepted");
|
zassert_equal(err, -ENOTSUP, "too high bitrate accepted");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Test setting bitrate.
|
||||||
|
*/
|
||||||
|
static void test_set_bitrate(void)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = can_set_bitrate(can_dev, TEST_BITRATE, 0);
|
||||||
|
zassert_equal(err, 0, "failed to set bitrate");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Test configuring the CAN controller for loopback mode.
|
* @brief Test configuring the CAN controller for loopback mode.
|
||||||
*
|
*
|
||||||
|
@ -903,6 +919,7 @@ void test_main(void)
|
||||||
ztest_user_unit_test(test_get_core_clock),
|
ztest_user_unit_test(test_get_core_clock),
|
||||||
ztest_unit_test(test_set_state_change_callback),
|
ztest_unit_test(test_set_state_change_callback),
|
||||||
ztest_user_unit_test(test_set_bitrate_too_high),
|
ztest_user_unit_test(test_set_bitrate_too_high),
|
||||||
|
ztest_user_unit_test(test_set_bitrate),
|
||||||
ztest_user_unit_test(test_set_loopback),
|
ztest_user_unit_test(test_set_loopback),
|
||||||
ztest_user_unit_test(test_send_and_forget),
|
ztest_user_unit_test(test_send_and_forget),
|
||||||
ztest_unit_test(test_add_filter),
|
ztest_unit_test(test_add_filter),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue