32 DetectEngineCtx *de_ctx = DetectEngineCtxInit(); \
33 FAIL_IF(de_ctx == NULL); \
37 uint8_t cat = 0, value = 0;
39 #define TEST_INIT_WITH_PACKET_IPV6(src, dst) \
40 uint8_t *buf = (uint8_t *)"Hi all!"; \
41 uint16_t buflen = strlen((char *)buf); \
42 Packet *p = UTHBuildPacketIPV6SrcDst((uint8_t *)buf, buflen, IPPROTO_TCP, (src), (dst)); \
46 #define TEST_INIT_WITH_PACKET(ip) \
47 uint8_t *buf = (uint8_t *)"Hi all!"; \
48 uint16_t buflen = strlen((char *)buf); \
49 Packet *p = UTHBuildPacket((uint8_t *)buf, buflen, IPPROTO_TCP); \
51 p->src.addr_data32[0] = UTHSetIPv4Address(ip); \
54 #define TEST_CLEANUP \
55 DetectEngineCtxFree(de_ctx);
57 #define TEST_CLEANUP_WITH_PACKET \
61 static int SRepTest01(
void)
66 char str[] =
"1.2.3.4,1,2";
68 PrintInet(AF_INET, (
const void *)&a.address, ipstr,
sizeof(ipstr));
69 FAIL_IF(strcmp(ipstr,
"1.2.3.4") != 0);
77 static int SRepTest02(
void)
81 char str[] =
"1.1.1.1,";
88 static int SRepTest03(
void)
90 char str[] =
"1,Shortname,Long Name";
94 FAIL_IF(SRepCatSplitLine(
str, &cat, shortname,
sizeof(shortname)) != 0);
95 FAIL_IF(strcmp(shortname,
"Shortname") != 0);
101 static int SRepTest04(
void)
105 char str[] =
"10.0.0.0/16,1,2";
112 static int SRepTest05(
void)
116 char str[] =
"10.0.0.0/16,1,20";
126 static int SRepTest06(
void)
130 char str1[] =
"0.0.0.0/0,1,10\n";
131 char str2[] =
"192.168.0.0/16,2,127";
143 static int SRepTest07(
void) {
146 char str[] =
"2000:0000:0000:0000:0000:0000:0000:0001,";
153 static int SRepTest08(
void)
157 char str1[] =
"0.0.0.0/0,1,10\n";
158 char str2[] =
"192.168.0.0/16,2,127\n";
159 char str3[] =
"2000::/3,1,10\n";
160 char str4[] =
"FFFF::/127,2,127\n";