diff options
author | Maximilian Szengel <gnunet@maxsz.de> | 2012-05-07 11:16:53 +0000 |
---|---|---|
committer | Maximilian Szengel <gnunet@maxsz.de> | 2012-05-07 11:16:53 +0000 |
commit | 2e7a6b023989a31954928972150e6ee4d10e06df (patch) | |
tree | 119f5c29e308c55e5cd337732f38e156a3cd39fb /src/regex/test_regex_iterate_api.c | |
parent | 426bcaa9b80ce3507873be65f0da57e6e4d45ae7 (diff) | |
download | gnunet-2e7a6b023989a31954928972150e6ee4d10e06df.tar.gz gnunet-2e7a6b023989a31954928972150e6ee4d10e06df.zip |
- State merging fix
- Proof creation WIP
Diffstat (limited to 'src/regex/test_regex_iterate_api.c')
-rw-r--r-- | src/regex/test_regex_iterate_api.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/regex/test_regex_iterate_api.c b/src/regex/test_regex_iterate_api.c index 52cd12cb6..7c7324aa5 100644 --- a/src/regex/test_regex_iterate_api.c +++ b/src/regex/test_regex_iterate_api.c | |||
@@ -39,6 +39,9 @@ key_iterator (void *cls, const GNUNET_HashCode * key, const char *proof, | |||
39 | { | 39 | { |
40 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Edge %i: %s\n", i, edges[i].label); | 40 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Edge %i: %s\n", i, edges[i].label); |
41 | } | 41 | } |
42 | |||
43 | if (NULL != proof) | ||
44 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Proof: %s\n", proof); | ||
42 | } | 45 | } |
43 | 46 | ||
44 | int | 47 | int |
@@ -55,14 +58,31 @@ main (int argc, char *argv[]) | |||
55 | int error; | 58 | int error; |
56 | const char *regex; | 59 | const char *regex; |
57 | struct GNUNET_REGEX_Automaton *dfa; | 60 | struct GNUNET_REGEX_Automaton *dfa; |
61 | struct GNUNET_REGEX_Automaton *nfa; | ||
58 | 62 | ||
59 | error = 0; | 63 | error = 0; |
60 | regex = "ab?(abcd)?"; | 64 | /*regex = "ab?|xy|(abcd)?"; */ |
65 | /*regex = "(ab|cd|ef)xy"; */ | ||
66 | /*regex = "(ac|bc)de"; */ | ||
67 | /*regex = "((a|b)c)de"; */ | ||
68 | /*regex = "a+X*y+c|p|R|Z*K*y*R+w|Y*6+n+h*k*w+V*F|W*B*e*"; */ | ||
69 | regex = "ab(c|d)+c*(a(b|c)d)+"; | ||
70 | /*regex = "ab?(abcd)?"; */ | ||
71 | const char *regex1 = "(ac|bc)de"; | ||
72 | const char *regex2 = "((a|b)c)de"; | ||
61 | 73 | ||
74 | /*nfa = GNUNET_REGEX_construct_nfa (regex, strlen (regex)); */ | ||
75 | /*GNUNET_REGEX_automaton_save_graph (nfa, "nfa.dot"); */ | ||
62 | dfa = GNUNET_REGEX_construct_dfa (regex, strlen (regex)); | 76 | dfa = GNUNET_REGEX_construct_dfa (regex, strlen (regex)); |
63 | GNUNET_REGEX_automaton_save_graph (dfa, "dfa.dot"); | 77 | GNUNET_REGEX_automaton_save_graph (dfa, "dfa.dot"); |
64 | GNUNET_REGEX_iterate_all_edges (dfa, key_iterator, NULL); | 78 | GNUNET_REGEX_iterate_all_edges (dfa, key_iterator, NULL); |
65 | GNUNET_REGEX_automaton_destroy (dfa); | 79 | GNUNET_REGEX_automaton_destroy (dfa); |
80 | dfa = GNUNET_REGEX_construct_dfa (regex1, strlen (regex1)); | ||
81 | GNUNET_REGEX_automaton_save_graph (dfa, "dfa1.dot"); | ||
82 | GNUNET_REGEX_automaton_destroy (dfa); | ||
83 | dfa = GNUNET_REGEX_construct_dfa (regex2, strlen (regex2)); | ||
84 | GNUNET_REGEX_automaton_save_graph (dfa, "dfa2.dot"); | ||
85 | GNUNET_REGEX_automaton_destroy (dfa); | ||
66 | 86 | ||
67 | return error; | 87 | return error; |
68 | } | 88 | } |