Link libgnunetblockgroup to libgnunetblock
[oweals/gnunet.git] / src / util / test_getopt.c
index f830454cd4f5f1bd96ffb09acf9f8f35d4996451..8e578640dd9b3b226b917f266a0e82ba17416999 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2003, 2004, 2005, 2006, 2009 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2003, 2004, 2005, 2006, 2009 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
 
      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.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 /**
  * @file util/test_getopt.c
  * @brief testcase for util/getopt.c
  */
 #include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_configuration_lib.h"
-#include "gnunet_getopt_lib.h"
+#include "gnunet_util_lib.h"
 
-#define VERBOSE 0
 
 static int
 testMinimal ()
@@ -45,6 +42,7 @@ testMinimal ()
   return 0;
 }
 
+
 static int
 testVerbose ()
 {
@@ -63,18 +61,19 @@ testVerbose ()
   };
 
   if (3 != GNUNET_GETOPT_run ("test", verboseoptionlist, 4, myargv))
-    {
-      GNUNET_break (0);
-      return 1;
-    }
+  {
+    GNUNET_break (0);
+    return 1;
+  }
   if (vflags != 2)
-    {
-      GNUNET_break (0);
-      return 1;
-    }
+  {
+    GNUNET_break (0);
+    return 1;
+  }
   return 0;
 }
 
+
 static int
 testVersion ()
 {
@@ -84,18 +83,19 @@ testVersion ()
     NULL
   };
   const struct GNUNET_GETOPT_CommandLineOption versionoptionlist[] = {
-    GNUNET_GETOPT_OPTION_VERSION (PACKAGE_VERSION),
+    GNUNET_GETOPT_OPTION_VERSION (PACKAGE_VERSION " " VCS_VERSION),
     GNUNET_GETOPT_OPTION_END
   };
 
-  if (-1 != GNUNET_GETOPT_run ("test_getopt", versionoptionlist, 2, myargv))
-    {
-      GNUNET_break (0);
-      return 1;
-    }
+  if (0 != GNUNET_GETOPT_run ("test_getopt", versionoptionlist, 2, myargv))
+  {
+    GNUNET_break (0);
+    return 1;
+  }
   return 0;
 }
 
+
 static int
 testAbout ()
 {
@@ -109,14 +109,15 @@ testAbout ()
     GNUNET_GETOPT_OPTION_END
   };
 
-  if (-1 != GNUNET_GETOPT_run ("test_getopt", aboutoptionlist, 2, myargv))
-    {
-      GNUNET_break (0);
-      return 1;
-    }
+  if (0 != GNUNET_GETOPT_run ("test_getopt", aboutoptionlist, 2, myargv))
+  {
+    GNUNET_break (0);
+    return 1;
+  }
   return 0;
 }
 
+
 static int
 testLogOpts ()
 {
@@ -136,23 +137,24 @@ testLogOpts ()
   };
 
   if (5 != GNUNET_GETOPT_run ("test_getopt", logoptionlist, 5, myargv))
-    {
-      GNUNET_break (0);
-      return 1;
-    }
+  {
+    GNUNET_break (0);
+    return 1;
+  }
   GNUNET_assert (fn != NULL);
   if ((0 != strcmp (level, "WARNING")) || (0 != strcmp (fn, "filename")))
-    {
-      GNUNET_break (0);
-      GNUNET_free (level);
-      GNUNET_free (fn);
-      return 1;
-    }
+  {
+    GNUNET_break (0);
+    GNUNET_free (level);
+    GNUNET_free (fn);
+    return 1;
+  }
   GNUNET_free (level);
   GNUNET_free (fn);
   return 0;
 }
 
+
 static int
 testFlagNum ()
 {
@@ -178,18 +180,19 @@ testFlagNum ()
   };
 
   if (6 != GNUNET_GETOPT_run ("test_getopt", logoptionlist, 6, myargv))
-    {
-      GNUNET_break (0);
-      return 1;
-    }
+  {
+    GNUNET_break (0);
+    return 1;
+  }
   if ((1 != flag) || (42 != num) || (42 != lnum))
-    {
-      GNUNET_break (0);
-      return 1;
-    }
+  {
+    GNUNET_break (0);
+    return 1;
+  }
   return 0;
 }
 
+
 int
 main (int argc, char *argv[])
 {