doxygen, indentation
[oweals/gnunet.git] / src / regex / test_regex_graph_api.c
index 9e8e1fb165134adff648640ce62f607e75bbc271..b57c79edddfd78bf2324e219c0781c9c6aff5cac 100644 (file)
@@ -48,7 +48,7 @@ filecheck (const char *filename)
   if (NULL == fp)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not find graph %s\n", filename);
-    error++;
+    return ++error;
   }
 
   fseek (fp, 0L, SEEK_END);
@@ -62,7 +62,14 @@ filecheck (const char *filename)
   error += fclose (fp);
 
   if (!KEEP_FILES)
-    unlink (filename);
+  {
+    if (0 != unlink (filename))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not remove temp files (%s)\n",
+                  filename);
+    }
+  }
+
 
   return error;
 }
@@ -70,13 +77,7 @@ filecheck (const char *filename)
 int
 main (int argc, char *argv[])
 {
-  GNUNET_log_setup ("test-regex",
-#if VERBOSE
-                    "DEBUG",
-#else
-                    "WARNING",
-#endif
-                    NULL);
+  GNUNET_log_setup ("test-regex", "WARNING", NULL);
 
   int error;
   struct GNUNET_REGEX_Automaton *a;
@@ -85,7 +86,7 @@ main (int argc, char *argv[])
 
   error = 0;
 
-  const char *regex[10] = {
+  const char *regex[12] = {
     "ab(c|d)+c*(a(b|c)+d)+(bla)+",
     "(bla)*",
     "b(lab)*la",
@@ -95,10 +96,13 @@ main (int argc, char *argv[])
     "1*0(0|1)*",
     "a*b*",
     "a+X*y+c|p|R|Z*K*y*R+w|Y*6+n+h*k*w+V*F|W*B*e*",
-    "a"
+    "a",
+    "a|b",
+//    "abc(d+|e)fgh"
+    "PADPADPADPADPADPabcdefghixxxxxxxxxxxxxjklmnop*qstoisdjfguisdfguihsdfgbdsuivggsd"
   };
 
-  for (i = 0; i < 10; i++)
+  for (i = 0; i < 12; i++)
   {
     // Check NFA graph creation
     a = GNUNET_REGEX_construct_nfa (regex[i], strlen (regex[i]));
@@ -151,10 +155,9 @@ main (int argc, char *argv[])
 
 
     a = GNUNET_REGEX_construct_dfa (regex[i], strlen (regex[i]));
-    GNUNET_REGEX_automaton_save_graph (a, filename,
-                                       GNUNET_REGEX_GRAPH_DEFAULT |
-                                       GNUNET_REGEX_GRAPH_VERBOSE |
-                                       GNUNET_REGEX_GRAPH_COLORING);
+    GNUNET_REGEX_automaton_save_graph (a, filename, GNUNET_REGEX_GRAPH_DEFAULT);        //|
+    //                               GNUNET_REGEX_GRAPH_VERBOSE |
+    //GNUNET_REGEX_GRAPH_COLORING);
     GNUNET_REGEX_automaton_destroy (a);
     error += filecheck (filename);