1
1
/*
2
- * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
2
+ * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
3
3
*
4
4
* SPDX-License-Identifier: Unlicense OR CC0-1.0
5
5
*/
17
17
#include " freertos/FreeRTOS.h"
18
18
#include " freertos/event_groups.h"
19
19
20
- #define CATCH_CONFIG_MAIN
21
- #include " catch.hpp"
22
-
23
20
static const char *TAG = " pppd_test" ;
24
21
static EventGroupHandle_t event_group = NULL ;
25
22
@@ -76,6 +73,9 @@ esp_err_t modem_init_network(esp_netif_t *netif);
76
73
void modem_start_network ();
77
74
void modem_stop_network ();
78
75
76
+ bool test_connect ();
77
+ bool test_disconnect ();
78
+
79
79
extern " C" void app_main (void )
80
80
{
81
81
@@ -99,41 +99,27 @@ extern "C" void app_main(void)
99
99
#endif
100
100
101
101
modem_start_network ();
102
- Catch::Session session;
103
- int numFailed = session.run ();
104
- if (numFailed > 0 ) {
105
- ESP_LOGE (TAG, " Test FAILED!" );
102
+
103
+ bool t1 = test_connect ();
104
+ bool t2 = test_disconnect ();
105
+
106
+ if (t1 && t2) {
107
+ ESP_LOGI (TAG, " All tests passed" );
106
108
} else {
107
- ESP_LOGI (TAG, " Test passed !" );
109
+ ESP_LOGE (TAG, " Test FAILED !" );
108
110
}
109
111
110
112
}
111
113
112
- TEST_CASE (" Connect test" , " [esp_modem]" )
114
+ bool test_connect () // ("Connect test", "[esp_modem]")
113
115
{
114
116
EventBits_t b = xEventGroupWaitBits (event_group, 1 , pdTRUE, pdFALSE, pdMS_TO_TICKS (15000 ));
115
- CHECK ( b == 1 ) ;
117
+ return b == 1 ;
116
118
}
117
119
118
- TEST_CASE (" Disconnection test" , " [esp_modem]" )
120
+ bool test_disconnect () // ("Disconnection test", "[esp_modem]")
119
121
{
120
122
modem_stop_network ();
121
123
EventBits_t b = xEventGroupWaitBits (event_group, 2 , pdTRUE, pdFALSE, pdMS_TO_TICKS (15000 ));
122
- CHECK (b == 2 );
123
- }
124
-
125
-
126
- extern " C" {
127
-
128
- static void handle (int nr)
129
- {
130
- ESP_LOGE (TAG, " Signal handler %d" , nr);
131
- }
132
-
133
- _sig_func_ptr signal (int nr, _sig_func_ptr)
134
- {
135
- return handle;
136
- }
137
-
138
-
124
+ return b == 2 ;
139
125
}
0 commit comments