diff options
author | Maximilian Szengel <gnunet@maxsz.de> | 2012-04-02 09:39:00 +0000 |
---|---|---|
committer | Maximilian Szengel <gnunet@maxsz.de> | 2012-04-02 09:39:00 +0000 |
commit | 9333777c8beb3d3c56f2f37d1b0e61fecd08f80c (patch) | |
tree | b1937750480652b426ab8fb7bc67bbae69013fd0 /src/regex/test_regex.c | |
parent | c9b161c04b8e6349bc2e2856c2d2d02aa03bb1f0 (diff) |
DFA evaluation
Diffstat (limited to 'src/regex/test_regex.c')
-rw-r--r-- | src/regex/test_regex.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/regex/test_regex.c b/src/regex/test_regex.c index dcc4ce0edd..56aea52a70 100644 --- a/src/regex/test_regex.c +++ b/src/regex/test_regex.c @@ -41,11 +41,14 @@ main (int argc, char *argv[]) struct GNUNET_REGEX_Automaton *nfa; struct GNUNET_REGEX_Automaton *dfa; char *regex; + char *string; + int eval; nfa = NULL; dfa = NULL; regex = "a\\*b(c|d)+c*(a(b|c)d)+"; + string = "a*bcabd"; /*regex = "\\*a(a|b)b"; */ /*regex = "a(a|b)c"; */ /*regex = "(a|aa)+"; */ @@ -54,6 +57,11 @@ main (int argc, char *argv[]) if (nfa) { GNUNET_REGEX_automaton_save_graph (nfa, "nfa_graph.dot"); + eval = GNUNET_REGEX_eval (nfa, string); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Evaluating %s result: %i\n", string, + eval); + if (GNUNET_YES != eval) + err = 1; GNUNET_REGEX_automaton_destroy (nfa); } else @@ -63,6 +71,11 @@ main (int argc, char *argv[]) if (dfa) { GNUNET_REGEX_automaton_save_graph (dfa, "dfa_graph.dot"); + eval = GNUNET_REGEX_eval (dfa, string); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Evaluating %s result: %i\n", string, + eval); + if (GNUNET_YES != eval) + err = 1; GNUNET_REGEX_automaton_destroy (dfa); } return err; |