From: Janani Ramjee Date: Mon, 12 Oct 2020 09:29:05 +0000 (+0530) Subject: detect/mark: convert unittests to use PASS/FAIL API X-Git-Tag: suricata-7.0.0-beta1~1943 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d3cf1190682871ba4e668bd336531666e493bba;p=thirdparty%2Fsuricata.git detect/mark: convert unittests to use PASS/FAIL API --- diff --git a/src/detect-mark.c b/src/detect-mark.c index 081f42dc9b..7fed85cc4b 100644 --- a/src/detect-mark.c +++ b/src/detect-mark.c @@ -253,8 +253,6 @@ static int DetectMarkPacket(DetectEngineThreadCtx *det_ctx, Packet *p, /** * \test MarkTestParse01 is a test for a valid mark value * - * \retval 1 on succces - * \retval 0 on failure */ static int MarkTestParse01 (void) { @@ -262,19 +260,15 @@ static int MarkTestParse01 (void) data = DetectMarkParse("1/1"); - if (data == NULL) { - return 0; - } + FAIL_IF_NULL(data); DetectMarkDataFree(NULL, data); - return 1; + PASS; } /** * \test MarkTestParse02 is a test for an invalid mark value * - * \retval 1 on succces - * \retval 0 on failure */ static int MarkTestParse02 (void) { @@ -282,19 +276,15 @@ static int MarkTestParse02 (void) data = DetectMarkParse("4"); - if (data == NULL) { - return 1; - } + PASS_IF(data == NULL); DetectMarkDataFree(NULL, data); - return 0; + FAIL; } /** * \test MarkTestParse03 is a test for a valid mark value * - * \retval 1 on succces - * \retval 0 on failure */ static int MarkTestParse03 (void) { @@ -302,19 +292,15 @@ static int MarkTestParse03 (void) data = DetectMarkParse("0x10/0xff"); - if (data == NULL) { - return 0; - } + FAIL_IF_NULL(data); DetectMarkDataFree(NULL, data); - return 1; + PASS; } /** * \test MarkTestParse04 is a test for a invalid mark value * - * \retval 1 on succces - * \retval 0 on failure */ static int MarkTestParse04 (void) { @@ -322,12 +308,10 @@ static int MarkTestParse04 (void) data = DetectMarkParse("0x1g/0xff"); - if (data == NULL) { - return 1; - } + PASS_IF(data == NULL); DetectMarkDataFree(NULL, data); - return 0; + FAIL; } /** @@ -340,4 +324,4 @@ static void MarkRegisterTests(void) UtRegisterTest("MarkTestParse03", MarkTestParse03); UtRegisterTest("MarkTestParse04", MarkTestParse04); } -#endif /* UNITTESTS */ \ No newline at end of file +#endif /* UNITTESTS */