1313#include <zephyr/sys/byteorder.h>
1414#include <host/hci_core.h>
1515
16+ #include <bt_common.h>
1617#include "common.h"
1718
1819/* Macros delivering common values for unit tests */
@@ -74,7 +75,7 @@ int send_set_cl_cte_tx_params(uint8_t adv_handle, uint8_t cte_len,
7475 buf , NULL );
7576}
7677
77- void test_set_cl_cte_tx_params_with_correct_aod_2us ( void )
78+ ZTEST ( test_set_cl_cte_tx_param , test_set_cl_cte_tx_params_with_correct_aod_2us )
7879{
7980 int err ;
8081
@@ -87,7 +88,7 @@ void test_set_cl_cte_tx_params_with_correct_aod_2us(void)
8788 zassert_equal (err , 0 , "Set AoD 2us CTE parameters failed" );
8889}
8990
90- void test_set_cl_cte_tx_params_with_correct_aod_1us ( void )
91+ ZTEST ( test_set_cl_cte_tx_param , test_set_cl_cte_tx_params_with_correct_aod_1us )
9192{
9293 int err ;
9394
@@ -100,7 +101,7 @@ void test_set_cl_cte_tx_params_with_correct_aod_1us(void)
100101 zassert_equal (err , 0 , "Set AoD 1us CTE parameters failed" );
101102}
102103
103- void test_set_ct_cte_tx_params_correct_aoa ( void )
104+ ZTEST ( test_set_cl_cte_tx_param , test_set_ct_cte_tx_params_correct_aoa )
104105{
105106 int err ;
106107
@@ -113,7 +114,7 @@ void test_set_ct_cte_tx_params_correct_aoa(void)
113114 zassert_equal (err , - EIO , "Set AoA CTE parameters failed" );
114115}
115116
116- void test_set_ct_cte_tx_params_correct_aoa_without_ant_pattern ( void )
117+ ZTEST ( test_set_cl_cte_tx_param , test_set_ct_cte_tx_params_correct_aoa_without_ant_pattern )
117118{
118119 int err ;
119120
@@ -126,7 +127,7 @@ void test_set_ct_cte_tx_params_correct_aoa_without_ant_pattern(void)
126127 zassert_equal (err , - EIO , "Set AoA CTE parameters failed" );
127128}
128129
129- void test_set_ct_cte_tx_params_wrong_adv_handle ( void )
130+ ZTEST ( test_set_cl_cte_tx_param , test_set_ct_cte_tx_params_wrong_adv_handle )
130131{
131132 int err ;
132133
@@ -140,7 +141,7 @@ void test_set_ct_cte_tx_params_wrong_adv_handle(void)
140141 "Unexpected error value for invalid adv handle" );
141142}
142143
143- void test_set_ct_cte_tx_params_invalid_cte_len ( void )
144+ ZTEST ( test_set_cl_cte_tx_param , test_set_ct_cte_tx_params_invalid_cte_len )
144145{
145146 int err ;
146147
@@ -154,7 +155,7 @@ void test_set_ct_cte_tx_params_invalid_cte_len(void)
154155 "Unexpected error value for invalid CTE length" );
155156}
156157
157- void test_set_ct_cte_tx_params_invalid_cte_type ( void )
158+ ZTEST ( test_set_cl_cte_tx_param , test_set_ct_cte_tx_params_invalid_cte_type )
158159{
159160 int err ;
160161
@@ -168,7 +169,7 @@ void test_set_ct_cte_tx_params_invalid_cte_type(void)
168169 "Unexpected error value for invalid CTE type" );
169170}
170171
171- void test_set_ct_cte_tx_params_invalid_cte_count ( void )
172+ ZTEST ( test_set_cl_cte_tx_param , test_set_ct_cte_tx_params_invalid_cte_count )
172173{
173174 int err ;
174175
@@ -182,7 +183,7 @@ void test_set_ct_cte_tx_params_invalid_cte_count(void)
182183 "Unexpected error value for invalid CTE count" );
183184}
184185
185- void test_set_ct_cte_tx_params_aod_2us_invalid_pattern_len ( void )
186+ ZTEST ( test_set_cl_cte_tx_param , test_set_ct_cte_tx_params_aod_2us_invalid_pattern_len )
186187{
187188 int err ;
188189
@@ -196,7 +197,7 @@ void test_set_ct_cte_tx_params_aod_2us_invalid_pattern_len(void)
196197 "Unexpected error value for invalid switch pattern len" );
197198}
198199
199- void test_set_ct_cte_tx_params_aod_1us_invalid_pattern_len ( void )
200+ ZTEST ( test_set_cl_cte_tx_param , test_set_ct_cte_tx_params_aod_1us_invalid_pattern_len )
200201{
201202 int err ;
202203
@@ -210,7 +211,7 @@ void test_set_ct_cte_tx_params_aod_1us_invalid_pattern_len(void)
210211 "Unexpected error value for invalid switch pattern len" );
211212}
212213
213- void test_set_ct_cte_tx_params_aoa_invalid_pattern_len ( void )
214+ ZTEST ( test_set_cl_cte_tx_param , test_set_ct_cte_tx_params_aoa_invalid_pattern_len )
214215{
215216 int err ;
216217
@@ -223,23 +224,21 @@ void test_set_ct_cte_tx_params_aoa_invalid_pattern_len(void)
223224 zassert_equal (err , 0 , "Unexpected error value for AoA" );
224225}
225226
226- static bool enabled_set_cl_cte_tx_para ( const void * state )
227+ static void * common_adv_set_setup ( void )
227228{
228- const struct bt_test_state * s = state ;
229+ ut_bt_setup () ;
229230
230- return s -> is_setup && s -> is_adv_set_created ;
231+ common_create_adv_set ();
232+
233+ return NULL ;
234+ }
235+
236+ static void common_adv_set_teardown (void * data )
237+ {
238+ common_delete_adv_set ();
239+
240+ ut_bt_teardown (data );
231241}
232242
233- ztest_register_test_suite (
234- test_set_cl_cte_tx_param , enabled_set_cl_cte_tx_para ,
235- ztest_unit_test (test_set_cl_cte_tx_params_with_correct_aod_2us ),
236- ztest_unit_test (test_set_cl_cte_tx_params_with_correct_aod_1us ),
237- ztest_unit_test (test_set_ct_cte_tx_params_correct_aoa ),
238- ztest_unit_test (test_set_ct_cte_tx_params_correct_aoa_without_ant_pattern ),
239- ztest_unit_test (test_set_ct_cte_tx_params_wrong_adv_handle ),
240- ztest_unit_test (test_set_ct_cte_tx_params_invalid_cte_len ),
241- ztest_unit_test (test_set_ct_cte_tx_params_invalid_cte_type ),
242- ztest_unit_test (test_set_ct_cte_tx_params_invalid_cte_count ),
243- ztest_unit_test (test_set_ct_cte_tx_params_aod_2us_invalid_pattern_len ),
244- ztest_unit_test (test_set_ct_cte_tx_params_aod_1us_invalid_pattern_len ),
245- ztest_unit_test (test_set_ct_cte_tx_params_aoa_invalid_pattern_len ));
243+ ZTEST_SUITE (test_set_cl_cte_tx_param , NULL , common_adv_set_setup , NULL , NULL ,
244+ common_adv_set_teardown );
0 commit comments