1 /*
2  * Copyright (c) 2022 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "host_mocks/assert.h"
8 
9 #include <zephyr/bluetooth/hci.h>
10 #include <zephyr/kernel.h>
11 #include <zephyr/ztest.h>
12 
13 #include <host/hci_core.h>
14 #include <host/id.h>
15 #include <host/keys.h>
16 
17 ZTEST_SUITE(bt_id_del_invalid_inputs, NULL, NULL, NULL, NULL, NULL);
18 
19 /*
20  *  Test passing NULL value for keys reference
21  *
22  *  Constraints:
23  *   - Keys reference is passed as NULL
24  *
25  *  Expected behaviour:
26  *   - An assertion is raised and execution stops
27  */
ZTEST(bt_id_del_invalid_inputs,test_null_keys_ref)28 ZTEST(bt_id_del_invalid_inputs, test_null_keys_ref)
29 {
30 	expect_assert();
31 	bt_id_del(NULL);
32 }
33 
34 /*
35  *  Test deleting key from the resolving list when size resolving list is zero
36  *
37  *  Constraints:
38  *   - bt_dev.le.rl_size is set to 0
39  *   - bt_dev.le.rl_entries is set to 0
40  *
41  *  Expected behaviour:
42  *   - An assertion is raised and execution stops
43  */
ZTEST(bt_id_del_invalid_inputs,test_zero_controller_list_size)44 ZTEST(bt_id_del_invalid_inputs, test_zero_controller_list_size)
45 {
46 	struct bt_keys keys = {0};
47 
48 	bt_dev.le.rl_size = 0;
49 	bt_dev.le.rl_entries = 0;
50 
51 	expect_assert();
52 	bt_id_del(&keys);
53 }
54