From 6621b0ec93ab80a4fcfabeac70891fe282b569ef Mon Sep 17 00:00:00 2001 From: Alice Akaki Date: Tue, 25 Oct 2022 15:41:56 -0400 Subject: [PATCH] detect-icmp-seq: convert unittests to FAIL/PASS APIs Task: #4043 --- src/detect-icmp-seq.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) 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; } /**