]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util/unittests: delete PASS_IF macro
authorJuliana Fajardini <jufajardini@gmail.com>
Tue, 2 Nov 2021 18:22:51 +0000 (18:22 +0000)
committerVictor Julien <victor@inliniac.net>
Sat, 6 Nov 2021 15:25:13 +0000 (16:25 +0100)
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

src/util-unittest.h

index 10e2c7ecdf8e8ca345e50c3929e78361dc498cdf..c9ca3a655050b2e5e2f3785e6869f01a8ad2fe61 100644 (file)
@@ -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__ */
 
 /**