]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: minor test cleanup
authorVictor Julien <vjulien@oisf.net>
Sat, 24 Sep 2022 19:08:30 +0000 (21:08 +0200)
committerVictor Julien <vjulien@oisf.net>
Sat, 1 Oct 2022 18:27:38 +0000 (20:27 +0200)
src/tests/stream-tcp.c

index 19c126121d135538739c1bfe996a459204113913..c6eec9b902f3acfcc7727b08fe2968145ea9c14b 100644 (file)
@@ -46,34 +46,17 @@ static int StreamTcpTest01(void)
     memset(&f, 0, sizeof(Flow));
     FLOW_INITIALIZE(&f);
     p->flow = &f;
-    int ret = 0;
-
     StreamTcpUTInit(&stt.ra_ctx);
-
     TcpSession *ssn = StreamTcpNewSession(p, 0);
-    if (ssn == NULL) {
-        printf("Session can not be allocated: ");
-        goto end;
-    }
+    FAIL_IF_NULL(ssn);
     f.protoctx = ssn;
-
-    if (f.alparser != NULL) {
-        printf("AppLayer field not set to NULL: ");
-        goto end;
-    }
-    if (ssn->state != 0) {
-        printf("TCP state field not set to 0: ");
-        goto end;
-    }
-
+    FAIL_IF_NOT_NULL(f.alparser);
+    FAIL_IF_NOT(ssn->state == 0);
     StreamTcpSessionClear(p->flow->protoctx);
-
-    ret = 1;
-end:
     SCFree(p);
     FLOW_DESTROY(&f);
     StreamTcpUTDeinit(stt.ra_ctx);
-    return ret;
+    PASS;
 }
 
 /**