]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
unittests (assorted): remove PASS_IF macro
authorJuliana Fajardini <jufajardini@gmail.com>
Thu, 28 Oct 2021 19:39:45 +0000 (20:39 +0100)
committerVictor Julien <victor@inliniac.net>
Sat, 6 Nov 2021 15:25:13 +0000 (16:25 +0100)
Also small documentation clean up and test adjusments where that
was needed.

affected: counters, decode-vntag, detect-mark

Related to #4795

src/counters.c
src/decode-vntag.c
src/detect-mark.c

index 7996dfa27149060faeb71c5b45674dcddeb2d1c0..30602a260d1644c3966529e3905d436eefc2f3ae 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2015 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
@@ -1406,7 +1406,6 @@ static int StatsTestCntArraySize07(void)
 {
     ThreadVars tv;
     StatsPrivateThreadContext *pca = NULL;
-    int result;
 
     memset(&tv, 0, sizeof(ThreadVars));
 
@@ -1421,12 +1420,12 @@ static int StatsTestCntArraySize07(void)
     StatsIncr(&tv, 1);
     StatsIncr(&tv, 2);
 
-    result = pca->size;
+    FAIL_IF_NOT(pca->size == 2);
 
     StatsReleaseCounters(tv.perf_public_ctx.head);
     StatsReleasePrivateThreadContext(pca);
 
-    PASS_IF(result == 2);
+    PASS;
 }
 
 static int StatsTestUpdateCounter08(void)
index 637784cdaccfd381f41875a5d630b3624e7c2c61..960f916fef46bdf5239c3ea35cea6e5c06273406 100644 (file)
@@ -93,8 +93,6 @@ int DecodeVNTag(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t
 /**
  * \test DecodeVNTagTest01 test if vntag header is too small.
  *
- *  \retval 1 on success
- *  \retval 0 on failure
  */
 static int DecodeVNTagtest01(void)
 {
@@ -110,14 +108,13 @@ static int DecodeVNTagtest01(void)
 
     FAIL_IF(TM_ECODE_OK == DecodeVNTag(&tv, &dtv, p, raw_vntag, sizeof(raw_vntag)));
 
-    PASS_IF(ENGINE_ISSET_EVENT(p, VNTAG_HEADER_TOO_SMALL));
+    FAIL_IF_NOT(ENGINE_ISSET_EVENT(p, VNTAG_HEADER_TOO_SMALL));
+    PASS;
 }
 
 /**
  * \test DecodeVNTagt02 test if vntag header has unknown type.
  *
- *  \retval 1 on success
- *  \retval 0 on failure
  */
 static int DecodeVNTagtest02(void)
 {
@@ -138,14 +135,13 @@ static int DecodeVNTagtest02(void)
     memset(&tv, 0, sizeof(ThreadVars));
     memset(&dtv, 0, sizeof(DecodeThreadVars));
 
-    PASS_IF(TM_ECODE_OK != DecodeVNTag(&tv, &dtv, p, raw_vntag, sizeof(raw_vntag)));
+    FAIL_IF_NOT(TM_ECODE_OK != DecodeVNTag(&tv, &dtv, p, raw_vntag, sizeof(raw_vntag)));
+    PASS;
 }
 
 /**
  * \test DecodeVNTagTest03 test a good vntag header.
  *
- *  \retval 1 on success
- *  \retval 0 on failure
  */
 static int DecodeVNTagtest03(void)
 {
index 6ba65c4f304d841aea68c392dcec904bb086a1d5..553a1eb70e9a8886c9810d62f5941f45ce43c907 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2020 Open Information Security Foundation
+/* Copyright (C) 2011-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
@@ -276,10 +276,10 @@ static int MarkTestParse02 (void)
 
     data = DetectMarkParse("4");
 
-    PASS_IF(data == NULL);
+    FAIL_IF_NOT_NULL(data);
 
     DetectMarkDataFree(NULL, data);
-    FAIL;
+    PASS;
 }
 
 /**
@@ -308,10 +308,10 @@ static int MarkTestParse04 (void)
 
     data = DetectMarkParse("0x1g/0xff");
 
-    PASS_IF(data == NULL);
+    FAIL_IF_NOT_NULL(data);
 
     DetectMarkDataFree(NULL, data);
-    FAIL;
+    PASS;
 }
 
 /**