tests: Bluetooth: MCC: Add invalid testing of bt_mcc_send_search

Add invalid testing of bt_mcc_send_search.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2023-02-10 14:59:08 +01:00 committed by Carles Cufí
commit 9cfdd53082

View file

@ -1343,10 +1343,46 @@ static void test_cp_goto_group(void)
static void test_search(void)
{
struct mpl_search search;
struct mpl_search search = { 0 };
struct mpl_sci sci = {0};
int err;
/* Invalid behavior */
err = bt_mcc_read_search_results_obj_id(NULL);
if (err == 0) {
FAIL("bt_mcc_read_search_results_obj_id did not fail with NULL conn");
return;
}
err = bt_mcc_send_search(NULL, &search);
if (err == 0) {
FAIL("bt_mcc_send_search did not fail with NULL conn");
return;
}
err = bt_mcc_send_search(default_conn, NULL);
if (err == 0) {
FAIL("bt_mcc_send_search did not fail with NULL search");
return;
}
search.len = SEARCH_LEN_MAX + 1;
err = bt_mcc_send_search(default_conn, &search);
if (err == 0) {
FAIL("bt_mcc_send_search did not fail with search len above max");
return;
}
search.len = SEARCH_LEN_MIN - 1;
err = bt_mcc_send_search(default_conn, &search);
if (err == 0) {
FAIL("bt_mcc_send_search did not fail with search len below min");
return;
}
/* Valid behavior */
/* Test outline:
* - verify that the search results object ID is zero before search
* - write a search (one search control item) to the search control point,