diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-12-14 20:12:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-12-14 20:12:39 +0000 |
commit | a3aacce89467a1cbcd2193d8a667aad069b47be5 (patch) | |
tree | e2fc058e0fb2d89af10bedd36d5c472925b8af0e /src/regex/test_regex_proofs.c | |
parent | 0f16f15060952ceae16cf6e321b161b8793eed3c (diff) | |
download | gnunet-a3aacce89467a1cbcd2193d8a667aad069b47be5.tar.gz gnunet-a3aacce89467a1cbcd2193d8a667aad069b47be5.zip |
-minor fixes
Diffstat (limited to 'src/regex/test_regex_proofs.c')
-rw-r--r-- | src/regex/test_regex_proofs.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/regex/test_regex_proofs.c b/src/regex/test_regex_proofs.c index a5e049fba..92a3a411f 100644 --- a/src/regex/test_regex_proofs.c +++ b/src/regex/test_regex_proofs.c | |||
@@ -38,7 +38,7 @@ | |||
38 | * | 38 | * |
39 | * @return 0 on success, 1 on failure | 39 | * @return 0 on success, 1 on failure |
40 | */ | 40 | */ |
41 | unsigned int | 41 | static unsigned int |
42 | test_proof (const char *regex) | 42 | test_proof (const char *regex) |
43 | { | 43 | { |
44 | unsigned int error; | 44 | unsigned int error; |
@@ -47,9 +47,11 @@ test_proof (const char *regex) | |||
47 | const char *c_rx2; | 47 | const char *c_rx2; |
48 | 48 | ||
49 | dfa = GNUNET_REGEX_construct_dfa (regex, strlen (regex), 1); | 49 | dfa = GNUNET_REGEX_construct_dfa (regex, strlen (regex), 1); |
50 | GNUNET_assert (NULL != dfa); | ||
50 | c_rx1 = GNUNET_strdup (GNUNET_REGEX_get_canonical_regex (dfa)); | 51 | c_rx1 = GNUNET_strdup (GNUNET_REGEX_get_canonical_regex (dfa)); |
51 | GNUNET_REGEX_automaton_destroy (dfa); | 52 | GNUNET_REGEX_automaton_destroy (dfa); |
52 | dfa = GNUNET_REGEX_construct_dfa (c_rx1, strlen (c_rx1), 1); | 53 | dfa = GNUNET_REGEX_construct_dfa (c_rx1, strlen (c_rx1), 1); |
54 | GNUNET_assert (NULL != dfa); | ||
53 | c_rx2 = GNUNET_REGEX_get_canonical_regex (dfa); | 55 | c_rx2 = GNUNET_REGEX_get_canonical_regex (dfa); |
54 | 56 | ||
55 | error = (0 == strcmp (c_rx1, c_rx2)) ? 0 : 1; | 57 | error = (0 == strcmp (c_rx1, c_rx2)) ? 0 : 1; |
@@ -67,6 +69,7 @@ test_proof (const char *regex) | |||
67 | return error; | 69 | return error; |
68 | } | 70 | } |
69 | 71 | ||
72 | |||
70 | /** | 73 | /** |
71 | * Use 'test_proof' function to randomly test the canonical regexes of 'count' | 74 | * Use 'test_proof' function to randomly test the canonical regexes of 'count' |
72 | * random expressions of length 'rx_length'. | 75 | * random expressions of length 'rx_length'. |
@@ -76,7 +79,7 @@ test_proof (const char *regex) | |||
76 | * | 79 | * |
77 | * @return 0 on succes, number of failures otherwise. | 80 | * @return 0 on succes, number of failures otherwise. |
78 | */ | 81 | */ |
79 | unsigned int | 82 | static unsigned int |
80 | test_proofs_random (unsigned int count, size_t rx_length) | 83 | test_proofs_random (unsigned int count, size_t rx_length) |
81 | { | 84 | { |
82 | unsigned int i; | 85 | unsigned int i; |
@@ -95,13 +98,14 @@ test_proofs_random (unsigned int count, size_t rx_length) | |||
95 | return failures; | 98 | return failures; |
96 | } | 99 | } |
97 | 100 | ||
101 | |||
98 | /** | 102 | /** |
99 | * Test a number of known examples of regexes for proper canonicalization. | 103 | * Test a number of known examples of regexes for proper canonicalization. |
100 | * | 104 | * |
101 | * @return 0 on success, number of failures otherwise. | 105 | * @return 0 on success, number of failures otherwise. |
102 | */ | 106 | */ |
103 | unsigned int | 107 | static unsigned int |
104 | test_proofs_static (void) | 108 | test_proofs_static () |
105 | { | 109 | { |
106 | unsigned int i; | 110 | unsigned int i; |
107 | unsigned int error; | 111 | unsigned int error; |
@@ -128,6 +132,8 @@ test_proofs_static (void) | |||
128 | { | 132 | { |
129 | dfa1 = GNUNET_REGEX_construct_dfa (regex[i], strlen (regex[i]), 1); | 133 | dfa1 = GNUNET_REGEX_construct_dfa (regex[i], strlen (regex[i]), 1); |
130 | dfa2 = GNUNET_REGEX_construct_dfa (regex[i + 1], strlen (regex[i + 1]), 1); | 134 | dfa2 = GNUNET_REGEX_construct_dfa (regex[i + 1], strlen (regex[i + 1]), 1); |
135 | GNUNET_assert (NULL != dfa1); | ||
136 | GNUNET_assert (NULL != dfa2); | ||
131 | 137 | ||
132 | canon_rx1 = GNUNET_REGEX_get_canonical_regex (dfa1); | 138 | canon_rx1 = GNUNET_REGEX_get_canonical_regex (dfa1); |
133 | canon_rx2 = GNUNET_REGEX_get_canonical_regex (dfa2); | 139 | canon_rx2 = GNUNET_REGEX_get_canonical_regex (dfa2); |