From: Juliana Fajardini Date: Thu, 28 Oct 2021 19:39:45 +0000 (+0100) Subject: unittests (assorted): remove PASS_IF macro X-Git-Tag: suricata-7.0.0-beta1~1262 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3743cf5c043b1412ac4dda565238d3f749d0223;p=thirdparty%2Fsuricata.git unittests (assorted): remove PASS_IF macro Also small documentation clean up and test adjusments where that was needed. affected: counters, decode-vntag, detect-mark Related to #4795 --- diff --git a/src/counters.c b/src/counters.c index 7996dfa271..30602a260d 100644 --- a/src/counters.c +++ b/src/counters.c @@ -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) diff --git a/src/decode-vntag.c b/src/decode-vntag.c index 637784cdac..960f916fef 100644 --- a/src/decode-vntag.c +++ b/src/decode-vntag.c @@ -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) { diff --git a/src/detect-mark.c b/src/detect-mark.c index 6ba65c4f30..553a1eb70e 100644 --- a/src/detect-mark.c +++ b/src/detect-mark.c @@ -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; } /**