1 /*
2  * Copyright (c) 2022 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "mocks/keys.h"
8 #include "mocks/keys_expects.h"
9 
10 #include <zephyr/kernel.h>
11 
expect_single_call_bt_keys_find_irk(uint8_t id,const bt_addr_le_t * addr)12 void expect_single_call_bt_keys_find_irk(uint8_t id, const bt_addr_le_t *addr)
13 {
14 	const char *func_name = "bt_keys_find_irk";
15 
16 	zassert_equal(bt_keys_find_irk_fake.call_count, 1, "'%s()' was called more than once",
17 		      func_name);
18 
19 	zassert_equal(bt_keys_find_irk_fake.arg0_val, id,
20 		      "'%s()' was called with incorrect '%s' value", func_name, "id");
21 	zassert_equal(bt_keys_find_irk_fake.arg1_val, addr,
22 		      "'%s()' was called with incorrect '%s' value", func_name, "addr");
23 }
24 
expect_not_called_bt_keys_find_irk(void)25 void expect_not_called_bt_keys_find_irk(void)
26 {
27 	const char *func_name = "bt_keys_find_irk";
28 
29 	zassert_equal(bt_keys_find_irk_fake.call_count, 0, "'%s()' was called unexpectedly",
30 		      func_name);
31 }
32 
expect_single_call_bt_keys_foreach_type(enum bt_keys_type type)33 void expect_single_call_bt_keys_foreach_type(enum bt_keys_type type)
34 {
35 	const char *func_name = "bt_keys_foreach_type";
36 
37 	zassert_equal(bt_keys_foreach_type_fake.call_count, 1, "'%s()' was called more than once",
38 		      func_name);
39 
40 	zassert_equal(bt_keys_foreach_type_fake.arg0_val, type,
41 		      "'%s()' was called with incorrect '%s' value", func_name, "type");
42 	zassert_not_null(bt_keys_foreach_type_fake.arg1_val,
43 			 "'%s()' was called with incorrect '%s' value", func_name, "func");
44 }
45 
expect_not_called_bt_keys_foreach_type(void)46 void expect_not_called_bt_keys_foreach_type(void)
47 {
48 	const char *func_name = "bt_keys_foreach_type";
49 
50 	zassert_equal(bt_keys_foreach_type_fake.call_count, 0, "'%s()' was called unexpectedly",
51 		      func_name);
52 }
53