aboutsummaryrefslogtreecommitdiff
path: root/src/regex/test_regex_eval_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/regex/test_regex_eval_api.c')
-rw-r--r--src/regex/test_regex_eval_api.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/regex/test_regex_eval_api.c b/src/regex/test_regex_eval_api.c
index f6078c7ef..767571156 100644
--- a/src/regex/test_regex_eval_api.c
+++ b/src/regex/test_regex_eval_api.c
@@ -119,8 +119,8 @@ test_random (unsigned int rx_length, unsigned int max_str_len,
119 /* We only want to match the whole string, because that's what our DFA does, 119 /* We only want to match the whole string, because that's what our DFA does,
120 * too. */ 120 * too. */
121 if ((eval_check == 0) && 121 if ((eval_check == 0) &&
122 ((matchptr[0].rm_so != 0) ||(matchptr[0].rm_eo != strlen ( 122 ((matchptr[0].rm_so != 0) || (matchptr[0].rm_eo != strlen (
123 matching_str)) )) 123 matching_str)) ))
124 eval_check = 1; 124 eval_check = 1;
125 125
126 /* Match canonical regex */ 126 /* Match canonical regex */
@@ -150,12 +150,12 @@ test_random (unsigned int rx_length, unsigned int max_str_len,
150 /* We only want to match the whole string, because that's what our DFA does, 150 /* We only want to match the whole string, because that's what our DFA does,
151 * too. */ 151 * too. */
152 if ((eval_canonical_check == 0) && 152 if ((eval_canonical_check == 0) &&
153 ((matchptr[0].rm_so != 0) ||(matchptr[0].rm_eo != strlen ( 153 ((matchptr[0].rm_so != 0) || (matchptr[0].rm_eo != strlen (
154 matching_str)) )) 154 matching_str)) ))
155 eval_canonical_check = 1; 155 eval_canonical_check = 1;
156 156
157 /* compare results */ 157 /* compare results */
158 if ((eval_check != eval) ||(eval_canonical != eval_canonical_check) ) 158 if ((eval_check != eval) || (eval_canonical != eval_canonical_check) )
159 { 159 {
160 regerror (eval_check, &rx, error, sizeof error); 160 regerror (eval_check, &rx, error, sizeof error);
161 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 161 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -184,6 +184,7 @@ error:
184 return -1; 184 return -1;
185} 185}
186 186
187
187/** 188/**
188 * Automaton test that compares the result of matching regular expression 'rx' 189 * Automaton test that compares the result of matching regular expression 'rx'
189 * with the strings and expected results in 'rxstr' with the result of matching 190 * with the strings and expected results in 'rxstr' with the result of matching
@@ -227,10 +228,10 @@ test_automaton (struct REGEX_INTERNAL_Automaton *a, regex_t *rx,
227 (matchptr[0].rm_eo != strlen (rxstr->strings[i])) )) 228 (matchptr[0].rm_eo != strlen (rxstr->strings[i])) ))
228 eval_check = 1; 229 eval_check = 1;
229 230
230 if (((rxstr->expected_results[i] == match) && ((0 != eval) ||(0 != 231 if (((rxstr->expected_results[i] == match) && ((0 != eval) || (0 !=
231 eval_check) )) 232 eval_check) ))
232 || ((rxstr->expected_results[i] == nomatch) && 233 || ((rxstr->expected_results[i] == nomatch) &&
233 ((0 == eval) ||(0 == eval_check) ))) 234 ((0 == eval) || (0 == eval_check) )))
234 { 235 {
235 result = 1; 236 result = 1;
236 regerror (eval_check, rx, error, sizeof error); 237 regerror (eval_check, rx, error, sizeof error);
@@ -247,6 +248,7 @@ test_automaton (struct REGEX_INTERNAL_Automaton *a, regex_t *rx,
247 return result; 248 return result;
248} 249}
249 250
251
250int 252int
251main (int argc, char *argv[]) 253main (int argc, char *argv[])
252{ 254{