From: Alice Akaki Date: Tue, 25 Oct 2022 19:41:56 +0000 (-0400) Subject: detect-icmp-seq: convert unittests to FAIL/PASS APIs X-Git-Tag: suricata-7.0.0-rc1~448 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6621b0ec93ab80a4fcfabeac70891fe282b569ef;p=thirdparty%2Fsuricata.git detect-icmp-seq: convert unittests to FAIL/PASS APIs Task: #4043 --- diff --git a/src/detect-icmp-seq.c b/src/detect-icmp-seq.c index 9736595ebc..2d7593f09d 100644 --- a/src/detect-icmp-seq.c +++ b/src/detect-icmp-seq.c @@ -337,11 +337,10 @@ static int DetectIcmpSeqParseTest01 (void) { DetectIcmpSeqData *iseq = NULL; iseq = DetectIcmpSeqParse(NULL, "300"); - if (iseq != NULL && htons(iseq->seq) == 300) { - DetectIcmpSeqFree(NULL, iseq); - return 1; - } - return 0; + FAIL_IF_NULL(iseq); + FAIL_IF_NOT(htons(iseq->seq) == 300); + DetectIcmpSeqFree(NULL, iseq); + PASS; } /** @@ -352,11 +351,10 @@ static int DetectIcmpSeqParseTest02 (void) { DetectIcmpSeqData *iseq = NULL; iseq = DetectIcmpSeqParse(NULL, " 300 "); - if (iseq != NULL && htons(iseq->seq) == 300) { - DetectIcmpSeqFree(NULL, iseq); - return 1; - } - return 0; + FAIL_IF_NULL(iseq); + FAIL_IF_NOT(htons(iseq->seq) == 300); + DetectIcmpSeqFree(NULL, iseq); + PASS; } /** @@ -364,13 +362,9 @@ static int DetectIcmpSeqParseTest02 (void) */ static int DetectIcmpSeqParseTest03 (void) { - DetectIcmpSeqData *iseq = NULL; - iseq = DetectIcmpSeqParse(NULL, "badc"); - if (iseq != NULL) { - DetectIcmpSeqFree(NULL, iseq); - return 0; - } - return 1; + DetectIcmpSeqData *iseq = DetectIcmpSeqParse(NULL, "badc"); + FAIL_IF_NOT_NULL(iseq); + PASS; } /**