From a894c226c7392ebd0c18fe4774ec8a6e4bd61b42 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 25 Jan 2024 23:16:45 -0800 Subject: tests: assert in compat tests even in release mode --- tests/compat_testutil.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'tests/compat_testutil.c') diff --git a/tests/compat_testutil.c b/tests/compat_testutil.c index 1656c852..aff8f02d 100644 --- a/tests/compat_testutil.c +++ b/tests/compat_testutil.c @@ -2,7 +2,7 @@ Copyright (c) 2013 Insollo Entertainment, LLC. All rights reserved. Copyright 2016 Franklin "Snaipe" Mathieu Copyright 2018 Capitar IT Group BV - Copyright 2022 Staysail Systems, Inc. + Copyright 2024 Staysail Systems, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -27,13 +27,13 @@ // it for validating the compatibility features of nanomsg. As much as // possible we want to run tests from the nanomsg test suite unmodified. -#include +#include #include #include #include -#include #include "compat_testutil.h" +#include int test_socket_impl(char *file, int line, int family, int protocol); int test_connect_impl(char *file, int line, int sock, char *address); @@ -143,7 +143,7 @@ test_recv_impl(char *file, int line, int sock, char *data) { size_t data_len; int rc; - char * buf; + char *buf; data_len = strlen(data); /* We allocate plus one byte so that we are sure that message received @@ -227,3 +227,14 @@ nn_sleep(int ms) { nng_msleep(ms); } + +void +nn_assert_impl(bool b, const char *expression, const char *file, int line) +{ + if (b) { + return; + } + fprintf( + stderr, "%s:%d: Assertion failed: %s\n", file, line, expression); + abort(); +} -- cgit v1.2.3-70-g09d2