]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/csum: test cleanups
authorVictor Julien <vjulien@oisf.net>
Mon, 8 May 2023 09:16:24 +0000 (11:16 +0200)
committerVictor Julien <vjulien@oisf.net>
Mon, 8 May 2023 09:59:21 +0000 (11:59 +0200)
src/detect-csum.c

index f65958dccd1dedf4037af16547b907dcb432827b..6129635a48f278408eae0926e5bdc7340fde5e6d 100644 (file)
@@ -936,21 +936,27 @@ static int DetectCsumValidArgsTestParse01(void)
 }
 #undef TEST1
 
-#define TEST2(kwstr) { \
-    DetectEngineCtx *de_ctx = DetectEngineCtxInit();\
-    FAIL_IF_NULL(de_ctx);\
-    Signature *s = DetectEngineAppendSig(de_ctx, "alert ip any any -> any any ("mystr(kwstr)"-csum:vaid; sid:1;)");\
-    FAIL_IF(s);\
-    s = DetectEngineAppendSig(de_ctx, "alert ip any any -> any any ("mystr(kwstr)"-csum:invaalid; sid:2;)");\
-    FAIL_IF(s);\
-    s = DetectEngineAppendSig(de_ctx, "alert ip any any -> any any ("mystr(kwstr)"-csum:vaLiid; sid:3;)");\
-    FAIL_IF(s);\
-    s = DetectEngineAppendSig(de_ctx, "alert ip any any -> any any ("mystr(kwstr)"-csum:VALieD; sid:4;)");\
-    FAIL_IF(s);\
-    s = DetectEngineAppendSig(de_ctx, "alert ip any any -> any any ("mystr(kwstr)"-csum:iNvamid; sid:5;)");\
-    FAIL_IF(s);\
-    DetectEngineCtxFree(de_ctx);\
-}
+#define TEST2(kwstr)                                                                               \
+    {                                                                                              \
+        DetectEngineCtx *de_ctx = DetectEngineCtxInit();                                           \
+        FAIL_IF_NULL(de_ctx);                                                                      \
+        Signature *s = DetectEngineAppendSig(                                                      \
+                de_ctx, "alert ip any any -> any any (" mystr(kwstr) "-csum:xxxx; sid:1;)");       \
+        FAIL_IF(s);                                                                                \
+        s = DetectEngineAppendSig(                                                                 \
+                de_ctx, "alert ip any any -> any any (" mystr(kwstr) "-csum:xxxxxxxx; sid:2;)");   \
+        FAIL_IF(s);                                                                                \
+        s = DetectEngineAppendSig(                                                                 \
+                de_ctx, "alert ip any any -> any any (" mystr(kwstr) "-csum:xxxxxx; sid:3;)");     \
+        FAIL_IF(s);                                                                                \
+        s = DetectEngineAppendSig(                                                                 \
+                de_ctx, "alert ip any any -> any any (" mystr(kwstr) "-csum:XXXXXX; sid:4;)");     \
+        FAIL_IF(s);                                                                                \
+        s = DetectEngineAppendSig(                                                                 \
+                de_ctx, "alert ip any any -> any any (" mystr(kwstr) "-csum:XxXxXxX; sid:5;)");    \
+        FAIL_IF(s);                                                                                \
+        DetectEngineCtxFree(de_ctx);                                                               \
+    }
 
 static int DetectCsumInvalidArgsTestParse02(void)
 {