add $(GN_LIBINTL) to Makefile.am (fixes 0005902)
[oweals/gnunet.git] / src / regex / test_regex_proofs.c
index f5bac0ad76f54a025c1466c96784fffbcc7dc859..8908084b0bafd102f0b082dc79a9f2e706a9b992 100644 (file)
@@ -1,22 +1,22 @@
 /*
      This file is part of GNUnet
-     (C) 2012 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2012 GNUnet e.V.
 
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
+     Affero General Public License for more details.
 
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-*/
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
+ */
 /**
  * @file regex/test_regex_proofs.c
  * @brief test for regex.c
@@ -24,6 +24,7 @@
  */
 #include "platform.h"
 #include "regex_internal_lib.h"
+#include "regex_test_lib.h"
 #include "regex_internal.h"
 
 
@@ -42,17 +43,17 @@ static unsigned int
 test_proof (const char *regex)
 {
   unsigned int error;
-  struct REGEX_ITERNAL_Automaton *dfa;
+  struct REGEX_INTERNAL_Automaton *dfa;
   char *c_rx1;
   const char *c_rx2;
 
-  dfa = REGEX_ITERNAL_construct_dfa (regex, strlen (regex), 1);
+  dfa = REGEX_INTERNAL_construct_dfa (regex, strlen (regex), 1);
   GNUNET_assert (NULL != dfa);
-  c_rx1 = GNUNET_strdup (REGEX_ITERNAL_get_canonical_regex (dfa));
-  REGEX_ITERNAL_automaton_destroy (dfa);
-  dfa = REGEX_ITERNAL_construct_dfa (c_rx1, strlen (c_rx1), 1);
+  c_rx1 = GNUNET_strdup (REGEX_INTERNAL_get_canonical_regex (dfa));
+  REGEX_INTERNAL_automaton_destroy (dfa);
+  dfa = REGEX_INTERNAL_construct_dfa (c_rx1, strlen (c_rx1), 1);
   GNUNET_assert (NULL != dfa);
-  c_rx2 = REGEX_ITERNAL_get_canonical_regex (dfa);
+  c_rx2 = REGEX_INTERNAL_get_canonical_regex (dfa);
 
   error = (0 == strcmp (c_rx1, c_rx2)) ? 0 : 1;
 
@@ -64,7 +65,7 @@ test_proof (const char *regex)
   }
 
   GNUNET_free (c_rx1);
-  REGEX_ITERNAL_automaton_destroy (dfa);
+  REGEX_INTERNAL_automaton_destroy (dfa);
 
   return error;
 }
@@ -90,7 +91,7 @@ test_proofs_random (unsigned int count, size_t rx_length)
 
   for (i = 0; i < count; i++)
   {
-    rand_rx = REGEX_ITERNAL_generate_random_regex (rx_length, NULL);
+    rand_rx = REGEX_TEST_generate_random_regex (rx_length, NULL);
     failures += test_proof (rand_rx);
     GNUNET_free (rand_rx);
   }
@@ -123,20 +124,21 @@ test_proofs_static ()
 
   const char *canon_rx1;
   const char *canon_rx2;
-  struct REGEX_ITERNAL_Automaton *dfa1;
-  struct REGEX_ITERNAL_Automaton *dfa2;
+  struct REGEX_INTERNAL_Automaton *dfa1;
+  struct REGEX_INTERNAL_Automaton *dfa2;
 
   error = 0;
 
   for (i = 0; i < 8; i += 2)
   {
-    dfa1 = REGEX_ITERNAL_construct_dfa (regex[i], strlen (regex[i]), 1);
-    dfa2 = REGEX_ITERNAL_construct_dfa (regex[i + 1], strlen (regex[i + 1]), 1);
+    dfa1 = REGEX_INTERNAL_construct_dfa (regex[i], strlen (regex[i]), 1);
+    dfa2 = REGEX_INTERNAL_construct_dfa (regex[i + 1], strlen (regex[i + 1]),
+                                         1);
     GNUNET_assert (NULL != dfa1);
     GNUNET_assert (NULL != dfa2);
 
-    canon_rx1 = REGEX_ITERNAL_get_canonical_regex (dfa1);
-    canon_rx2 = REGEX_ITERNAL_get_canonical_regex (dfa2);
+    canon_rx1 = REGEX_INTERNAL_get_canonical_regex (dfa1);
+    canon_rx2 = REGEX_INTERNAL_get_canonical_regex (dfa2);
 
     error += (0 == strcmp (canon_rx1, canon_rx2)) ? 0 : 1;
 
@@ -147,8 +149,8 @@ test_proofs_static ()
                   regex[i], canon_rx1, regex[i + 1], canon_rx2);
     }
 
-    REGEX_ITERNAL_automaton_destroy (dfa1);
-    REGEX_ITERNAL_automaton_destroy (dfa2);
+    REGEX_INTERNAL_automaton_destroy (dfa1);
+    REGEX_INTERNAL_automaton_destroy (dfa2);
   }
 
   return error;