From 3c4c04199ab9289ed653cd07e19ceee97c8c3bcd Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Wed, 17 Sep 2025 10:29:06 -0300 Subject: [PATCH] fix statechange test --- test/mip_test.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/mip_test.c b/test/mip_test.c index 9c8bbf29..b5073e26 100644 --- a/test/mip_test.c +++ b/test/mip_test.c @@ -41,15 +41,25 @@ static void test_csum(void) { // UDP and TCP checksum calc funcions use the same basic calls as ipcsum() } +static bool executed = false; + +static void mif_fn(struct mg_tcpip_if *ifp, int ev, void *ev_data) { + if (ev == MG_TCPIP_EV_ST_CHG) + ASSERT(*(uint8_t *) ev_data == MG_TCPIP_STATE_READY); + executed = true; + (void) ifp; +} + static void test_statechange(void) { - char tx[1540]; struct mg_tcpip_if iface; memset(&iface, 0, sizeof(iface)); iface.ip = mg_htonl(0x01020304); iface.state = MG_TCPIP_STATE_READY; - iface.tx.buf = tx, iface.tx.len = sizeof(tx); iface.driver = &mg_tcpip_driver_mock; + iface.fn = mif_fn; onstatechange(&iface); + ASSERT(executed == true); + executed = false; } static void ph(struct mg_connection *c, int ev, void *ev_data) {