Skip to content

Commit

Permalink
detect-icmp-seq: convert unittests to FAIL/PASS APIs
Browse files Browse the repository at this point in the history
Task: #4043
  • Loading branch information
AkakiAlice authored and victorjulien committed Oct 27, 2022
1 parent 8d5c5f2 commit 6621b0e
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions src/detect-icmp-seq.c
Original file line number Diff line number Diff line change
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

0 comments on commit 6621b0e

Please sign in to comment.