32 DetectEngineCtx *de_ctx = DetectEngineCtxInit(); \
33 FAIL_IF(de_ctx == NULL); \
36 uint8_t cat = 0, value = 0;
38 #define TEST_INIT_WITH_PACKET_IPV6(src, dst) \
39 uint8_t *buf = (uint8_t *)"Hi all!"; \
40 uint16_t buflen = strlen((char *)buf); \
41 Packet *p = UTHBuildPacketIPV6SrcDst((uint8_t *)buf, buflen, IPPROTO_TCP, (src), (dst)); \
45 #define TEST_INIT_WITH_PACKET(ip) \
46 uint8_t *buf = (uint8_t *)"Hi all!"; \
47 uint16_t buflen = strlen((char *)buf); \
48 Packet *p = UTHBuildPacket((uint8_t *)buf, buflen, IPPROTO_TCP); \
50 p->src.addr_data32[0] = UTHSetIPv4Address(ip); \
53 #define TEST_CLEANUP \
54 DetectEngineCtxFree(de_ctx);
56 #define TEST_CLEANUP_WITH_PACKET \
60 static int SRepTest01(
void)
65 char str[] =
"1.2.3.4,1,2";
67 PrintInet(AF_INET, (
const void *)&a.address, ipstr,
sizeof(ipstr));
68 FAIL_IF(strcmp(ipstr,
"1.2.3.4") != 0);
76 static int SRepTest02(
void)
80 char str[] =
"1.1.1.1,";
87 static int SRepTest03(
void)
89 char str[] =
"1,Shortname,Long Name";
93 FAIL_IF(SRepCatSplitLine(
str, &cat, shortname,
sizeof(shortname)) != 0);
94 FAIL_IF(strcmp(shortname,
"Shortname") != 0);
100 static int SRepTest04(
void)
104 char str[] =
"10.0.0.0/16,1,2";
111 static int SRepTest05(
void)
115 char str[] =
"10.0.0.0/16,1,20";
125 static int SRepTest06(
void)
129 char str1[] =
"0.0.0.0/0,1,10\n";
130 char str2[] =
"192.168.0.0/16,2,127";
142 static int SRepTest07(
void) {
145 char str[] =
"2000:0000:0000:0000:0000:0000:0000:0001,";
152 static int SRepTest08(
void)
156 char str1[] =
"0.0.0.0/0,1,10\n";
157 char str2[] =
"192.168.0.0/16,2,127\n";
158 char str3[] =
"2000::/3,1,10\n";
159 char str4[] =
"FFFF::/127,2,127\n";