-rps: open channel when inserting peer in view
[oweals/gnunet.git] / src / testbed / test_testbed_api_sd.c
index 1a870fba8a63d4c0ea4298bdaac60d699194d3d2..16f720a03a7fe217f66a5f252cda80de49a81dca 100644 (file)
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      (C) 2008--2012 Christian Grothoff (and other contributing authors)
+      Copyright (C) 2008--2013 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 testbed/testbed_api_sd.c
  * @brief test cases for calculating standard deviation
- * @author Sree Harsha Totakura <sreeharsha@totakura.in> 
+ * @author Sree Harsha Totakura <sreeharsha@totakura.in>
  */
 
 #include "platform.h"
-#include "gnunet_common.h"
 #include "gnunet_util_lib.h"
 #include "testbed_api_sd.h"
 
@@ -48,24 +47,26 @@ run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *config)
 {
   struct SDHandle *h = GNUNET_TESTBED_SD_init_ (20);
+  int sd;
 
   ret = 0;
   GNUNET_TESTBED_SD_add_data_ (h, 40);
-  if (GNUNET_SYSERR != GNUNET_TESTBED_SD_deviation_factor_ (h, 10))
+  if (GNUNET_SYSERR != GNUNET_TESTBED_SD_deviation_factor_ (h, 10, &sd))
   {
     GNUNET_break (0);
     ret = 1;
     goto err;
   }
-  GNUNET_TESTBED_SD_add_data_ (h, 30); 
-  if (GNUNET_SYSERR == GNUNET_TESTBED_SD_deviation_factor_ (h, 80))
+  GNUNET_TESTBED_SD_add_data_ (h, 30);
+  if (GNUNET_SYSERR == GNUNET_TESTBED_SD_deviation_factor_ (h, 80, &sd))
   {
     GNUNET_break (0);
     ret = 1;
     goto err;
   }
   GNUNET_TESTBED_SD_add_data_ (h, 40);
-  if (0 != GNUNET_TESTBED_SD_deviation_factor_ (h, 10))
+  if ((GNUNET_SYSERR == GNUNET_TESTBED_SD_deviation_factor_ (h, 30, &sd))
+      || (-2 != sd))
   {
     GNUNET_break (0);
     ret = 1;
@@ -73,7 +74,8 @@ run (void *cls, char *const *args, const char *cfgfile,
   }
   GNUNET_TESTBED_SD_add_data_ (h, 10);
   GNUNET_TESTBED_SD_add_data_ (h, 30);
-  if (3 != GNUNET_TESTBED_SD_deviation_factor_ (h, 60))
+  if ((GNUNET_SYSERR == GNUNET_TESTBED_SD_deviation_factor_ (h, 60, &sd))
+      || (3 != sd))
   {
     GNUNET_break (0);
     ret = 1;