-more datacache integration work
[oweals/gnunet.git] / src / testbed / test_testbed_api_sd.c
index 1a870fba8a63d4c0ea4298bdaac60d699194d3d2..ad96049c99170482a9313c99a983f1db1cb9c41c 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 Christian Grothoff (and other contributing authors)
 
       GNUnet is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
 /**
  * @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;