[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25489 - gnunet/src/regex
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25489 - gnunet/src/regex |
Date: |
Fri, 14 Dec 2012 21:12:39 +0100 |
Author: grothoff
Date: 2012-12-14 21:12:39 +0100 (Fri, 14 Dec 2012)
New Revision: 25489
Modified:
gnunet/src/regex/test_regex_iterate_api.c
gnunet/src/regex/test_regex_proofs.c
Log:
-minor fixes
Modified: gnunet/src/regex/test_regex_iterate_api.c
===================================================================
--- gnunet/src/regex/test_regex_iterate_api.c 2012-12-14 18:51:10 UTC (rev
25488)
+++ gnunet/src/regex/test_regex_iterate_api.c 2012-12-14 20:12:39 UTC (rev
25489)
@@ -57,7 +57,8 @@
char *strings[20];
};
-void
+
+static void
key_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof,
int accepting, unsigned int num_edges,
const struct GNUNET_REGEX_Edge *edges)
@@ -67,6 +68,7 @@
char *out_str;
char *state_id = GNUNET_strdup (GNUNET_h2s (key));
+ GNUNET_assert (NULL != proof);
if (GNUNET_YES == ctx->should_save_graph)
{
if (GNUNET_YES == accepting)
Modified: gnunet/src/regex/test_regex_proofs.c
===================================================================
--- gnunet/src/regex/test_regex_proofs.c 2012-12-14 18:51:10 UTC (rev
25488)
+++ gnunet/src/regex/test_regex_proofs.c 2012-12-14 20:12:39 UTC (rev
25489)
@@ -38,7 +38,7 @@
*
* @return 0 on success, 1 on failure
*/
-unsigned int
+static unsigned int
test_proof (const char *regex)
{
unsigned int error;
@@ -47,9 +47,11 @@
const char *c_rx2;
dfa = GNUNET_REGEX_construct_dfa (regex, strlen (regex), 1);
+ GNUNET_assert (NULL != dfa);
c_rx1 = GNUNET_strdup (GNUNET_REGEX_get_canonical_regex (dfa));
GNUNET_REGEX_automaton_destroy (dfa);
dfa = GNUNET_REGEX_construct_dfa (c_rx1, strlen (c_rx1), 1);
+ GNUNET_assert (NULL != dfa);
c_rx2 = GNUNET_REGEX_get_canonical_regex (dfa);
error = (0 == strcmp (c_rx1, c_rx2)) ? 0 : 1;
@@ -67,6 +69,7 @@
return error;
}
+
/**
* Use 'test_proof' function to randomly test the canonical regexes of 'count'
* random expressions of length 'rx_length'.
@@ -76,7 +79,7 @@
*
* @return 0 on succes, number of failures otherwise.
*/
-unsigned int
+static unsigned int
test_proofs_random (unsigned int count, size_t rx_length)
{
unsigned int i;
@@ -95,13 +98,14 @@
return failures;
}
+
/**
* Test a number of known examples of regexes for proper canonicalization.
*
* @return 0 on success, number of failures otherwise.
*/
-unsigned int
-test_proofs_static (void)
+static unsigned int
+test_proofs_static ()
{
unsigned int i;
unsigned int error;
@@ -128,6 +132,8 @@
{
dfa1 = GNUNET_REGEX_construct_dfa (regex[i], strlen (regex[i]), 1);
dfa2 = GNUNET_REGEX_construct_dfa (regex[i + 1], strlen (regex[i + 1]), 1);
+ GNUNET_assert (NULL != dfa1);
+ GNUNET_assert (NULL != dfa2);
canon_rx1 = GNUNET_REGEX_get_canonical_regex (dfa1);
canon_rx2 = GNUNET_REGEX_get_canonical_regex (dfa2);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25489 - gnunet/src/regex,
gnunet <=