1 /*
2 * Copyright (c) 2024 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <inttypes.h>
8 #include <stddef.h>
9 #include <stdint.h>
10
11 #include "bs_types.h"
12 #include "bs_tracing.h"
13 #include "bs_utils.h"
14 #include "bstests.h"
15
16 #define WAIT_TIME 10 /* Seconds */
17
18 #define PASS_THRESHOLD 100 /* Audio packets */
19
20 extern enum bst_result_t bst_result;
21
22 #define FAIL(...) \
23 do { \
24 bst_result = Failed; \
25 bs_trace_error_time_line(__VA_ARGS__); \
26 } while (0)
27
28 #define PASS(...) \
29 do { \
30 bst_result = Passed; \
31 bs_trace_info_time(1, __VA_ARGS__); \
32 } while (0)
33
test_ccp_call_control_server_sample_init(void)34 static void test_ccp_call_control_server_sample_init(void)
35 {
36 bst_ticker_set_next_tick_absolute(WAIT_TIME * 1e6);
37 bst_result = In_progress;
38 }
39
test_ccp_call_control_server_sample_tick(bs_time_t HW_device_time)40 static void test_ccp_call_control_server_sample_tick(bs_time_t HW_device_time)
41 {
42 /* TODO: Once the sample is more complete we can expand the pass criteria */
43 PASS("CCP Call Control Server sample PASSED\n");
44 }
45
46 static const struct bst_test_instance test_sample[] = {
47 {
48 .test_id = "ccp_call_control_server",
49 .test_descr = "Test based on the CCP Call Control Server sample. "
50 "It expects to be connected to a compatible CCP Call Control Client, "
51 "waits for " STR(
52 WAIT_TIME) " seconds, and checks how "
53 "many audio packets have been received correctly",
54 .test_post_init_f = test_ccp_call_control_server_sample_init,
55 .test_tick_f = test_ccp_call_control_server_sample_tick,
56 },
57 BSTEST_END_MARKER,
58 };
59
60 static struct bst_test_list *
test_ccp_call_control_server_sample_install(struct bst_test_list * tests)61 test_ccp_call_control_server_sample_install(struct bst_test_list *tests)
62 {
63 tests = bst_add_tests(tests, test_sample);
64 return tests;
65 }
66
67 bst_test_install_t test_installers[] = {test_ccp_call_control_server_sample_install, NULL};
68