detect-sid: fail/pass api

- convert unittests to new FAIL/PASS API.
pull/5646/head
Juliana Fajardini 4 years ago committed by Victor Julien
parent f09536a936
commit d2144c0dfb

@ -83,63 +83,40 @@ static int DetectSidSetup (DetectEngineCtx *de_ctx, Signature *s, const char *si
static int SidTestParse01(void)
{
int result = 0;
Signature *s = NULL;
DetectEngineCtx *de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto end;
s = DetectEngineAppendSig(de_ctx,
"alert tcp 1.2.3.4 any -> any any (sid:1; gid:1;)");
if (s == NULL || s->id != 1)
goto end;
FAIL_IF_NULL(de_ctx);
result = 1;
Signature *s =
DetectEngineAppendSig(de_ctx, "alert tcp 1.2.3.4 any -> any any (sid:1; gid:1;)");
FAIL_IF_NULL(s);
FAIL_IF(s->id != 1);
end:
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
return result;
PASS;
}
static int SidTestParse02(void)
{
int result = 0;
DetectEngineCtx *de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto end;
FAIL_IF_NULL(de_ctx);
if (DetectEngineAppendSig(de_ctx,
"alert tcp 1.2.3.4 any -> any any (sid:a; gid:1;)") != NULL)
goto end;
FAIL_IF_NOT_NULL(
DetectEngineAppendSig(de_ctx, "alert tcp 1.2.3.4 any -> any any (sid:a; gid:1;)"));
result = 1;
end:
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
return result;
PASS;
}
static int SidTestParse03(void)
{
int result = 0;
DetectEngineCtx *de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto end;
FAIL_IF_NULL(de_ctx);
if (DetectEngineAppendSig(de_ctx,
"alert tcp any any -> any any (content:\"ABC\"; sid:\";)") != NULL)
goto end;
FAIL_IF_NOT_NULL(DetectEngineAppendSig(
de_ctx, "alert tcp any any -> any any (content:\"ABC\"; sid:\";)"));
result = 1;
end:
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
return result;
PASS;
}
/**

Loading…
Cancel
Save