1 /*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <zephyr/kernel.h>
8 #include <zephyr/bluetooth/buf.h>
9 #include "mocks/settings.h"
10 #include "mocks/settings_expects.h"
11
expect_single_call_bt_settings_encode_key_with_not_null_key(const bt_addr_le_t * addr)12 void expect_single_call_bt_settings_encode_key_with_not_null_key(const bt_addr_le_t *addr)
13 {
14 const char *func_name = "bt_settings_encode_key";
15
16 zassert_equal(bt_settings_encode_key_fake.call_count, 1, "'%s()' was called more than once",
17 func_name);
18 zassert_not_null(bt_settings_encode_key_fake.arg0_val,
19 "'%s()' was called with incorrect '%s' value", func_name, "path");
20 zassert_true(bt_settings_encode_key_fake.arg1_val != 0,
21 "'%s()' was called with incorrect '%s' value", func_name, "path_size");
22 zassert_not_null(bt_settings_encode_key_fake.arg2_val,
23 "'%s()' was called with incorrect '%s' value", func_name, "subsys");
24 zassert_equal_ptr(bt_settings_encode_key_fake.arg3_val, addr,
25 "'%s()' was called with incorrect '%s' value", func_name, "addr");
26 zassert_not_null(bt_settings_encode_key_fake.arg4_val,
27 "'%s()' was called with incorrect '%s' value", func_name, "key");
28 }
29
expect_single_call_bt_settings_encode_key_with_null_key(const bt_addr_le_t * addr)30 void expect_single_call_bt_settings_encode_key_with_null_key(const bt_addr_le_t *addr)
31 {
32 const char *func_name = "bt_settings_encode_key";
33
34 zassert_equal(bt_settings_encode_key_fake.call_count, 1,
35 "'%s()' was called more than once (%d)", func_name,
36 bt_settings_encode_key_fake.call_count);
37 zassert_not_null(bt_settings_encode_key_fake.arg0_val,
38 "'%s()' was called with incorrect '%s' value", func_name, "path");
39 zassert_true(bt_settings_encode_key_fake.arg1_val != 0,
40 "'%s()' was called with incorrect '%s' value", func_name, "path_size");
41 zassert_not_null(bt_settings_encode_key_fake.arg2_val,
42 "'%s()' was called with incorrect '%s' value", func_name, "subsys");
43 zassert_equal_ptr(bt_settings_encode_key_fake.arg3_val, addr,
44 "'%s()' was called with incorrect '%s' value", func_name, "addr");
45 zassert_equal_ptr(bt_settings_encode_key_fake.arg4_val, NULL,
46 "'%s()' was called with incorrect '%s' value", func_name, "key");
47 }
48
expect_not_called_bt_settings_encode_key(void)49 void expect_not_called_bt_settings_encode_key(void)
50 {
51 const char *func_name = "bt_settings_encode_key";
52
53 zassert_equal(bt_settings_encode_key_fake.call_count, 0, "'%s()' was called unexpectedly",
54 func_name);
55 }
56