- unique constraint
[oweals/gnunet.git] / src / testbed / test_testbed_api_sd.c
index 343d1650ab0f0ea50931970801d80cbf0bc717e6..0ca5c35a5dbc63e4caee0e2cecabcff8610b476a 100644 (file)
 /**
  * @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;