static int FlowBitsTestParse01(void)
{
- int ret = 0;
char command[16] = "", name[16] = "";
/* Single argument version. */
- if (!DetectFlowbitParse("noalert", command, sizeof(command), name,
- sizeof(name))) {
- goto end;
- }
- if (strcmp(command, "noalert") != 0) {
- goto end;
- }
+ FAIL_IF(!DetectFlowbitParse("noalert", command, sizeof(command), name,
+ sizeof(name)));
+ FAIL_IF(strcmp(command, "noalert") != 0);
/* No leading or trailing spaces. */
- if (!DetectFlowbitParse("set,flowbit", command, sizeof(command), name,
- sizeof(name))) {
- goto end;
- }
- if (strcmp(command, "set") != 0) {
- goto end;
- }
- if (strcmp(name, "flowbit") != 0) {
- goto end;
- }
+ FAIL_IF(!DetectFlowbitParse("set,flowbit", command, sizeof(command), name,
+ sizeof(name)));
+ FAIL_IF(strcmp(command, "set") != 0);
+ FAIL_IF(strcmp(name, "flowbit") != 0);
/* Leading space. */
- if (!DetectFlowbitParse("set, flowbit", command, sizeof(command), name,
- sizeof(name))) {
- goto end;
- }
- if (strcmp(command, "set") != 0) {
- goto end;
- }
- if (strcmp(name, "flowbit") != 0) {
- goto end;
- }
+ FAIL_IF(!DetectFlowbitParse("set, flowbit", command, sizeof(command), name,
+ sizeof(name)));
+ FAIL_IF(strcmp(command, "set") != 0);
+ FAIL_IF(strcmp(name, "flowbit") != 0);
/* Trailing space. */
- if (!DetectFlowbitParse("set,flowbit ", command, sizeof(command), name,
- sizeof(name))) {
- goto end;
- }
- if (strcmp(command, "set") != 0) {
- goto end;
- }
- if (strcmp(name, "flowbit") != 0) {
- goto end;
- }
+ FAIL_IF(!DetectFlowbitParse("set,flowbit ", command, sizeof(command), name,
+ sizeof(name)));
+ FAIL_IF(strcmp(command, "set") != 0);
+ FAIL_IF(strcmp(name, "flowbit") != 0);
/* Leading and trailing space. */
- if (!DetectFlowbitParse("set, flowbit ", command, sizeof(command), name,
- sizeof(name))) {
- goto end;
- }
- if (strcmp(command, "set") != 0) {
- goto end;
- }
- if (strcmp(name, "flowbit") != 0) {
- goto end;
- }
+ FAIL_IF(!DetectFlowbitParse("set, flowbit ", command, sizeof(command), name,
+ sizeof(name)));
+ FAIL_IF(strcmp(command, "set") != 0);
+ FAIL_IF(strcmp(name, "flowbit") != 0);
- ret = 1;
-end:
- return ret;
+ PASS;
}
/**
}
SCFree(p);
- return result == 0;
+ PASS_IF(result == 0);
}
/**
}
SCFree(p);
- return result == 0;
+ PASS_IF(result == 0);
}
/**
SCFree(p);
- return result == 0;
+ PASS_IF(result == 0);
}
/**
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
DetectEngineCtxFree(de_ctx);
SCFree(p);
- return result;
+ PASS_IF(result);
end:
}
SCFree(p);
- return result;
+ PASS_IF(result);
}
/**
DetectEngineCtxFree(de_ctx);
SCFree(p);
- return result;
+ PASS_IF(result);
end:
if (de_ctx != NULL) {
}
SCFree(p);
- return result;
+ PASS_IF(result);
}
/**
FLOW_DESTROY(&f);
SCFree(p);
- return result;
+ PASS_IF(result);
end:
if (de_ctx != NULL) {
if(gv) GenericVarFree(gv);
FLOW_DESTROY(&f);
SCFree(p);
- return result;
+ PASS_IF(result);
}
/**
FLOW_DESTROY(&f);
SCFree(p);
- return result == 0;
+ PASS_IF(result == 0);
end:
if (de_ctx != NULL) {
FLOW_DESTROY(&f);
SCFree(p);
- return result == 0;
+ PASS_IF(result == 0);
}
/**
FLOW_DESTROY(&f);
SCFree(p);
- return result == 0;
+ PASS_IF(result == 0);
end:
if (de_ctx != NULL) {
FLOW_DESTROY(&f);
SCFree(p);
- return result == 0;
+ PASS_IF(result == 0);
}
#endif /* UNITTESTS */