1 /*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include "mocks/conn.h"
8 #include "mocks/conn_expects.h"
9
10 #include <zephyr/kernel.h>
11
expect_single_call_bt_conn_lookup_state_le(uint8_t id,const bt_addr_le_t * peer,const bt_conn_state_t state)12 void expect_single_call_bt_conn_lookup_state_le(uint8_t id, const bt_addr_le_t *peer,
13 const bt_conn_state_t state)
14 {
15 const char *func_name = "bt_conn_lookup_state_le";
16
17 zassert_equal(bt_conn_lookup_state_le_fake.call_count, 1,
18 "'%s()' was called more than once", func_name);
19
20 zassert_equal(bt_conn_lookup_state_le_fake.arg0_val, id,
21 "'%s()' was called with incorrect '%s' value", func_name, "id");
22 zassert_equal_ptr(bt_conn_lookup_state_le_fake.arg1_val, peer,
23 "'%s()' was called with incorrect '%s' value", func_name, "peer");
24 zassert_equal(bt_conn_lookup_state_le_fake.arg2_val, state,
25 "'%s()' was called with incorrect '%s' value", func_name, "state");
26 }
27
expect_not_called_bt_conn_lookup_state_le(void)28 void expect_not_called_bt_conn_lookup_state_le(void)
29 {
30 const char *func_name = "bt_conn_lookup_state_le";
31
32 zassert_equal(bt_conn_lookup_state_le_fake.call_count, 0, "'%s()' was called unexpectedly",
33 func_name);
34 }
35
expect_single_call_bt_conn_unref(struct bt_conn * conn)36 void expect_single_call_bt_conn_unref(struct bt_conn *conn)
37 {
38 const char *func_name = "bt_conn_unref";
39
40 zassert_equal(bt_conn_unref_fake.call_count, 1, "'%s()' was called more than once",
41 func_name);
42
43 zassert_equal_ptr(bt_conn_unref_fake.arg0_val, conn,
44 "'%s()' was called with incorrect '%s' value", func_name, "conn");
45 }
46
expect_not_called_bt_conn_unref(void)47 void expect_not_called_bt_conn_unref(void)
48 {
49 const char *func_name = "bt_conn_unref";
50
51 zassert_equal(bt_conn_unref_fake.call_count, 0, "'%s()' was called unexpectedly",
52 func_name);
53 }
54