Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detect-icmp-seq: convert unittests to FAIL/PASS APIs #8089

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 11 additions & 17 deletions src/detect-icmp-seq.c
Expand Up @@ -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;
}

/**
Expand All @@ -352,25 +351,20 @@ 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;
}

/**
* \test DetectIcmpSeqParseTest03 is a test for setting an invalid icmp_seq value
*/
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;
}

/**
Expand Down