diff options
author | Maximilian Szengel <gnunet@maxsz.de> | 2012-07-04 13:54:43 +0000 |
---|---|---|
committer | Maximilian Szengel <gnunet@maxsz.de> | 2012-07-04 13:54:43 +0000 |
commit | bd0e2cd49ae9ae916f6a4288ac8893128b8168d6 (patch) | |
tree | c680e35f3d2bb3cffb114808bd19f2299885af50 /src/regex/test_regex_proofs.c | |
parent | a93954693fef730d7a41c168b4961d19e5dff90c (diff) | |
download | gnunet-bd0e2cd49ae9ae916f6a4288ac8893128b8168d6.tar.gz gnunet-bd0e2cd49ae9ae916f6a4288ac8893128b8168d6.zip |
Summary: regex cleanup and bugfixes
Author: szengel
Diffstat (limited to 'src/regex/test_regex_proofs.c')
-rw-r--r-- | src/regex/test_regex_proofs.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/regex/test_regex_proofs.c b/src/regex/test_regex_proofs.c index 831f4dc48..8ba0e142f 100644 --- a/src/regex/test_regex_proofs.c +++ b/src/regex/test_regex_proofs.c | |||
@@ -106,16 +106,15 @@ test_proofs_static (void) | |||
106 | unsigned int i; | 106 | unsigned int i; |
107 | unsigned int error; | 107 | unsigned int error; |
108 | 108 | ||
109 | const char *regex[6] = { | 109 | const char *regex[8] = { |
110 | "a|aa*a", | 110 | "a|aa*a", |
111 | "a+", | 111 | "a+", |
112 | "a*", | 112 | "a*", |
113 | "a*a*", | 113 | "a*a*", |
114 | "(F*C|WfPf|y+F*C)", | 114 | "(F*C|WfPf|y+F*C)", |
115 | "y*F*C|WfPf", | 115 | "y*F*C|WfPf", |
116 | /* "2?jA?e?D*K", */ | 116 | "((a|b)c|(a|b)(d|(a|b)e))", |
117 | /* "((j|2j)K|(j|2j)AK|(j|2j)(D|e|(j|2j)A(D|e))D*K)", */ | 117 | "((a|b)(c|d)|(a|b)(a|b)e)" |
118 | /* "((j|2j)K|(j|2j)(D|e|((j|2j)j|(j|2j)2j)A(D|e))D*K|(j|2j)AK)", */ | ||
119 | }; | 118 | }; |
120 | 119 | ||
121 | const char *canon_rx1; | 120 | const char *canon_rx1; |
@@ -125,7 +124,7 @@ test_proofs_static (void) | |||
125 | 124 | ||
126 | error = 0; | 125 | error = 0; |
127 | 126 | ||
128 | for (i = 0; i < 6; i += 2) | 127 | for (i = 0; i < 8; i += 2) |
129 | { | 128 | { |
130 | dfa1 = GNUNET_REGEX_construct_dfa (regex[i], strlen (regex[i])); | 129 | dfa1 = GNUNET_REGEX_construct_dfa (regex[i], strlen (regex[i])); |
131 | dfa2 = GNUNET_REGEX_construct_dfa (regex[i + 1], strlen (regex[i + 1])); | 130 | dfa2 = GNUNET_REGEX_construct_dfa (regex[i + 1], strlen (regex[i + 1])); |
@@ -138,12 +137,8 @@ test_proofs_static (void) | |||
138 | if (error > 0) | 137 | if (error > 0) |
139 | { | 138 | { |
140 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 139 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
141 | "Comparing canonical regex failed:\nrx1: %s\ncrx1: %s\nrx2: %s\ncrx2: %s\n", | 140 | "Comparing canonical regex failed:\nrx1:\t%s\ncrx1:\t%s\nrx2:\t%s\ncrx2:\t%s\n", |
142 | regex[i], canon_rx1, regex[i + 1], canon_rx2); | 141 | regex[i], canon_rx1, regex[i + 1], canon_rx2); |
143 | |||
144 | /* Save the graphs of the two conflicting DFAs */ | ||
145 | /* GNUNET_REGEX_automaton_save_graph (dfa1, "proofs_fail_dfa1.dot"); */ | ||
146 | /* GNUNET_REGEX_automaton_save_graph (dfa2, "proofs_fail_dfa2.dot"); */ | ||
147 | } | 142 | } |
148 | 143 | ||
149 | GNUNET_REGEX_automaton_destroy (dfa1); | 144 | GNUNET_REGEX_automaton_destroy (dfa1); |
@@ -170,7 +165,7 @@ main (int argc, char *argv[]) | |||
170 | error = 0; | 165 | error = 0; |
171 | 166 | ||
172 | error += test_proofs_static (); | 167 | error += test_proofs_static (); |
173 | /* error += test_proofs_random (10000, 10); */ | 168 | error += test_proofs_random (100, 30); |
174 | 169 | ||
175 | return error; | 170 | return error; |
176 | } | 171 | } |