1818#include "cmock_watchdog_app.h"
1919
2020#include "app_module_event.h"
21- #include "location_module_event.h"
2221#include "debug_module_event.h"
2322#include "data_module_event.h"
2423
@@ -29,7 +28,6 @@ extern struct event_listener __event_listener_debug_module;
2928 */
3029static struct app_module_event app_module_event_memory ;
3130static struct data_module_event data_module_event_memory ;
32- static struct location_module_event location_module_event_memory ;
3331static struct debug_module_event debug_module_event_memory ;
3432
3533#define DEBUG_MODULE_EVT_HANDLER (aeh ) __event_listener_debug_module.notification(aeh)
@@ -38,7 +36,6 @@ static struct debug_module_event debug_module_event_memory;
3836 * depend on these to exist. But since we are unit testing, we dont need
3937 * these subscriptions and hence these structs can remain uninitialized.
4038 */
41- struct event_type __event_type_location_module_event ;
4239struct event_type __event_type_debug_module_event ;
4340struct event_type __event_type_app_module_event ;
4441struct event_type __event_type_data_module_event ;
@@ -108,62 +105,6 @@ void setup_debug_module_in_init_state(void)
108105 app_event_manager_free (app_module_event );
109106}
110107
111- /* Test whether the correct Memfault metrics are set upon a GNSS fix. */
112- void test_memfault_trigger_metric_sampling_on_gnss_fix (void )
113- {
114- setup_debug_module_in_init_state ();
115-
116- __cmock_memfault_metrics_heartbeat_set_unsigned_ExpectAndReturn (
117- MEMFAULT_METRICS_KEY (gnss_time_to_fix_ms ), 60000 , 0 );
118- __cmock_memfault_metrics_heartbeat_set_unsigned_ExpectAndReturn (
119- MEMFAULT_METRICS_KEY (gnss_satellites_tracked_count ),
120- 4 ,
121- 0 );
122- __cmock_memfault_metrics_heartbeat_debug_trigger_Expect ();
123-
124- __cmock_app_event_manager_alloc_ExpectAnyArgsAndReturn (& location_module_event_memory );
125- __cmock_app_event_manager_free_ExpectAnyArgs ();
126- struct location_module_event * location_module_event = new_location_module_event ();
127-
128- location_module_event -> type = LOCATION_MODULE_EVT_GNSS_DATA_READY ;
129- location_module_event -> data .location .satellites_tracked = 4 ;
130- location_module_event -> data .location .search_time = 60000 ;
131-
132- TEST_ASSERT_EQUAL (0 , DEBUG_MODULE_EVT_HANDLER (
133- (struct app_event_header * )location_module_event ));
134- app_event_manager_free (location_module_event );
135- }
136-
137- /* Test whether the correct Memfault metrics are set upon a GNSS timeout. */
138- void test_memfault_trigger_metric_sampling_on_location_timeout (void )
139- {
140- resetTest ();
141- setup_debug_module_in_init_state ();
142-
143- /* Update this function to expect the search time and number of satellites. */
144- __cmock_memfault_metrics_heartbeat_set_unsigned_ExpectAndReturn (
145- MEMFAULT_METRICS_KEY (location_timeout_search_time_ms ),
146- 30000 ,
147- 0 );
148- __cmock_memfault_metrics_heartbeat_set_unsigned_ExpectAndReturn (
149- MEMFAULT_METRICS_KEY (gnss_satellites_tracked_count ),
150- 2 ,
151- 0 );
152- __cmock_memfault_metrics_heartbeat_debug_trigger_Ignore ();
153-
154- __cmock_app_event_manager_alloc_ExpectAnyArgsAndReturn (& location_module_event_memory );
155- __cmock_app_event_manager_free_ExpectAnyArgs ();
156- struct location_module_event * location_module_event = new_location_module_event ();
157-
158- location_module_event -> type = LOCATION_MODULE_EVT_TIMEOUT ;
159- location_module_event -> data .location .satellites_tracked = 2 ;
160- location_module_event -> data .location .search_time = 30000 ;
161-
162- TEST_ASSERT_EQUAL (0 , DEBUG_MODULE_EVT_HANDLER (
163- (struct app_event_header * )location_module_event ));
164- app_event_manager_free (location_module_event );
165- }
166-
167108/* Test that the debug module is able to submit Memfault data externally through events
168109 * of type DEBUG_EVT_MEMFAULT_DATA_READY carrying chunks of data.
169110 */
@@ -198,42 +139,6 @@ void test_memfault_trigger_data_send(void)
198139 k_sleep (K_SECONDS (1 ));
199140}
200141
201- /* Test that no Memfault SDK specific APIs are called on GNSS module events
202- * that should not be handled.
203- */
204- void test_memfault_unhandled_event (void )
205- {
206- resetTest ();
207- setup_debug_module_in_init_state ();
208-
209- /* Expect no memfault APIs to be called on LOCATION_MODULE_EVT_ACTIVE */
210-
211- __cmock_app_event_manager_alloc_ExpectAnyArgsAndReturn (& location_module_event_memory );
212- __cmock_app_event_manager_free_ExpectAnyArgs ();
213- struct location_module_event * location_module_event = new_location_module_event ();
214-
215- location_module_event -> type = LOCATION_MODULE_EVT_ACTIVE ;
216- TEST_ASSERT_EQUAL (0 , DEBUG_MODULE_EVT_HANDLER (
217- (struct app_event_header * )location_module_event ));
218-
219- location_module_event -> type = LOCATION_MODULE_EVT_INACTIVE ;
220- TEST_ASSERT_EQUAL (0 , DEBUG_MODULE_EVT_HANDLER (
221- (struct app_event_header * )location_module_event ));
222-
223- location_module_event -> type = LOCATION_MODULE_EVT_SHUTDOWN_READY ;
224- TEST_ASSERT_EQUAL (0 , DEBUG_MODULE_EVT_HANDLER (
225- (struct app_event_header * )location_module_event ));
226-
227- location_module_event -> type = LOCATION_MODULE_EVT_AGNSS_NEEDED ;
228- TEST_ASSERT_EQUAL (0 , DEBUG_MODULE_EVT_HANDLER (
229- (struct app_event_header * )location_module_event ));
230-
231- location_module_event -> type = LOCATION_MODULE_EVT_ERROR_CODE ;
232- TEST_ASSERT_EQUAL (0 , DEBUG_MODULE_EVT_HANDLER (
233- (struct app_event_header * )location_module_event ));
234- app_event_manager_free (location_module_event );
235- }
236-
237142/* Test whether the correct Memfault software watchdog APIs are called on callbacks from the
238143 * application watchdog library.
239144 */
0 commit comments