uncrustify as demanded.
[oweals/gnunet.git] / src / testing / test_testing_peerstartup.c
index 241bc63a73e2aac754ed1e0da328b744b012cb1a..a03e6b5969fa10c41591f99bdece48d6220933ea 100644 (file)
@@ -11,7 +11,7 @@
       WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       Affero General Public License for more details.
-     
+
       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/>.
 
@@ -29,8 +29,8 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_testing_lib.h"
 
-#define LOG(kind,...)                           \
-  GNUNET_log (kind, __VA_ARGS__)
+#define LOG(kind, ...)                           \
+  GNUNET_log(kind, __VA_ARGS__)
 
 /**
  * The status of the test
@@ -40,8 +40,7 @@ int status;
 /**
  * The testing context
  */
-struct TestingContext
-{
+struct TestingContext {
   /**
    * The testing system
    */
@@ -65,21 +64,21 @@ struct TestingContext
  * @param cls the testing context
  */
 static void
-do_shutdown (void *cls)
+do_shutdown(void *cls)
 {
   struct TestingContext *test_ctx = cls;
 
-  GNUNET_assert (NULL != test_ctx);
+  GNUNET_assert(NULL != test_ctx);
   if (NULL != test_ctx->peer)
-  {
-    (void) GNUNET_TESTING_peer_stop (test_ctx->peer);
-    GNUNET_TESTING_peer_destroy (test_ctx->peer);
-  }
+    {
+      (void)GNUNET_TESTING_peer_stop(test_ctx->peer);
+      GNUNET_TESTING_peer_destroy(test_ctx->peer);
+    }
   if (NULL != test_ctx->cfg)
-    GNUNET_CONFIGURATION_destroy (test_ctx->cfg);
+    GNUNET_CONFIGURATION_destroy(test_ctx->cfg);
   if (NULL != test_ctx->system)
-    GNUNET_TESTING_system_destroy (test_ctx->system, GNUNET_YES);
-  GNUNET_free (test_ctx);
+    GNUNET_TESTING_system_destroy(test_ctx->system, GNUNET_YES);
+  GNUNET_free(test_ctx);
 }
 
 
@@ -87,42 +86,42 @@ do_shutdown (void *cls)
  * Main point of test execution
  */
 static void
-run (void *cls, char *const *args, const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
+run(void *cls, char *const *args, const char *cfgfile,
+    const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   struct TestingContext *test_ctx;
   char *emsg;
   struct GNUNET_PeerIdentity id;
 
-  test_ctx = GNUNET_new (struct TestingContext);
+  test_ctx = GNUNET_new(struct TestingContext);
   test_ctx->system =
-      GNUNET_TESTING_system_create ("test-gnunet-testing",
-                                    "127.0.0.1", NULL, NULL);
+    GNUNET_TESTING_system_create("test-gnunet-testing",
+                                 "127.0.0.1", NULL, NULL);
   emsg = NULL;
   if (NULL == test_ctx->system)
     goto end;
-  test_ctx->cfg = GNUNET_CONFIGURATION_dup (cfg);
+  test_ctx->cfg = GNUNET_CONFIGURATION_dup(cfg);
   test_ctx->peer =
-      GNUNET_TESTING_peer_configure (test_ctx->system,
-                                     test_ctx->cfg,
-                                     0, &id, &emsg);
+    GNUNET_TESTING_peer_configure(test_ctx->system,
+                                  test_ctx->cfg,
+                                  0, &id, &emsg);
   if (NULL == test_ctx->peer)
-  {
-    if (NULL != emsg)
-      printf ("Test failed upon error: %s", emsg);
-    goto end;
-  }
-  if (GNUNET_OK != GNUNET_TESTING_peer_start (test_ctx->peer))
+    {
+      if (NULL != emsg)
+        printf("Test failed upon error: %s", emsg);
+      goto end;
+    }
+  if (GNUNET_OK != GNUNET_TESTING_peer_start(test_ctx->peer))
     goto end;
   status = GNUNET_OK;
 
- end:
-  GNUNET_SCHEDULER_add_now (&do_shutdown, test_ctx);
-  GNUNET_free_non_null (emsg);
+end:
+  GNUNET_SCHEDULER_add_now(&do_shutdown, test_ctx);
+  GNUNET_free_non_null(emsg);
 }
 
 
-int main (int argc, char *argv[])
+int main(int argc, char *argv[])
 {
   struct GNUNET_GETOPT_CommandLineOption options[] = {
     GNUNET_GETOPT_OPTION_END
@@ -130,10 +129,10 @@ int main (int argc, char *argv[])
 
   status = GNUNET_SYSERR;
   if (GNUNET_OK !=
-      GNUNET_PROGRAM_run (argc, argv,
-                          "test_testing_peerstartup",
-                          "test case for peerstartup using new testing library",
-                          options, &run, NULL))
+      GNUNET_PROGRAM_run(argc, argv,
+                         "test_testing_peerstartup",
+                         "test case for peerstartup using new testing library",
+                         options, &run, NULL))
     return 1;
   return (GNUNET_OK == status) ? 0 : 1;
 }