1 /*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include "mocks/smp.h"
8 #include "mocks/smp_expects.h"
9
10 #include <zephyr/kernel.h>
11
expect_single_call_bt_smp_le_oob_generate_sc_data(struct bt_le_oob_sc_data * le_sc_oob)12 void expect_single_call_bt_smp_le_oob_generate_sc_data(struct bt_le_oob_sc_data *le_sc_oob)
13 {
14 const char *func_name = "bt_smp_le_oob_generate_sc_data";
15
16 zassert_equal(bt_smp_le_oob_generate_sc_data_fake.call_count, 1,
17 "'%s()' was called more than once", func_name);
18 }
19
expect_not_called_bt_smp_le_oob_generate_sc_data(void)20 void expect_not_called_bt_smp_le_oob_generate_sc_data(void)
21 {
22 const char *func_name = "bt_smp_le_oob_generate_sc_data";
23
24 zassert_equal(bt_smp_le_oob_generate_sc_data_fake.call_count, 0,
25 "'%s()' was called unexpectedly", func_name);
26 }
27
expect_single_call_bt_smp_le_oob_set_tk(struct bt_conn * conn,const uint8_t * tk)28 void expect_single_call_bt_smp_le_oob_set_tk(struct bt_conn *conn, const uint8_t *tk)
29 {
30 const char *func_name = "bt_smp_le_oob_set_tk";
31
32 zassert_equal(bt_smp_le_oob_set_tk_fake.call_count, 1, "'%s()' was called more than once",
33 func_name);
34
35 zassert_equal_ptr(bt_smp_le_oob_set_tk_fake.arg0_val, conn,
36 "'%s()' was called with incorrect '%s' value", func_name, "conn");
37 zassert_equal_ptr(bt_smp_le_oob_set_tk_fake.arg1_val, tk,
38 "'%s()' was called with incorrect '%s' value", func_name, "tk");
39 }
40
expect_single_call_bt_smp_le_oob_set_sc_data(struct bt_conn * conn,const struct bt_le_oob_sc_data * oobd_local,const struct bt_le_oob_sc_data * oobd_remote)41 void expect_single_call_bt_smp_le_oob_set_sc_data(struct bt_conn *conn,
42 const struct bt_le_oob_sc_data *oobd_local,
43 const struct bt_le_oob_sc_data *oobd_remote)
44 {
45 const char *func_name = "bt_smp_le_oob_set_sc_data";
46
47 zassert_equal(bt_smp_le_oob_set_sc_data_fake.call_count, 1,
48 "'%s()' was called more than once", func_name);
49
50 zassert_equal_ptr(bt_smp_le_oob_set_sc_data_fake.arg0_val, conn,
51 "'%s()' was called with incorrect '%s' value", func_name, "conn");
52 zassert_equal_ptr(bt_smp_le_oob_set_sc_data_fake.arg1_val, oobd_local,
53 "'%s()' was called with incorrect '%s' value", func_name, "oobd_local");
54 zassert_equal_ptr(bt_smp_le_oob_set_sc_data_fake.arg2_val, oobd_remote,
55 "'%s()' was called with incorrect '%s' value", func_name, "oobd_remote");
56 }
57
expect_single_call_bt_smp_le_oob_get_sc_data(struct bt_conn * conn,const struct bt_le_oob_sc_data ** oobd_local,const struct bt_le_oob_sc_data ** oobd_remote)58 void expect_single_call_bt_smp_le_oob_get_sc_data(struct bt_conn *conn,
59 const struct bt_le_oob_sc_data **oobd_local,
60 const struct bt_le_oob_sc_data **oobd_remote)
61 {
62 const char *func_name = "bt_smp_le_oob_get_sc_data";
63
64 zassert_equal(bt_smp_le_oob_get_sc_data_fake.call_count, 1,
65 "'%s()' was called more than once", func_name);
66
67 zassert_equal_ptr(bt_smp_le_oob_get_sc_data_fake.arg0_val, conn,
68 "'%s()' was called with incorrect '%s' value", func_name, "conn");
69 zassert_equal_ptr(bt_smp_le_oob_get_sc_data_fake.arg1_val, oobd_local,
70 "'%s()' was called with incorrect '%s' value", func_name, "oobd_local");
71 zassert_equal_ptr(bt_smp_le_oob_get_sc_data_fake.arg2_val, oobd_remote,
72 "'%s()' was called with incorrect '%s' value", func_name, "oobd_remote");
73 }
74