1 /*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include "mocks/net_buf.h"
8 #include "mocks/net_buf_expects.h"
9
10 #include <zephyr/bluetooth/buf.h>
11 #include <zephyr/kernel.h>
12
expect_single_call_net_buf_simple_add(struct net_buf_simple * buf,size_t len)13 void expect_single_call_net_buf_simple_add(struct net_buf_simple *buf, size_t len)
14 {
15 const char *func_name = "net_buf_simple_add";
16
17 zassert_equal(net_buf_simple_add_fake.call_count, 1, "'%s()' was called more than once",
18 func_name);
19
20 zassert_equal(net_buf_simple_add_fake.arg0_val, buf,
21 "'%s()' was called with incorrect '%s' value", func_name, "buf");
22 zassert_equal(net_buf_simple_add_fake.arg1_val, len,
23 "'%s()' was called with incorrect '%s' value", func_name, "len");
24 }
25
expect_not_called_net_buf_simple_add(void)26 void expect_not_called_net_buf_simple_add(void)
27 {
28 const char *func_name = "net_buf_simple_add";
29
30 zassert_equal(net_buf_simple_add_fake.call_count, 0, "'%s()' was called unexpectedly",
31 func_name);
32 }
33