1 /*
2  * Copyright (c) 2023 Codecoup
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/bluetooth/audio/bap.h>
8 
9 #include "bap_unicast_server.h"
10 
11 /* List of fakes used by this unit tester */
12 #define FFF_FAKES_LIST(FAKE)                                                                       \
13 	FAKE(mock_bap_unicast_server_cb_config)                                                    \
14 	FAKE(mock_bap_unicast_server_cb_reconfig)                                                  \
15 	FAKE(mock_bap_unicast_server_cb_qos)                                                       \
16 	FAKE(mock_bap_unicast_server_cb_enable)                                                    \
17 	FAKE(mock_bap_unicast_server_cb_start)                                                     \
18 	FAKE(mock_bap_unicast_server_cb_metadata)                                                  \
19 	FAKE(mock_bap_unicast_server_cb_disable)                                                   \
20 	FAKE(mock_bap_unicast_server_cb_stop)                                                      \
21 	FAKE(mock_bap_unicast_server_cb_release)                                                   \
22 
mock_bap_unicast_server_init(void)23 void mock_bap_unicast_server_init(void)
24 {
25 	FFF_FAKES_LIST(RESET_FAKE);
26 }
27 
mock_bap_unicast_server_cleanup(void)28 void mock_bap_unicast_server_cleanup(void)
29 {
30 
31 }
32 
33 DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_config, struct bt_conn *,
34 		       const struct bt_bap_ep *, enum bt_audio_dir,
35 		       const struct bt_audio_codec_cfg *, struct bt_bap_stream **,
36 		       struct bt_audio_codec_qos_pref *const, struct bt_bap_ascs_rsp *);
37 DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_reconfig, struct bt_bap_stream *,
38 		       enum bt_audio_dir, const struct bt_audio_codec_cfg *,
39 		       struct bt_audio_codec_qos_pref *const, struct bt_bap_ascs_rsp *);
40 DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_qos, struct bt_bap_stream *,
41 		       const struct bt_audio_codec_qos *, struct bt_bap_ascs_rsp *);
42 DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_enable, struct bt_bap_stream *,
43 		       const uint8_t *, size_t, struct bt_bap_ascs_rsp *);
44 DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_start, struct bt_bap_stream *,
45 		       struct bt_bap_ascs_rsp *);
46 DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_metadata, struct bt_bap_stream *,
47 		       const uint8_t *, size_t, struct bt_bap_ascs_rsp *);
48 DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_disable, struct bt_bap_stream *,
49 		       struct bt_bap_ascs_rsp *);
50 DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_stop, struct bt_bap_stream *,
51 		       struct bt_bap_ascs_rsp *);
52 DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_release, struct bt_bap_stream *,
53 		       struct bt_bap_ascs_rsp *);
54 
55 const struct bt_bap_unicast_server_cb mock_bap_unicast_server_cb = {
56 	.config = mock_bap_unicast_server_cb_config,
57 	.reconfig = mock_bap_unicast_server_cb_reconfig,
58 	.qos = mock_bap_unicast_server_cb_qos,
59 	.enable = mock_bap_unicast_server_cb_enable,
60 	.start = mock_bap_unicast_server_cb_start,
61 	.metadata = mock_bap_unicast_server_cb_metadata,
62 	.disable = mock_bap_unicast_server_cb_disable,
63 	.stop = mock_bap_unicast_server_cb_stop,
64 	.release = mock_bap_unicast_server_cb_release,
65 };
66