Go to the documentation of this file.
18 #include "../detect.h"
19 #include "../detect-parse.h"
20 #include "../detect-engine-port.h"
21 #include "../util-unittest.h"
31 static int DetectParseTest01 (
void)
51 static int DetectParseTestNoOpt(
void)
55 "alert http any any -> any any (msg:\"sid 1 version 0\"; "
56 "content:\"dummy1\"; endswith: reference: ref; sid:1;)") != NULL);
62 static int SigParseTestNegationNoWhitespace(
void)
67 "alert http any [30:50,!45] -> any [30:50,!45] (msg:\"sid 2 version 0\"; "
68 "content:\"dummy2\"; sid:2;)");
83 static int SigParseTestWhitespaceLessThan14(
void)
88 "alert http any [30:50, !45] -> any [30:50,!45] (msg:\"sid 2 version 0\"; "
89 "content:\"dummy2\"; sid:2;)");
103 static int SigParseTestWhitespace14Spaces(
void)
108 "alert http any [30:50, !45] -> any [30:50,!45] (msg:\"sid 2 "
109 "version 0\"; content:\"dummy2\"; sid:2;)");
123 static int SigParseTestWhitespaceMoreThan14(
void)
128 "alert http any [30:50, !45] -> any [30:50,!45] "
129 "(msg:\"sid 2 version 0\"; content:\"dummy2\"; sid:2;)");
150 UtRegisterTest(
"SigParseTestNegationNoWhitespace", SigParseTestNegationNoWhitespace);
151 UtRegisterTest(
"SigParseTestWhitespaceLessThan14", SigParseTestWhitespaceLessThan14);
152 UtRegisterTest(
"SigParseTestWhitespace14Spaces", SigParseTestWhitespace14Spaces);
153 UtRegisterTest(
"SigParseTestWhitespaceMoreThan14", SigParseTestWhitespaceMoreThan14);
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
void DetectParseRegisterTests(void)
this function registers unit tests for DetectParse
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
main detection engine ctx
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
struct DetectPort_ * next
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
#define FAIL_IF_NOT_NULL(expr)
Fail a test if expression evaluates to non-NULL.
#define PASS
Pass the test.
Signature * DetectEngineAppendSig(DetectEngineCtx *de_ctx, const char *sigstr)
Parse and append a Signature into the Detection Engine Context signature list.
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
DetectEngineCtx * DetectEngineCtxInit(void)