]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect-rfb-secresult: convert unittest to FAIL/PASS APIs 6582/head
authorModupe Falodun <falodunmodupeola@gmail.com>
Tue, 2 Nov 2021 21:18:51 +0000 (22:18 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 8 Nov 2021 07:03:00 +0000 (08:03 +0100)
Bug: #4055

src/detect-rfb-secresult.c

index 4af974555a0ee0802e62d0cff8d145dbd9935136..f6e58ca7516575b28c4fc8a788bc1fd6f79c684e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2020 Open Information Security Foundation
+/* Copyright (C) 2020-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
@@ -262,38 +262,28 @@ void DetectRfbSecresultFree(DetectEngineCtx *de_ctx, void *de_ptr)
 #ifdef UNITTESTS
 /**
  * \test RfbSecresultTestParse01 is a test for a valid secresult value
- *
- *  \retval 1 on succces
- *  \retval 0 on failure
  */
 static int RfbSecresultTestParse01 (void)
 {
-    DetectRfbSecresultData *de = NULL;
-    de = DetectRfbSecresultParse("fail");
-    if (de) {
-        DetectRfbSecresultFree(NULL, de);
-        return 1;
-    }
+    DetectRfbSecresultData *de = DetectRfbSecresultParse("fail");
 
-    return 0;
+    FAIL_IF_NULL(de);
+
+    DetectRfbSecresultFree(NULL, de);
+
+    PASS;
 }
 
 /**
  * \test RfbSecresultTestParse02 is a test for an invalid secresult value
- *
- *  \retval 1 on succces
- *  \retval 0 on failure
  */
 static int RfbSecresultTestParse02 (void)
 {
-    DetectRfbSecresultData *de = NULL;
-    de = DetectRfbSecresultParse("invalidopt");
-    if (de) {
-        DetectRfbSecresultFree(NULL, de);
-        return 0;
-    }
+    DetectRfbSecresultData *de = DetectRfbSecresultParse("invalidopt");
+
+    FAIL_IF_NOT_NULL(de);
 
-    return 1;
+    PASS;
 }
 
 /**