diff tests.c @ 640:9e1f9e1d1487

Aaand some more work. Still just a broken concept.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 24 Jan 2020 09:13:24 +0200
parents d191ded8a790
children a2bf1ea05b05
line wrap: on
line diff
--- a/tests.c	Thu Jan 23 11:38:28 2020 +0200
+++ b/tests.c	Fri Jan 24 09:13:24 2020 +0200
@@ -565,15 +565,15 @@
 
 typedef struct
 {
-    th_regex_char *str;
+    th_regex_char_t *str;
     size_t nmatches;
     int flags;
 } test_regex_def;
 
 
-void test_regex_list(const test_regex_def *list, const th_regex_char *pattern)
+void test_regex_list(const test_regex_def *list, const th_regex_char_t *pattern)
 {
-    th_regex_ctx *reg = NULL;
+    th_regex_t *reg = NULL;
     int res;
 
     printf("========================================\n");
@@ -587,7 +587,7 @@
 
     for (const test_regex_def *def = list; def->str != NULL; def++)
     {
-        th_regex_match_node *matches = NULL;
+        th_regex_match_t *matches = NULL;
         size_t nmatches;
 
         if ((res = th_regex_match(reg, def->str,
@@ -603,8 +603,8 @@
             nmatches,
             def->nmatches == nmatches ? "YES" : "NO");
 
-        for (th_regex_match_node *m = matches;
-            m != NULL; m = (th_regex_match_node *) m->node.next)
+        for (th_regex_match_t *m = matches;
+            m != NULL; m = (th_regex_match_t *) m->node.next)
         {
             char *tmp = th_strndup(def->str + m->start, m->len);
             printf("      match [%" PRIu_SIZE_T " ++ %" PRIu_SIZE_T "]: '%s'\n",
@@ -878,18 +878,18 @@
 #ifdef TH_EXPERIMENTAL_REGEX
     if (test_set_start("Regular expressions"))
     {
-        th_regex_ctx *reg = NULL;
-        int res;
-
 #ifdef TH_EXPERIMENTAL_REGEX_DEBUG
         th_dbg_re_flags = TH_DBG_RE_MATCH;
 #endif
 
 #if 0
-        res = th_regex_compile(&reg, "z*k+abba fabboa? k{4} [gz]{1,2} foo(bar|zoo)?");
-        if (res != THERR_OK)
-            printf("result: %s\n", th_error_str(res));
-        th_regex_free(reg);
+        {
+            th_regex_t *reg = NULL;
+            int res = th_regex_compile(&reg, "z*k+abba fabboa? k{4} [gz]{1,2} foo(bar|zoo)?");
+            if (res != THERR_OK)
+                printf("result: %s\n", th_error_str(res));
+            th_regex_free(reg);
+        }
 
         //
         {