aboutsummaryrefslogtreecommitdiff
path: root/src/regex/test_regex_proofs.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-06-20 08:32:50 +0000
committerChristian Grothoff <christian@grothoff.org>2013-06-20 08:32:50 +0000
commit21a2b4f95b4488645ba5a6254fcb8919c4915f73 (patch)
tree00c92cb7103cc14fba7e63e8dee99fe711856863 /src/regex/test_regex_proofs.c
parent5533b105943b4f6dd688c1758350cd83ebeab3b9 (diff)
downloadgnunet-21a2b4f95b4488645ba5a6254fcb8919c4915f73.tar.gz
gnunet-21a2b4f95b4488645ba5a6254fcb8919c4915f73.zip
continuing refactoring of regex library structure, disambiguating symbol names between old regex library which is now internal and the public API; moving IP-to-regex conversion functions to tun library, as only vpn is using those to begin with
Diffstat (limited to 'src/regex/test_regex_proofs.c')
-rw-r--r--src/regex/test_regex_proofs.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/regex/test_regex_proofs.c b/src/regex/test_regex_proofs.c
index 92a3a411f..f5bac0ad7 100644
--- a/src/regex/test_regex_proofs.c
+++ b/src/regex/test_regex_proofs.c
@@ -23,7 +23,7 @@
23 * @author Maximilian Szengel 23 * @author Maximilian Szengel
24 */ 24 */
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_regex_lib.h" 26#include "regex_internal_lib.h"
27#include "regex_internal.h" 27#include "regex_internal.h"
28 28
29 29
@@ -42,17 +42,17 @@ static unsigned int
42test_proof (const char *regex) 42test_proof (const char *regex)
43{ 43{
44 unsigned int error; 44 unsigned int error;
45 struct GNUNET_REGEX_Automaton *dfa; 45 struct REGEX_ITERNAL_Automaton *dfa;
46 char *c_rx1; 46 char *c_rx1;
47 const char *c_rx2; 47 const char *c_rx2;
48 48
49 dfa = GNUNET_REGEX_construct_dfa (regex, strlen (regex), 1); 49 dfa = REGEX_ITERNAL_construct_dfa (regex, strlen (regex), 1);
50 GNUNET_assert (NULL != dfa); 50 GNUNET_assert (NULL != dfa);
51 c_rx1 = GNUNET_strdup (GNUNET_REGEX_get_canonical_regex (dfa)); 51 c_rx1 = GNUNET_strdup (REGEX_ITERNAL_get_canonical_regex (dfa));
52 GNUNET_REGEX_automaton_destroy (dfa); 52 REGEX_ITERNAL_automaton_destroy (dfa);
53 dfa = GNUNET_REGEX_construct_dfa (c_rx1, strlen (c_rx1), 1); 53 dfa = REGEX_ITERNAL_construct_dfa (c_rx1, strlen (c_rx1), 1);
54 GNUNET_assert (NULL != dfa); 54 GNUNET_assert (NULL != dfa);
55 c_rx2 = GNUNET_REGEX_get_canonical_regex (dfa); 55 c_rx2 = REGEX_ITERNAL_get_canonical_regex (dfa);
56 56
57 error = (0 == strcmp (c_rx1, c_rx2)) ? 0 : 1; 57 error = (0 == strcmp (c_rx1, c_rx2)) ? 0 : 1;
58 58
@@ -64,7 +64,7 @@ test_proof (const char *regex)
64 } 64 }
65 65
66 GNUNET_free (c_rx1); 66 GNUNET_free (c_rx1);
67 GNUNET_REGEX_automaton_destroy (dfa); 67 REGEX_ITERNAL_automaton_destroy (dfa);
68 68
69 return error; 69 return error;
70} 70}
@@ -90,7 +90,7 @@ test_proofs_random (unsigned int count, size_t rx_length)
90 90
91 for (i = 0; i < count; i++) 91 for (i = 0; i < count; i++)
92 { 92 {
93 rand_rx = GNUNET_REGEX_generate_random_regex (rx_length, NULL); 93 rand_rx = REGEX_ITERNAL_generate_random_regex (rx_length, NULL);
94 failures += test_proof (rand_rx); 94 failures += test_proof (rand_rx);
95 GNUNET_free (rand_rx); 95 GNUNET_free (rand_rx);
96 } 96 }
@@ -123,20 +123,20 @@ test_proofs_static ()
123 123
124 const char *canon_rx1; 124 const char *canon_rx1;
125 const char *canon_rx2; 125 const char *canon_rx2;
126 struct GNUNET_REGEX_Automaton *dfa1; 126 struct REGEX_ITERNAL_Automaton *dfa1;
127 struct GNUNET_REGEX_Automaton *dfa2; 127 struct REGEX_ITERNAL_Automaton *dfa2;
128 128
129 error = 0; 129 error = 0;
130 130
131 for (i = 0; i < 8; i += 2) 131 for (i = 0; i < 8; i += 2)
132 { 132 {
133 dfa1 = GNUNET_REGEX_construct_dfa (regex[i], strlen (regex[i]), 1); 133 dfa1 = REGEX_ITERNAL_construct_dfa (regex[i], strlen (regex[i]), 1);
134 dfa2 = GNUNET_REGEX_construct_dfa (regex[i + 1], strlen (regex[i + 1]), 1); 134 dfa2 = REGEX_ITERNAL_construct_dfa (regex[i + 1], strlen (regex[i + 1]), 1);
135 GNUNET_assert (NULL != dfa1); 135 GNUNET_assert (NULL != dfa1);
136 GNUNET_assert (NULL != dfa2); 136 GNUNET_assert (NULL != dfa2);
137 137
138 canon_rx1 = GNUNET_REGEX_get_canonical_regex (dfa1); 138 canon_rx1 = REGEX_ITERNAL_get_canonical_regex (dfa1);
139 canon_rx2 = GNUNET_REGEX_get_canonical_regex (dfa2); 139 canon_rx2 = REGEX_ITERNAL_get_canonical_regex (dfa2);
140 140
141 error += (0 == strcmp (canon_rx1, canon_rx2)) ? 0 : 1; 141 error += (0 == strcmp (canon_rx1, canon_rx2)) ? 0 : 1;
142 142
@@ -147,8 +147,8 @@ test_proofs_static ()
147 regex[i], canon_rx1, regex[i + 1], canon_rx2); 147 regex[i], canon_rx1, regex[i + 1], canon_rx2);
148 } 148 }
149 149
150 GNUNET_REGEX_automaton_destroy (dfa1); 150 REGEX_ITERNAL_automaton_destroy (dfa1);
151 GNUNET_REGEX_automaton_destroy (dfa2); 151 REGEX_ITERNAL_automaton_destroy (dfa2);
152 } 152 }
153 153
154 return error; 154 return error;