diff options
author | Maximilian Szengel <gnunet@maxsz.de> | 2012-06-26 13:52:08 +0000 |
---|---|---|
committer | Maximilian Szengel <gnunet@maxsz.de> | 2012-06-26 13:52:08 +0000 |
commit | d6871d5ea20b9cd746431f4cefcc78740e246a99 (patch) | |
tree | da33ba19c9b8b8cdd46556ccddd2b168305437d4 /src/regex/test_regex_eval_api.c | |
parent | 3a3e4c0f1b588f687ff98fcee4952fa02e97dfb2 (diff) | |
download | gnunet-d6871d5ea20b9cd746431f4cefcc78740e246a99.tar.gz gnunet-d6871d5ea20b9cd746431f4cefcc78740e246a99.zip |
doxygen fixes
Diffstat (limited to 'src/regex/test_regex_eval_api.c')
-rw-r--r-- | src/regex/test_regex_eval_api.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/regex/test_regex_eval_api.c b/src/regex/test_regex_eval_api.c index 1a25c4173..b6cdbe100 100644 --- a/src/regex/test_regex_eval_api.c +++ b/src/regex/test_regex_eval_api.c | |||
@@ -71,14 +71,14 @@ test_random (unsigned int rx_length, unsigned int max_str_len, | |||
71 | char current_char; | 71 | char current_char; |
72 | int eval; | 72 | int eval; |
73 | int eval_check; | 73 | int eval_check; |
74 | int eval_computed; | 74 | int eval_canonical; |
75 | struct GNUNET_REGEX_Automaton *dfa; | 75 | struct GNUNET_REGEX_Automaton *dfa; |
76 | regex_t rx; | 76 | regex_t rx; |
77 | regmatch_t matchptr[1]; | 77 | regmatch_t matchptr[1]; |
78 | char error[200]; | 78 | char error[200]; |
79 | int result; | 79 | int result; |
80 | unsigned int str_len; | 80 | unsigned int str_len; |
81 | char *computed_regex; | 81 | char *canonical_regex; |
82 | 82 | ||
83 | // At least one string is needed for matching | 83 | // At least one string is needed for matching |
84 | GNUNET_assert (str_count > 0); | 84 | GNUNET_assert (str_count > 0); |
@@ -164,7 +164,7 @@ test_random (unsigned int rx_length, unsigned int max_str_len, | |||
164 | } | 164 | } |
165 | 165 | ||
166 | eval = GNUNET_REGEX_eval (dfa, matching_str[i]); | 166 | eval = GNUNET_REGEX_eval (dfa, matching_str[i]); |
167 | computed_regex = GNUNET_strdup (GNUNET_REGEX_get_computed_regex (dfa)); | 167 | canonical_regex = GNUNET_strdup (GNUNET_REGEX_get_canonical_regex (dfa)); |
168 | GNUNET_REGEX_automaton_destroy (dfa); | 168 | GNUNET_REGEX_automaton_destroy (dfa); |
169 | 169 | ||
170 | // Match string using glibc regex | 170 | // Match string using glibc regex |
@@ -178,18 +178,18 @@ test_random (unsigned int rx_length, unsigned int max_str_len, | |||
178 | eval_check = regexec (&rx, matching_str[i], 1, matchptr, 0); | 178 | eval_check = regexec (&rx, matching_str[i], 1, matchptr, 0); |
179 | regfree (&rx); | 179 | regfree (&rx); |
180 | 180 | ||
181 | // Match computed regex | 181 | // Match canonical regex |
182 | if (0 != regcomp (&rx, computed_regex, REG_EXTENDED)) | 182 | if (0 != regcomp (&rx, canonical_regex, REG_EXTENDED)) |
183 | { | 183 | { |
184 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 184 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
185 | "Could not compile regex using regcomp: %s\n", | 185 | "Could not compile regex using regcomp: %s\n", |
186 | computed_regex); | 186 | canonical_regex); |
187 | return -1; | 187 | return -1; |
188 | } | 188 | } |
189 | 189 | ||
190 | eval_computed = regexec (&rx, matching_str[i], 1, matchptr, 0); | 190 | eval_canonical = regexec (&rx, matching_str[i], 1, matchptr, 0); |
191 | regfree (&rx); | 191 | regfree (&rx); |
192 | GNUNET_free (computed_regex); | 192 | GNUNET_free (canonical_regex); |
193 | 193 | ||
194 | // We only want to match the whole string, because that's what our DFA does, too. | 194 | // We only want to match the whole string, because that's what our DFA does, too. |
195 | if (eval_check == 0 && | 195 | if (eval_check == 0 && |
@@ -356,7 +356,7 @@ main (int argc, char *argv[]) | |||
356 | // DFA test | 356 | // DFA test |
357 | a = GNUNET_REGEX_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex)); | 357 | a = GNUNET_REGEX_construct_dfa (rxstr[i].regex, strlen (rxstr[i].regex)); |
358 | check_dfa += test_automaton (a, &rx, &rxstr[i]); | 358 | check_dfa += test_automaton (a, &rx, &rxstr[i]); |
359 | check_proof = GNUNET_strdup (GNUNET_REGEX_get_computed_regex (a)); | 359 | check_proof = GNUNET_strdup (GNUNET_REGEX_get_canonical_regex (a)); |
360 | GNUNET_REGEX_automaton_destroy (a); | 360 | GNUNET_REGEX_automaton_destroy (a); |
361 | a = GNUNET_REGEX_construct_dfa (check_proof, strlen (check_proof)); | 361 | a = GNUNET_REGEX_construct_dfa (check_proof, strlen (check_proof)); |
362 | check_dfa += test_automaton (a, &rx, &rxstr[i]); | 362 | check_dfa += test_automaton (a, &rx, &rxstr[i]); |
@@ -369,8 +369,8 @@ main (int argc, char *argv[]) | |||
369 | } | 369 | } |
370 | 370 | ||
371 | srand (time (NULL)); | 371 | srand (time (NULL)); |
372 | for (i = 0; i < 50; i++) | 372 | for (i = 0; i < 50; i++) |
373 | check_rand += test_random (100, 120, 20); | 373 | check_rand += test_random (100, 120, 20); |
374 | 374 | ||
375 | return check_nfa + check_dfa + check_rand; | 375 | return check_nfa + check_dfa + check_rand; |
376 | } | 376 | } |