gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37639 - gnunet/src/core


From: gnunet
Subject: [GNUnet-SVN] r37639 - gnunet/src/core
Date: Sun, 31 Jul 2016 01:34:06 +0200

Author: grothoff
Date: 2016-07-31 01:34:06 +0200 (Sun, 31 Jul 2016)
New Revision: 37639

Modified:
   gnunet/src/core/test_core_quota_compliance.c
Log:
minor test cleanup

Modified: gnunet/src/core/test_core_quota_compliance.c
===================================================================
--- gnunet/src/core/test_core_quota_compliance.c        2016-07-30 23:29:26 UTC 
(rev 37638)
+++ gnunet/src/core/test_core_quota_compliance.c        2016-07-30 23:34:06 UTC 
(rev 37639)
@@ -20,6 +20,7 @@
 /**
  * @file core/test_core_quota_compliance.c
  * @brief testcase for core_api.c focusing quota compliance on core level
+ * @author Christian Grothoff
  */
 #include "platform.h"
 #include "gnunet_arm_service.h"
@@ -820,6 +821,30 @@
 }
 
 
+static void
+cleanup_directory (int test)
+{
+  switch (test) {
+  case SYMMETRIC:
+    GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/");
+    GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/");
+    break;
+  case ASYMMETRIC_SEND_LIMITED:
+    GNUNET_DISK_directory_remove
+        ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/");
+    GNUNET_DISK_directory_remove
+        ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/");
+    break;
+  case ASYMMETRIC_RECV_LIMITED:
+    GNUNET_DISK_directory_remove
+        ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/");
+    GNUNET_DISK_directory_remove
+        ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/");
+    break;
+  }
+}
+
+
 int
 main (int argc,
       char *argv[])
@@ -827,63 +852,30 @@
   int ret;
 
   test = -1;
-  if (strstr (argv[0], "_symmetric") != NULL)
+  if (NULL != strstr (argv[0],
+                     "_symmetric"))
   {
     test = SYMMETRIC;
   }
-  else if (strstr (argv[0], "_asymmetric_send") != NULL)
+  else if (NULL != strstr (argv[0],
+                          "_asymmetric_send"))
   {
     test = ASYMMETRIC_SEND_LIMITED;
   }
-  else if (strstr (argv[0], "_asymmetric_recv") != NULL)
+  else if (NULL != strstr (argv[0],
+                          "_asymmetric_recv"))
   {
     test = ASYMMETRIC_RECV_LIMITED;
   }
   GNUNET_assert (test != -1);
-  if (test == SYMMETRIC)
-  {
-    GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/");
-    GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/");
-  }
-  else if (test == ASYMMETRIC_SEND_LIMITED)
-  {
-    GNUNET_DISK_directory_remove
-        ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/");
-    GNUNET_DISK_directory_remove
-        ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/");
-  }
-  else if (test == ASYMMETRIC_RECV_LIMITED)
-  {
-    GNUNET_DISK_directory_remove
-        ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/");
-    GNUNET_DISK_directory_remove
-        ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/");
-  }
-
+  cleanup_directory (test);
   GNUNET_log_setup ("test-core-quota-compliance",
                     "WARNING",
                     NULL);
   ret = check ();
-  if (test == SYMMETRIC)
-  {
-    GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-1/");
-    GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-quota-sym-peer-2/");
-  }
-  else if (test == ASYMMETRIC_SEND_LIMITED)
-  {
-    GNUNET_DISK_directory_remove
-        ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-1/");
-    GNUNET_DISK_directory_remove
-        ("/tmp/test-gnunet-core-quota-asym-send-lim-peer-2/");
-  }
-  else if (test == ASYMMETRIC_RECV_LIMITED)
-  {
-    GNUNET_DISK_directory_remove
-        ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-1/");
-    GNUNET_DISK_directory_remove
-        ("/tmp/test-gnunet-core-quota-asym-recv-lim-peer-2/");
-  }
+  cleanup_directory (test);
   return ret;
 }
 
+
 /* end of test_core_quota_compliance.c */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]