1 /*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include "testing_common_defs.h"
8
9 #include <zephyr/bluetooth/hci.h>
10 #include <zephyr/fff.h>
11 #include <zephyr/kernel.h>
12
13 #include <host/hci_core.h>
14 #include <host/id.h>
15
16 DEFINE_FFF_GLOBALS;
17
fff_reset_rule_before(const struct ztest_unit_test * test,void * fixture)18 static void fff_reset_rule_before(const struct ztest_unit_test *test, void *fixture)
19 {
20 memset(&bt_dev, 0x00, sizeof(struct bt_dev));
21 }
22
23 ZTEST_RULE(fff_reset_rule, fff_reset_rule_before, NULL);
24
25 ZTEST_SUITE(bt_br_oob_get_local, NULL, NULL, NULL, NULL, NULL);
26
27 /*
28 * Get BR/EDR local Out Of Band information
29 *
30 * Constraints:
31 * - Use a valid reference
32 *
33 * Expected behaviour:
34 * - Address is copied to the passed OOB reference
35 */
ZTEST(bt_br_oob_get_local,test_get_local_out_of_band_information)36 ZTEST(bt_br_oob_get_local, test_get_local_out_of_band_information)
37 {
38 int err;
39 struct bt_br_oob oob;
40
41 bt_addr_le_copy(&bt_dev.id_addr[0], BT_RPA_LE_ADDR);
42
43 err = bt_br_oob_get_local(&oob);
44
45 zassert_ok(err, "Unexpected error code '%d' was returned", err);
46 zassert_mem_equal(&oob.addr, &BT_RPA_LE_ADDR->a, sizeof(bt_addr_t),
47 "Incorrect address was set");
48 }
49