18 #include "../util-unittest.h" 20 #define TEST_OK(str, m, lo, hi) { \ 21 DetectBsizeData *bsz = DetectBsizeParse((str)); \ 23 FAIL_IF_NOT(bsz->mode == (m)); \ 24 DetectBsizeFree(bsz); \ 25 SCLogDebug("str %s OK", (str)); \ 27 #define TEST_FAIL(str) { \ 28 DetectBsizeData *bsz = DetectBsizeParse((str)); \ 29 FAIL_IF_NOT_NULL(bsz); \ 32 static int DetectBsizeTest01(
void)
46 static int DetectBsizeTest02(
void)
64 static int DetectBsizeTest03(
void)
81 static int DetectBsizeTest04(
void)
94 #define TEST_OK(rule) \ 96 DetectEngineCtx *de_ctx = DetectEngineCtxInit(); \ 97 FAIL_IF_NULL(de_ctx); \ 98 Signature *s = DetectEngineAppendSig(de_ctx, (rule)); \ 100 DetectEngineCtxFree(de_ctx); \ 103 #define TEST_FAIL(rule) \ 105 DetectEngineCtx *de_ctx = DetectEngineCtxInit(); \ 106 FAIL_IF_NULL(de_ctx); \ 107 Signature *s = DetectEngineAppendSig(de_ctx, (rule)); \ 108 FAIL_IF_NOT_NULL(s); \ 109 DetectEngineCtxFree(de_ctx); \ 112 static int DetectBsizeSigTest01(
void)
114 TEST_OK(
"alert http any any -> any any (http_request_line; bsize:10; sid:1;)");
115 TEST_OK(
"alert http any any -> any any (file_data; bsize:>1000; sid:2;)");
117 TEST_FAIL(
"alert tcp any any -> any any (content:\"abc\"; bsize:10; sid:3;)");
118 TEST_FAIL(
"alert http any any -> any any (content:\"GET\"; http_method; bsize:10; sid:4;)");
119 TEST_FAIL(
"alert http any any -> any any (http_request_line; content:\"GET\"; bsize:<10>; sid:5;)");
126 static void DetectBsizeRegisterTests(
void)
#define PASS
Pass the test.
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
#define TEST_OK(str, m, lo, hi)