3030#include "zwave_controller_callbacks_mock.h"
3131#include "zwave_controller_internal_mock.h"
3232#include "zwave_controller_utils_mock.h"
33+ #include "zpc_config_mock.h"
3334
3435// Includes from this component
3536#include "zwave_rx_test.h"
@@ -43,12 +44,13 @@ static zwapi_callbacks_t *registered_zwapi_callbacks = NULL;
4344static zwapi_chip_data_t test_chip_data = {0 };
4445static zwapi_protocol_version_information_t test_protocol_version = {0 };
4546
46- static const zwave_rx_config_t my_test_configuration = {
47+ static const zpc_config_t my_test_configuration = {
4748 .serial_log_file = "" ,
4849 .serial_port = ZWAVE_RX_TEST_SERIAL_PORT ,
4950 .zwave_normal_tx_power_dbm = ZWAVE_RX_TEST_MAXIMUM_POWER_DBM ,
5051 .zwave_measured_0dbm_power = ZWAVE_RX_TEST_MEASURED_0DBM_POWER ,
5152 .zwave_rf_region = ZWAVE_RX_TEST_RF_REGION_STRING
53+ // All other fields will be zero-initialized
5254};
5355
5456// Stub function used for retrieving callbacks registered to the zwapi module
@@ -90,6 +92,7 @@ static void rx_init_successful_test_helper()
9092 zwapi_init_ExpectAndReturn (ZWAVE_RX_TEST_SERIAL_PORT , 0 , 0 , SL_STATUS_OK );
9193 zwapi_init_IgnoreArg_serial_fd ();
9294 zwapi_init_IgnoreArg_callbacks ();
95+ zpc_get_config_IgnoreAndReturn (& my_test_configuration );
9396 zwapi_log_to_file_enable_ExpectAndReturn ("" , SL_STATUS_OK );
9497 // 2. zwapi_get_chip_data returns a controller library type
9598 zwapi_get_chip_data_Stub (
@@ -138,7 +141,6 @@ static void rx_init_successful_test_helper()
138141
139142/// Setup the test suite (called once before all test_xxx functions are called)
140143void suiteSetUp () {
141- zwave_rx_set_config (& my_test_configuration );
142144}
143145
144146/// Teardown the test suite (called once after all test_xxx functions are called)
@@ -155,6 +157,7 @@ void setUp()
155157/// Test of rx init where enabling the log file fails
156158void test_zwave_rx_init_zwapi_init_log_file_fails (void )
157159{
160+ zpc_get_config_IgnoreAndReturn (& my_test_configuration );
158161 // Intialize Z-Wave RX, we expect it to call zwapi functions.
159162 zwapi_log_to_file_enable_ExpectAndReturn ("" , SL_STATUS_FAIL );
160163
@@ -166,6 +169,7 @@ void test_zwave_rx_init_zwapi_init_log_file_fails(void)
166169void test_zwave_rx_init_zwapi_init_fails (void )
167170{
168171 // Intialize Z-Wave RX, we expect it to call zwapi functions.
172+ zpc_get_config_IgnoreAndReturn (& my_test_configuration );
169173 zwapi_log_to_file_enable_ExpectAndReturn ("" , SL_STATUS_OK );
170174 zwapi_init_ExpectAndReturn (ZWAVE_RX_TEST_SERIAL_PORT , 0 , 0 , SL_STATUS_FAIL );
171175 zwapi_init_IgnoreArg_callbacks ();
@@ -184,6 +188,8 @@ void test_zwave_rx_init_wrong_library()
184188 || library == ZWAVE_LIBRARY_TYPE_CONTROLLER_STATIC ) {
185189 continue ;
186190 }
191+ zpc_get_config_IgnoreAndReturn (& my_test_configuration );
192+
187193 // Intialize Z-Wave RX, we expect it to call zwapi functions.
188194 zwapi_log_to_file_enable_ExpectAndReturn ("" , SL_STATUS_OK );
189195 zwapi_init_ExpectAndReturn (ZWAVE_RX_TEST_SERIAL_PORT , 0 , 0 , SL_STATUS_OK );
@@ -211,6 +217,7 @@ void test_zwave_rx_init_not_gecko_chip()
211217 zwapi_init_ExpectAndReturn (ZWAVE_RX_TEST_SERIAL_PORT , 0 , 0 , SL_STATUS_OK );
212218 zwapi_init_IgnoreArg_callbacks ();
213219 zwapi_init_IgnoreArg_serial_fd ();
220+ zpc_get_config_IgnoreAndReturn (& my_test_configuration );
214221 zwapi_log_to_file_enable_ExpectAndReturn ("" , SL_STATUS_OK );
215222
216223 // 2. zwapi_get_chip_data returns a controller library type
@@ -254,6 +261,7 @@ void test_zwave_rx_init_cannot_set_rf_resgion()
254261 zwapi_init_ExpectAndReturn (ZWAVE_RX_TEST_SERIAL_PORT , 0 , 0 , SL_STATUS_OK );
255262 zwapi_init_IgnoreArg_callbacks ();
256263 zwapi_init_IgnoreArg_serial_fd ();
264+ zpc_get_config_IgnoreAndReturn (& my_test_configuration );
257265 zwapi_log_to_file_enable_ExpectAndReturn ("" , SL_STATUS_OK );
258266
259267 // 2. zwapi_get_chip_data returns a controller library type
@@ -293,6 +301,7 @@ void test_zwave_rx_init_failure_lr_max_power()
293301 zwapi_init_ExpectAndReturn (ZWAVE_RX_TEST_SERIAL_PORT , 0 , 0 , SL_STATUS_OK );
294302 zwapi_init_IgnoreArg_callbacks ();
295303 zwapi_init_IgnoreArg_serial_fd ();
304+ zpc_get_config_IgnoreAndReturn (& my_test_configuration );
296305 zwapi_log_to_file_enable_ExpectAndReturn ("" , SL_STATUS_OK );
297306
298307 // 2. zwapi_get_chip_data returns a controller library type
@@ -353,6 +362,7 @@ void test_zwave_rx_init_non_critical_failures()
353362 zwapi_init_ExpectAndReturn (ZWAVE_RX_TEST_SERIAL_PORT , 0 , 0 , SL_STATUS_OK );
354363 zwapi_init_IgnoreArg_callbacks ();
355364 zwapi_init_IgnoreArg_serial_fd ();
365+ zpc_get_config_IgnoreAndReturn (& my_test_configuration );
356366 zwapi_log_to_file_enable_ExpectAndReturn ("" , SL_STATUS_OK );
357367
358368 // 2. zwapi_get_chip_data returns a controller library type
0 commit comments