detect-fileext: convert unittests to FAIL/PASS APIs

Fixes Bug: #4033
pull/7996/head
Haleema Khan 3 years ago committed by Victor Julien
parent 6c922e0b98
commit b31a286952

@ -253,11 +253,10 @@ static void DetectFileextFree(DetectEngineCtx *de_ctx, void *ptr)
static int DetectFileextTestParse01 (void) static int DetectFileextTestParse01 (void)
{ {
DetectFileextData *dfd = DetectFileextParse(NULL, "doc", false); DetectFileextData *dfd = DetectFileextParse(NULL, "doc", false);
if (dfd != NULL) { FAIL_IF_NULL(dfd);
DetectFileextFree(NULL, dfd); DetectFileextFree(NULL, dfd);
return 1;
} PASS;
return 0;
} }
/** /**
@ -265,18 +264,13 @@ static int DetectFileextTestParse01 (void)
*/ */
static int DetectFileextTestParse02 (void) static int DetectFileextTestParse02 (void)
{ {
int result = 0;
DetectFileextData *dfd = DetectFileextParse(NULL, "tar.gz", false); DetectFileextData *dfd = DetectFileextParse(NULL, "tar.gz", false);
if (dfd != NULL) { FAIL_IF_NULL(dfd);
if (dfd->len == 6 && memcmp(dfd->ext, "tar.gz", 6) == 0) { FAIL_IF_NOT(dfd->len == 6);
result = 1; FAIL_IF_NOT(memcmp(dfd->ext, "tar.gz", 6) == 0);
} DetectFileextFree(NULL, dfd);
DetectFileextFree(NULL, dfd); PASS;
return result;
}
return 0;
} }
/** /**
@ -284,18 +278,13 @@ static int DetectFileextTestParse02 (void)
*/ */
static int DetectFileextTestParse03 (void) static int DetectFileextTestParse03 (void)
{ {
int result = 0;
DetectFileextData *dfd = DetectFileextParse(NULL, "pdf", false); DetectFileextData *dfd = DetectFileextParse(NULL, "pdf", false);
if (dfd != NULL) { FAIL_IF_NULL(dfd);
if (dfd->len == 3 && memcmp(dfd->ext, "pdf", 3) == 0) { FAIL_IF_NOT(dfd->len == 3);
result = 1; FAIL_IF_NOT(memcmp(dfd->ext, "pdf", 3) == 0);
} DetectFileextFree(NULL, dfd);
DetectFileextFree(NULL, dfd); PASS;
return result;
}
return 0;
} }
/** /**

Loading…
Cancel
Save