From 85ce49680baa811f4f5797f15f7d37912e490b36 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Tue, 25 Feb 2020 09:28:59 +0100 Subject: [PATCH] tests/socket_zep: fix NDEBUG compile problem --- tests/socket_zep/main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/socket_zep/main.c b/tests/socket_zep/main.c index d5e9ee3823..f34d72512b 100644 --- a/tests/socket_zep/main.c +++ b/tests/socket_zep/main.c @@ -18,7 +18,6 @@ * @} */ -#include #include #include #include @@ -28,6 +27,7 @@ #include "sched.h" #include "socket_zep.h" #include "socket_zep_params.h" +#include "test_utils/expect.h" #include "msg.h" #include "od.h" @@ -52,7 +52,7 @@ static void test_init(void) p->local_addr, p->local_port, p->remote_addr, p->remote_port); socket_zep_setup(&_dev, p); netdev->event_callback = _event_cb; - assert(netdev->driver->init(netdev) >= 0); + expect(netdev->driver->init(netdev) >= 0); _print_info(netdev); } @@ -62,7 +62,7 @@ static void test_send__iolist_NULL(void) puts("Send zero-length packet"); int res = netdev->driver->send(netdev, NULL); - assert((res < 0) || (res == 0)); + expect((res < 0) || (res == 0)); if ((res < 0) && (errno == ECONNREFUSED)) { puts("No remote socket exists (use scripts in `tests/` to have proper tests)"); } @@ -79,7 +79,7 @@ static void test_send__iolist_not_NULL(void) puts("Send 'Hello\\0World\\0'"); int res = netdev->driver->send(netdev, iolist); - assert((res < 0) || (res == (sizeof("Hello")) + sizeof("World"))); + expect((res < 0) || (res == (sizeof("Hello")) + sizeof("World"))); if ((res < 0) && (errno == ECONNREFUSED)) { puts("No remote socket exists (use scripts in `tests/` to have proper tests)"); } @@ -122,14 +122,14 @@ static void _recv(netdev_t *dev) const int exp_len = dev->driver->recv(dev, NULL, 0, NULL); int data_len; - assert(exp_len >= 0); - assert(((unsigned)exp_len) <= sizeof(_recvbuf)); + expect(exp_len >= 0); + expect(((unsigned)exp_len) <= sizeof(_recvbuf)); data_len = dev->driver->recv(dev, _recvbuf, sizeof(_recvbuf), &rx_info); if (data_len < 0) { puts("Received invalid packet"); } else { - assert(data_len <= exp_len); + expect(data_len <= exp_len); printf("RSSI: %u, LQI: %u, Data:\n", rx_info.rssi, rx_info.lqi); if (data_len > 0) { od_hex_dump(_recvbuf, data_len, OD_WIDTH_DEFAULT); @@ -167,9 +167,9 @@ static void _print_info(netdev_t *netdev) uint64_t long_addr; uint16_t short_addr; - assert(netdev->driver->get(netdev, NETOPT_ADDRESS, &short_addr, + expect(netdev->driver->get(netdev, NETOPT_ADDRESS, &short_addr, sizeof(short_addr)) == sizeof(uint16_t)); - assert(netdev->driver->get(netdev, NETOPT_ADDRESS_LONG, &long_addr, + expect(netdev->driver->get(netdev, NETOPT_ADDRESS_LONG, &long_addr, sizeof(long_addr)) == sizeof(uint64_t)); /* we are on native, so using PRIu* is okay */