1 /*
2  * Copyright (c) 2023 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "bs_bt_utils.h"
8 #include "bstests.h"
9 
10 void tester_procedure(void);
11 void tester_procedure_periph_delayed_start_of_conn_adv(void);
12 void dut_procedure(void);
13 void dut_procedure_connect_short_rpa_timeout(void);
14 void dut_procedure_connect_timeout(void);
15 
16 static const struct bst_test_instance test_to_add[] = {
17 	{
18 		.test_id = "central",
19 		.test_descr = "Central performs active scanning using RPA",
20 		.test_pre_init_f = test_init,
21 		.test_tick_f = test_tick,
22 		.test_main_f = dut_procedure,
23 	},
24 	{
25 		.test_id = "central_connect_short_rpa_timeout",
26 		.test_descr = "Central connects to a peripheral using a short RPA timeout",
27 		.test_pre_init_f = test_init,
28 		.test_tick_f = test_tick,
29 		.test_main_f = dut_procedure_connect_short_rpa_timeout,
30 	},
31 	{
32 		.test_id = "central_connect_fails_with_short_rpa_timeout",
33 		.test_descr = "Central connects to a peripheral using a short RPA timeout"
34 			      " but expects connection establishment to time out.",
35 		.test_pre_init_f = test_init,
36 		.test_tick_f = test_tick,
37 		.test_main_f = dut_procedure_connect_timeout,
38 	},
39 	{
40 		.test_id = "peripheral",
41 		.test_descr = "Performs scannable advertising, validates that the scanner"
42 			      " RPA address refreshes",
43 		.test_pre_init_f = test_init,
44 		.test_tick_f = test_tick,
45 		.test_main_f = tester_procedure,
46 	},
47 	{
48 		.test_id = "periph_delayed_start_of_conn_adv",
49 		.test_descr = "Performs connectable advertising. "
50 			      "The advertiser is stopped for 10 seconds when instructed by the DUT"
51 			      " to allow it to run the initiator for longer than its RPA timeout.",
52 		.test_post_init_f = test_init,
53 		.test_tick_f = test_tick,
54 		.test_main_f = tester_procedure_periph_delayed_start_of_conn_adv,
55 	},
56 	BSTEST_END_MARKER,
57 };
58 
install(struct bst_test_list * tests)59 static struct bst_test_list *install(struct bst_test_list *tests)
60 {
61 	return bst_add_tests(tests, test_to_add);
62 };
63 
64 bst_test_install_t test_installers[] = {install, NULL};
65 
main(void)66 int main(void)
67 {
68 	bst_main();
69 	return 0;
70 }
71