]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect-icmp-seq: convert unittests to FAIL/PASS APIs
authorAlice Akaki <akakialice@gmail.com>
Tue, 25 Oct 2022 19:41:56 +0000 (15:41 -0400)
committerVictor Julien <vjulien@oisf.net>
Thu, 27 Oct 2022 08:58:29 +0000 (10:58 +0200)
Task: #4043

src/detect-icmp-seq.c

index 9736595ebcffd519330fa0472eefc5d17deb51ef..2d7593f09dec6b71a17a1a4eee73b1b19a3b51b6 100644 (file)
@@ -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;
 }
 
 /**