[glib/wip/3v1n0/regex-pcre2-flags-fixes: 2/2] tests/regex: Perform more tests both with and without optimizations




commit 750045c3ac80877275368597af7fdb1162abf06b
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Fri Sep 9 18:43:47 2022 +0200

    tests/regex: Perform more tests both with and without optimizations

 glib/tests/regex.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/glib/tests/regex.c b/glib/tests/regex.c
index f1c1f672f3..eb98c26847 100644
--- a/glib/tests/regex.c
+++ b/glib/tests/regex.c
@@ -175,6 +175,10 @@ test_match_simple (gconstpointer d)
   data->expected = _expected;                                           \
   path = g_strdup_printf ("/regex/match-%s/%d", _name, ++total);        \
   g_test_add_data_func_full (path, data, test_match_simple, g_free);    \
+  data = g_memdup2 (data, sizeof (TestMatchData));                      \
+  data->compile_opts |= G_REGEX_OPTIMIZE;                               \
+  path = g_strdup_printf ("/regex/match-optimized-%s/%d", _name, ++total); \
+  g_test_add_data_func_full (path, data, test_match_simple, g_free);    \
   g_free (path);                                                        \
 }
 
@@ -363,6 +367,10 @@ test_match (gconstpointer d)
   data->expected = _expected;                                           \
   path = g_strdup_printf ("/regex/match/%d", ++total);                  \
   g_test_add_data_func_full (path, data, test_match, g_free);           \
+  data = g_memdup2 (data, sizeof (TestMatchData));                      \
+  data->compile_opts |= G_REGEX_OPTIMIZE;                               \
+  path = g_strdup_printf ("/regex/match-optimized/%d", ++total);        \
+  g_test_add_data_func_full (path, data, test_match, g_free);           \
   g_free (path);                                                        \
 }
 
@@ -1248,6 +1256,10 @@ test_replace (gconstpointer d)
   data->match_flags = _match_flags;                                     \
   path = g_strdup_printf ("/regex/replace/%d", ++total);                \
   g_test_add_data_func_full (path, data, test_replace, g_free);         \
+  data = g_memdup2 (data, sizeof (TestReplaceData));                    \
+  data->compile_flags |= G_REGEX_OPTIMIZE;                              \
+  path = g_strdup_printf ("/regex/replace-optimized/%d", ++total);      \
+  g_test_add_data_func_full (path, data, test_replace, g_free);         \
   g_free (path);                                                        \
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]