ztest API Migration: bluetooth/hci_codecs_info

Migrate the unit tests at `bluetooth/hci_codecs_info` to use
the new ztest API.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
This commit is contained in:
Tristan Honscheid 2021-11-15 10:21:14 -07:00 committed by Carles Cufí
parent d76da3ee94
commit 4ea68e4604
2 changed files with 7 additions and 16 deletions

View file

@ -1,5 +1,6 @@
CONFIG_TEST=y
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_BT=y
CONFIG_BT_CTLR=y

View file

@ -48,7 +48,9 @@ uint8_t hci_vendor_read_vs_codecs(
return NUM_VS_CODECS;
}
void test_read_codecs(void)
ZTEST_SUITE(test_hci_codecs_info, NULL, NULL, NULL, NULL, NULL);
ZTEST(test_hci_codecs_info, test_read_codecs)
{
const struct bt_hci_rp_read_codecs *codecs;
struct net_buf *rsp;
@ -103,7 +105,7 @@ void test_read_codecs(void)
net_buf_unref(rsp);
}
void test_read_codecs_v2(void)
ZTEST(test_hci_codecs_info, test_read_codecs_v2)
{
const struct bt_hci_rp_read_codecs_v2 *codecs;
struct net_buf *rsp;
@ -205,7 +207,7 @@ uint8_t hci_vendor_read_codec_capabilities(uint8_t coding_format,
return 0;
}
void test_read_codec_capabilities(void)
ZTEST(test_hci_codecs_info, test_read_codec_capabilities)
{
struct bt_hci_cp_read_codec_capabilities *cp;
struct bt_hci_rp_read_codec_capabilities *rp;
@ -287,7 +289,7 @@ uint8_t hci_vendor_read_ctlr_delay(uint8_t coding_format,
return 0;
}
void test_read_ctlr_delay(void)
ZTEST(test_hci_codecs_info, test_read_ctlr_delay)
{
struct bt_hci_cp_read_ctlr_delay *cp;
struct bt_hci_rp_read_ctlr_delay *rp;
@ -324,15 +326,3 @@ void test_read_ctlr_delay(void)
zassert_equal(sys_get_le24(rp->max_ctlr_delay), MAX_CTLR_DELAY,
"Reading controller max delay failed");
}
/*test case main entry*/
void test_main(void)
{
ztest_test_suite(test_hci_codecs_info,
ztest_unit_test(test_read_codecs),
ztest_unit_test(test_read_codecs_v2),
ztest_unit_test(test_read_codec_capabilities),
ztest_unit_test(test_read_ctlr_delay));
ztest_run_test_suite(test_hci_codecs_info);
}