From: Juliana Fajardini Date: Tue, 2 Nov 2021 18:22:51 +0000 (+0000) Subject: util/unittests: delete PASS_IF macro X-Git-Tag: suricata-7.0.0-beta1~1260 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d581fc82b18219d9c5bef8f0e0c0c42545c7b054;p=thirdparty%2Fsuricata.git util/unittests: delete PASS_IF macro The logic flow we want to achieve with unittests, where first we have all FAIL statements and then just one PASS statement could become more convoluted with the existence of the PASS_IF macro. Besides, what could be written as a FAIL_IF might in some cases be written in not so clear ways with the PASS_IF option available. Also: fix inverted check values in documentation, update copyright year Optimization: #4795 --- diff --git a/src/util-unittest.h b/src/util-unittest.h index 10e2c7ecdf..c9ca3a6550 100644 --- a/src/util-unittest.h +++ b/src/util-unittest.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2010 Open Information Security Foundation +/* Copyright (C) 2007-2021 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free @@ -66,7 +66,7 @@ extern int unittests_fatal; } while (0) /** - * \brief Fail a test if expression evaluates to false. + * \brief Fail a test if expression evaluates to true. */ #define FAIL_IF(expr) do { \ if (unittests_fatal) { \ @@ -77,7 +77,7 @@ extern int unittests_fatal; } while (0) /** - * \brief Fail a test if expression to true. + * \brief Fail a test if expression evaluates to false. */ #define FAIL_IF_NOT(expr) do { \ FAIL_IF(!(expr)); \ @@ -108,17 +108,6 @@ extern int unittests_fatal; #endif -/** - * \brief Pass the test if expression evaluates to true. - * - * Only to be used at the end of a function instead of returning the - * result of an expression. - */ -#define PASS_IF(expr) do { \ - FAIL_IF(!(expr)); \ - PASS; \ - } while (0) - #endif /* __UTIL_UNITTEST_H__ */ /**