Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use variadic variants of xbt_test_{add,fail,assert,log}.
authoragiersch <agiersch@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 22 Feb 2011 13:51:29 +0000 (13:51 +0000)
committeragiersch <agiersch@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 22 Feb 2011 13:51:29 +0000 (13:51 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9691 48e7efb5-ca39-0410-a469-dd3cf9ba447f

13 files changed:
include/xbt/cunit.h
src/xbt/config.c
src/xbt/cunit.c
src/xbt/dict.c
src/xbt/dynar.c
src/xbt/ex.c
src/xbt/parmap.c
src/xbt/set.c
src/xbt/swag.c
src/xbt/xbt_sha.c
src/xbt/xbt_str.c
src/xbt/xbt_strbuff.c
src/xbt/xbt_synchro.c

index 6cedde1..9ed28ae 100644 (file)
@@ -89,7 +89,7 @@ XBT_PUBLIC(void) xbt_test_skip(void);
     void func(void);  /*prototype*/       \
     void func(void)
 
-#if 1 || defined(XBT_USE_DEPRECATED)
+#ifdef XBT_USE_DEPRECATED
 
 /* Kept for backward compatibility. */
 
index 8ecc594..47d9cd2 100644 (file)
@@ -1368,7 +1368,7 @@ static xbt_cfg_t make_set()
 XBT_TEST_UNIT("memuse", test_config_memuse, "Alloc and free a config set")
 {
   xbt_cfg_t set = make_set();
-  xbt_test_add0("Alloc and free a config set");
+  xbt_test_add("Alloc and free a config set");
   xbt_cfg_set_parse(set,
                     "peername:veloce user:mquinson\nuser:oaumage\tuser:alegrand");
   xbt_cfg_free(&set);
@@ -1380,7 +1380,7 @@ XBT_TEST_UNIT("validation", test_config_validation, "Validation tests")
   xbt_cfg_t set = set = make_set();
   xbt_ex_t e;
 
-  xbt_test_add0("Having too few elements for speed");
+  xbt_test_add("Having too few elements for speed");
   xbt_cfg_set_parse(set,
                     "peername:veloce user:mquinson\nuser:oaumage\tuser:alegrand");
   TRY {
@@ -1390,7 +1390,7 @@ XBT_TEST_UNIT("validation", test_config_validation, "Validation tests")
     if (e.category != mismatch_error ||
         strncmp(e.msg, "Config elem speed needs",
                 strlen("Config elem speed needs")))
-      xbt_test_fail1("Got an exception. msg=%s", e.msg);
+      xbt_test_fail("Got an exception. msg=%s", e.msg);
     xbt_ex_free(e);
   }
   xbt_cfg_free(&set);
@@ -1398,7 +1398,7 @@ XBT_TEST_UNIT("validation", test_config_validation, "Validation tests")
 
 
 
-  xbt_test_add0("Having too much values of 'speed'");
+  xbt_test_add("Having too much values of 'speed'");
   set = make_set();
   xbt_cfg_set_parse(set, "peername:toto:42 user:alegrand");
   TRY {
@@ -1408,7 +1408,7 @@ XBT_TEST_UNIT("validation", test_config_validation, "Validation tests")
     if (e.category != mismatch_error ||
         strncmp(e.msg, "Cannot add value 34 to the config elem speed",
                 strlen("Config elem speed needs")))
-      xbt_test_fail1("Got an exception. msg=%s", e.msg);
+      xbt_test_fail("Got an exception. msg=%s", e.msg);
     xbt_ex_free(e);
   }
   xbt_cfg_check(set);
@@ -1420,7 +1420,7 @@ XBT_TEST_UNIT("validation", test_config_validation, "Validation tests")
 XBT_TEST_UNIT("use", test_config_use, "Data retrieving tests")
 {
 
-  xbt_test_add0("Get a single value");
+  xbt_test_add("Get a single value");
   {
     /* get_single_value */
     int ival;
@@ -1429,11 +1429,11 @@ XBT_TEST_UNIT("use", test_config_use, "Data retrieving tests")
     xbt_cfg_set_parse(myset, "peername:toto:42 speed:42");
     ival = xbt_cfg_get_int(myset, "speed");
     if (ival != 42)
-      xbt_test_fail1("Speed value = %d, I expected 42", ival);
+      xbt_test_fail("Speed value = %d, I expected 42", ival);
     xbt_cfg_free(&myset);
   }
 
-  xbt_test_add0("Get multiple values");
+  xbt_test_add("Get multiple values");
   {
     /* get_multiple_value */
     xbt_dynar_t dyn;
@@ -1446,24 +1446,24 @@ XBT_TEST_UNIT("use", test_config_use, "Data retrieving tests")
     dyn = xbt_cfg_get_dynar(myset, "user");
 
     if (xbt_dynar_length(dyn) != 3)
-      xbt_test_fail1("Dynar length = %lu, I expected 3",
+      xbt_test_fail("Dynar length = %lu, I expected 3",
                      xbt_dynar_length(dyn));
 
     if (strcmp(xbt_dynar_get_as(dyn, 0, char *), "foo"))
-       xbt_test_fail1("Dynar[0] = %s, I expected foo",
+       xbt_test_fail("Dynar[0] = %s, I expected foo",
                       xbt_dynar_get_as(dyn, 0, char *));
 
     if (strcmp(xbt_dynar_get_as(dyn, 1, char *), "bar"))
-       xbt_test_fail1("Dynar[1] = %s, I expected bar",
+       xbt_test_fail("Dynar[1] = %s, I expected bar",
                       xbt_dynar_get_as(dyn, 1, char *));
 
     if (strcmp(xbt_dynar_get_as(dyn, 2, char *), "toto"))
-       xbt_test_fail1("Dynar[2] = %s, I expected toto",
+       xbt_test_fail("Dynar[2] = %s, I expected toto",
                       xbt_dynar_get_as(dyn, 2, char *));
     xbt_cfg_free(&myset);
   }
 
-  xbt_test_add0("Access to a non-existant entry");
+  xbt_test_add("Access to a non-existant entry");
   {
     /* non-existant_entry */
     xbt_cfg_t myset = make_set();
index 8efe254..ce05514 100644 (file)
@@ -827,13 +827,13 @@ XBT_TEST_SUITE("cunit", "Testsuite mechanism autotest");
 
 XBT_TEST_UNIT("expect", test_expected_failure, "expected failures")
 {
-  xbt_test_add0("Skipped test");
+  xbt_test_add("Skipped test");
   xbt_test_skip();
 
-  xbt_test_add2("%s %s", "EXPECTED", "FAILURE");
+  xbt_test_add("%s %s", "EXPECTED", "FAILURE");
   xbt_test_expect_failure();
-  xbt_test_log2("%s %s", "Test", "log");
-  xbt_test_fail0("EXPECTED FAILURE");
+  xbt_test_log("%s %s", "Test", "log");
+  xbt_test_fail("EXPECTED FAILURE");
 }
 
 #endif                          /* SIMGRID_TEST */
index 032bf5d..7518075 100644 (file)
@@ -848,7 +848,7 @@ static void debuged_add_ext(xbt_dict_t head, const char *key,
 {
   char *data = xbt_strdup(data_to_fill);
 
-  xbt_test_log2("Add %s under %s", PRINTF_STR(data_to_fill),
+  xbt_test_log("Add %s under %s", PRINTF_STR(data_to_fill),
                 PRINTF_STR(key));
 
   xbt_dict_set(head, key, data, &free);
@@ -865,7 +865,7 @@ static void debuged_add(xbt_dict_t head, const char *key)
 
 static void fill(xbt_dict_t * head)
 {
-  xbt_test_add0("Fill in the dictionnary");
+  xbt_test_add("Fill in the dictionnary");
 
   *head = xbt_dict_new();
   debuged_add(*head, "12");
@@ -884,15 +884,15 @@ static void search_ext(xbt_dict_t head, const char *key, const char *data)
 {
   void *found;
 
-  xbt_test_add1("Search %s", key);
+  xbt_test_add("Search %s", key);
   found = xbt_dict_get(head, key);
-  xbt_test_log1("Found %s", (char *) found);
+  xbt_test_log("Found %s", (char *) found);
   if (data)
-    xbt_test_assert1(found,
+    xbt_test_assert(found,
                      "data do not match expectations: found NULL while searching for %s",
                      data);
   if (found)
-    xbt_test_assert2(!strcmp((char *) data, found),
+    xbt_test_assert(!strcmp((char *) data, found),
                      "data do not match expectations: found %s while searching for %s",
                      (char *) found, data);
 }
@@ -905,7 +905,7 @@ static void search(xbt_dict_t head, const char *key)
 static void debuged_remove(xbt_dict_t head, const char *key)
 {
 
-  xbt_test_add1("Remove '%s'", PRINTF_STR(key));
+  xbt_test_add("Remove '%s'", PRINTF_STR(key));
   xbt_dict_remove(head, key);
   /*  xbt_dict_dump(head,(void (*)(void*))&printf); */
 }
@@ -920,12 +920,12 @@ static void traverse(xbt_dict_t head)
 
   xbt_dict_foreach(head, cursor, key, data) {
     if (!key || !data || strcmp(key, data)) {
-      xbt_test_log3("Seen #%d:  %s->%s", ++i, PRINTF_STR(key),
+      xbt_test_log("Seen #%d:  %s->%s", ++i, PRINTF_STR(key),
                     PRINTF_STR(data));
     } else {
-      xbt_test_log2("Seen #%d:  %s", ++i, PRINTF_STR(key));
+      xbt_test_log("Seen #%d:  %s", ++i, PRINTF_STR(key));
     }
-    xbt_test_assert2(!data || !strcmp(key, data),
+    xbt_test_assert(!data || !strcmp(key, data),
                      "Key(%s) != value(%s). Aborting", key, data);
   }
 }
@@ -935,7 +935,7 @@ static void search_not_found(xbt_dict_t head, const char *data)
   int ok = 0;
   xbt_ex_t e;
 
-  xbt_test_add1("Search %s (expected not to be found)", data);
+  xbt_test_add("Search %s (expected not to be found)", data);
 
   TRY {
     data = xbt_dict_get(head, data);
@@ -947,7 +947,7 @@ static void search_not_found(xbt_dict_t head, const char *data)
     xbt_ex_free(e);
     ok = 1;
   }
-  xbt_test_assert0(ok, "Exception not raised");
+  xbt_test_assert(ok, "Exception not raised");
 }
 
 static void count(xbt_dict_t dict, int length)
@@ -958,15 +958,15 @@ static void count(xbt_dict_t dict, int length)
   int effective = 0;
 
 
-  xbt_test_add1("Count elements (expecting %d)", length);
-  xbt_test_assert2(xbt_dict_length(dict) == length,
+  xbt_test_add("Count elements (expecting %d)", length);
+  xbt_test_assert(xbt_dict_length(dict) == length,
                    "Announced length(%d) != %d.", xbt_dict_length(dict),
                    length);
 
   xbt_dict_foreach(dict, cursor, key, data)
       effective++;
 
-  xbt_test_assert2(effective == length, "Effective length(%d) != %d.",
+  xbt_test_assert(effective == length, "Effective length(%d) != %d.",
                    effective, length);
 
 }
@@ -979,10 +979,10 @@ static void count_check_get_key(xbt_dict_t dict, int length)
   int effective = 0;
 
 
-  xbt_test_add1
+  xbt_test_add
       ("Count elements (expecting %d), and test the getkey function",
        length);
-  xbt_test_assert2(xbt_dict_length(dict) == length,
+  xbt_test_assert(xbt_dict_length(dict) == length,
                    "Announced length(%d) != %d.", xbt_dict_length(dict),
                    length);
 
@@ -994,7 +994,7 @@ static void count_check_get_key(xbt_dict_t dict, int length)
                 key2, key);
   }
 
-  xbt_test_assert2(effective == length, "Effective length(%d) != %d.",
+  xbt_test_assert(effective == length, "Effective length(%d) != %d.",
                    effective, length);
 
 }
@@ -1006,10 +1006,10 @@ char *data;
 
 XBT_TEST_UNIT("basic", test_dict_basic, "Basic usage: change, retrieve, traverse")
 {
-  xbt_test_add0("Traversal the null dictionary");
+  xbt_test_add("Traversal the null dictionary");
   traverse(head);
 
-  xbt_test_add0("Traversal and search the empty dictionary");
+  xbt_test_add("Traversal and search the empty dictionary");
   head = xbt_dict_new();
   traverse(head);
   TRY {
@@ -1021,7 +1021,7 @@ XBT_TEST_UNIT("basic", test_dict_basic, "Basic usage: change, retrieve, traverse
   }
   xbt_dict_free(&head);
 
-  xbt_test_add0("Traverse the full dictionary");
+  xbt_test_add("Traverse the full dictionary");
   fill(&head);
   count_check_get_key(head, 7);
 
@@ -1032,34 +1032,34 @@ XBT_TEST_UNIT("basic", test_dict_basic, "Basic usage: change, retrieve, traverse
   search(head, "12a");
   traverse(head);
 
-  xbt_test_add0("Free the dictionary (twice)");
+  xbt_test_add("Free the dictionary (twice)");
   xbt_dict_free(&head);
   xbt_dict_free(&head);
 
   /* CHANGING */
   fill(&head);
   count_check_get_key(head, 7);
-  xbt_test_add0("Change 123 to 'Changed 123'");
+  xbt_test_add("Change 123 to 'Changed 123'");
   xbt_dict_set(head, "123", strdup("Changed 123"), &free);
   count_check_get_key(head, 7);
 
-  xbt_test_add0("Change 123 back to '123'");
+  xbt_test_add("Change 123 back to '123'");
   xbt_dict_set(head, "123", strdup("123"), &free);
   count_check_get_key(head, 7);
 
-  xbt_test_add0("Change 12a to 'Dummy 12a'");
+  xbt_test_add("Change 12a to 'Dummy 12a'");
   xbt_dict_set(head, "12a", strdup("Dummy 12a"), &free);
   count_check_get_key(head, 7);
 
-  xbt_test_add0("Change 12a to '12a'");
+  xbt_test_add("Change 12a to '12a'");
   xbt_dict_set(head, "12a", strdup("12a"), &free);
   count_check_get_key(head, 7);
 
-  xbt_test_add0("Traverse the resulting dictionary");
+  xbt_test_add("Traverse the resulting dictionary");
   traverse(head);
 
   /* RETRIEVE */
-  xbt_test_add0("Search 123");
+  xbt_test_add("Search 123");
   data = xbt_dict_get(head, "123");
   xbt_test_assert(data);
   xbt_test_assert(!strcmp("123", data));
@@ -1075,16 +1075,16 @@ XBT_TEST_UNIT("basic", test_dict_basic, "Basic usage: change, retrieve, traverse
   search(head, "1234");
   search(head, "123457");
 
-  xbt_test_add0("Traverse the resulting dictionary");
+  xbt_test_add("Traverse the resulting dictionary");
   traverse(head);
 
   /*  xbt_dict_dump(head,(void (*)(void*))&printf); */
 
-  xbt_test_add0("Free the dictionary twice");
+  xbt_test_add("Free the dictionary twice");
   xbt_dict_free(&head);
   xbt_dict_free(&head);
 
-  xbt_test_add0("Traverse the resulting dictionary");
+  xbt_test_add("Traverse the resulting dictionary");
   traverse(head);
 }
 
@@ -1092,7 +1092,7 @@ XBT_TEST_UNIT("remove", test_dict_remove, "Removing some values")
 {
   fill(&head);
   count(head, 7);
-  xbt_test_add0("Remove non existing data");
+  xbt_test_add("Remove non existing data");
   TRY {
     debuged_remove(head, "Does not exist");
   }
@@ -1105,7 +1105,7 @@ XBT_TEST_UNIT("remove", test_dict_remove, "Removing some values")
 
   xbt_dict_free(&head);
 
-  xbt_test_add0
+  xbt_test_add
       ("Remove each data manually (traversing the resulting dictionary each time)");
   fill(&head);
   debuged_remove(head, "12a");
@@ -1145,7 +1145,7 @@ XBT_TEST_UNIT("remove", test_dict_remove, "Removing some values")
   }
   traverse(head);
 
-  xbt_test_add0
+  xbt_test_add
       ("Free dict, create new fresh one, and then reset the dict");
   xbt_dict_free(&head);
   fill(&head);
@@ -1153,7 +1153,7 @@ XBT_TEST_UNIT("remove", test_dict_remove, "Removing some values")
   count(head, 0);
   traverse(head);
 
-  xbt_test_add0("Free the dictionary twice");
+  xbt_test_add("Free the dictionary twice");
   xbt_dict_free(&head);
   xbt_dict_free(&head);
 }
@@ -1162,11 +1162,11 @@ XBT_TEST_UNIT("nulldata", test_dict_nulldata, "NULL data management")
 {
   fill(&head);
 
-  xbt_test_add0("Store NULL under 'null'");
+  xbt_test_add("Store NULL under 'null'");
   xbt_dict_set(head, "null", NULL, NULL);
   search_ext(head, "null", NULL);
 
-  xbt_test_add0("Check whether I see it while traversing...");
+  xbt_test_add("Check whether I see it while traversing...");
   {
     xbt_dict_cursor_t cursor = NULL;
     char *key;
@@ -1174,15 +1174,15 @@ XBT_TEST_UNIT("nulldata", test_dict_nulldata, "NULL data management")
 
     xbt_dict_foreach(head, cursor, key, data) {
       if (!key || !data || strcmp(key, data)) {
-        xbt_test_log2("Seen:  %s->%s", PRINTF_STR(key), PRINTF_STR(data));
+        xbt_test_log("Seen:  %s->%s", PRINTF_STR(key), PRINTF_STR(data));
       } else {
-        xbt_test_log1("Seen:  %s", PRINTF_STR(key));
+        xbt_test_log("Seen:  %s", PRINTF_STR(key));
       }
 
       if (!strcmp(key, "null"))
         found = 1;
     }
-    xbt_test_assert0(found,
+    xbt_test_assert(found,
                      "the key 'null', associated to NULL is not found");
   }
   xbt_dict_free(&head);
@@ -1191,7 +1191,7 @@ XBT_TEST_UNIT("nulldata", test_dict_nulldata, "NULL data management")
 static void debuged_addi(xbt_dict_t head, uintptr_t key, uintptr_t data)
 {
   uintptr_t stored_data = 0;
-  xbt_test_log2("Add %zu under %zu", data, key);
+  xbt_test_log("Add %zu under %zu", data, key);
 
   xbt_dicti_set(head, key, data);
   if (XBT_LOG_ISENABLED(xbt_dict, xbt_log_priority_debug)) {
@@ -1199,14 +1199,14 @@ static void debuged_addi(xbt_dict_t head, uintptr_t key, uintptr_t data)
     fflush(stdout);
   }
   stored_data = xbt_dicti_get(head, key);
-  xbt_test_assert3(stored_data == data,
+  xbt_test_assert(stored_data == data,
                    "Retrieved data (%zu) is not what I just stored (%zu) under key %zu",
                    stored_data, data, key);
 }
 
 XBT_TEST_UNIT("dicti", test_dict_scalar, "Scalar data and key management")
 {
-  xbt_test_add0("Fill in the dictionnary");
+  xbt_test_add("Fill in the dictionnary");
 
   head = xbt_dict_new();
   debuged_addi(head, 12, 12);
@@ -1255,10 +1255,10 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test")
   srand((unsigned int) time(NULL));
 
   for (i = 0; i < 10; i++) {
-    xbt_test_add2("CRASH test number %d (%d to go)", i + 1, 10 - i - 1);
-    xbt_test_log0
+    xbt_test_add("CRASH test number %d (%d to go)", i + 1, 10 - i - 1);
+    xbt_test_log
         ("Fill the struct, count its elems and frees the structure");
-    xbt_test_log1
+    xbt_test_log
         ("using 1000 elements with %d chars long randomized keys.",
          SIZEOFKEY);
     head = xbt_dict_new();
@@ -1278,7 +1278,7 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test")
 
       xbt_dict_set(head, key, key, &free);
       data = xbt_dict_get(head, key);
-      xbt_test_assert2(!strcmp(key, data),
+      xbt_test_assert(!strcmp(key, data),
                        "Retrieved value (%s) != Injected value (%s)", key,
                        data);
 
@@ -1292,7 +1292,7 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test")
 
 
   head = xbt_dict_new();
-  xbt_test_add1("Fill %d elements, with keys being the number of element",
+  xbt_test_add("Fill %d elements, with keys being the number of element",
                 NB_ELM);
   for (j = 0; j < NB_ELM; j++) {
     /* if (!(j%1000)) { printf("."); fflush(stdout); } */
@@ -1304,12 +1304,12 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test")
   }
   /*xbt_dict_dump(head,(void (*)(void*))&printf); */
 
-  xbt_test_add0
+  xbt_test_add
       ("Count the elements (retrieving the key and data for each)");
   i = countelems(head);
-  xbt_test_log1("There is %d elements", i);
+  xbt_test_log("There is %d elements", i);
 
-  xbt_test_add1("Search my %d elements 20 times", NB_ELM);
+  xbt_test_add("Search my %d elements 20 times", NB_ELM);
   key = xbt_malloc(10);
   for (i = 0; i < 20; i++) {
     /* if (i%10) printf("."); else printf("%d",i/10); fflush(stdout); */
@@ -1317,17 +1317,17 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test")
 
       sprintf(key, "%d", j);
       data = xbt_dict_get(head, key);
-      xbt_test_assert2(!strcmp(key, (char *) data),
+      xbt_test_assert(!strcmp(key, (char *) data),
                        "with get, key=%s != data=%s", key, (char *) data);
       data = xbt_dict_get_ext(head, key, strlen(key));
-      xbt_test_assert2(!strcmp(key, (char *) data),
+      xbt_test_assert(!strcmp(key, (char *) data),
                        "with get_ext, key=%s != data=%s", key,
                        (char *) data);
     }
   }
   free(key);
 
-  xbt_test_add1("Remove my %d elements", NB_ELM);
+  xbt_test_add("Remove my %d elements", NB_ELM);
   key = xbt_malloc(10);
   for (j = 0; j < NB_ELM; j++) {
     /* if (!(j%10000)) printf("."); fflush(stdout); */
@@ -1338,7 +1338,7 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test")
   free(key);
 
 
-  xbt_test_add0("Free the structure (twice)");
+  xbt_test_add("Free the structure (twice)");
   xbt_dict_free(&head);
   xbt_dict_free(&head);
 }
@@ -1366,8 +1366,8 @@ XBT_TEST_UNIT("multicrash", test_dict_multicrash, "Multi-dict crash test")
   char *key;
 
 
-  xbt_test_add0("Generic multicache CRASH test");
-  xbt_test_log4
+  xbt_test_add("Generic multicache CRASH test");
+  xbt_test_log
       (" Fill the struct and frees it %d times, using %d elements, "
        "depth of multicache=%d, key size=%d", NB_TEST, NB_ELM, DEPTH,
        KEY_SIZE);
@@ -1406,7 +1406,7 @@ XBT_TEST_UNIT("multicrash", test_dict_multicrash, "Multi-dict crash test")
 
       data = xbt_multidict_get(mdict, keys);
 
-      xbt_test_assert2(data && !strcmp((char *) data, key),
+      xbt_test_assert(data && !strcmp((char *) data, key),
                        "Retrieved value (%s) does not match the given one (%s)\n",
                        (char *) data, key);
     }
index 22eb8d2..9d5de7d 100644 (file)
@@ -815,7 +815,7 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
   unsigned int cursor;
   int *iptr;
 
-  xbt_test_add0("==== Traverse the empty dynar");
+  xbt_test_add("==== Traverse the empty dynar");
   d = xbt_dynar_new(sizeof(int), NULL);
   xbt_dynar_foreach(d, cursor, i) {
     xbt_die( "Damnit, there is something in the empty dynar");
@@ -824,7 +824,7 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
   /* in your code is naturally the way to go outside a regression test */
 
-  xbt_test_add1
+  xbt_test_add
       ("==== Push %d int, set them again 3 times, traverse them, shift them",
        NB_ELEM);
   /* Populate_ints [doxygen cruft] */
@@ -833,20 +833,20 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
   for (cpt = 0; cpt < NB_ELEM; cpt++) {
     xbt_dynar_push_as(d, int, cpt);     /* This is faster (and possible only with scalars) */
     /* xbt_dynar_push(d,&cpt);       This would also work */
-    xbt_test_log2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
+    xbt_test_log("Push %d, length=%lu", cpt, xbt_dynar_length(d));
   }
 
   /* 2. Traverse manually the dynar */
   for (cursor = 0; cursor < NB_ELEM; cursor++) {
     iptr = xbt_dynar_get_ptr(d, cursor);
-    xbt_test_assert2(cursor == *iptr,
+    xbt_test_assert(cursor == *iptr,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
                      cursor, cpt);
   }
 
   /* 3. Traverse the dynar using the neat macro to that extend */
   xbt_dynar_foreach(d, cursor, cpt) {
-    xbt_test_assert2(cursor == cpt,
+    xbt_test_assert(cursor == cpt,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
                      cursor, cpt);
   }
@@ -864,12 +864,12 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
 
   cpt = 0;
   xbt_dynar_foreach(d, cursor, i) {
-    xbt_test_assert2(i == cpt,
+    xbt_test_assert(i == cpt,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
                      i, cpt);
     cpt++;
   }
-  xbt_test_assert2(cpt == NB_ELEM,
+  xbt_test_assert(cpt == NB_ELEM,
                    "Cannot retrieve my %d values. Last got one is %d",
                    NB_ELEM, cpt);
 
@@ -877,10 +877,10 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
   /* 4. Shift all the values */
   for (cpt = 0; cpt < NB_ELEM; cpt++) {
     xbt_dynar_shift(d, &i);
-    xbt_test_assert2(i == cpt,
+    xbt_test_assert(i == cpt,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
                      i, cpt);
-    xbt_test_log2("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
+    xbt_test_log("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
   }
 
   /* 5. Free the resources */
@@ -888,7 +888,7 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
   /* in your code is naturally the way to go outside a regression test */
 
-  xbt_test_add1("==== Unshift/pop %d int", NB_ELEM);
+  xbt_test_add("==== Unshift/pop %d int", NB_ELEM);
   d = xbt_dynar_new(sizeof(int), NULL);
   for (cpt = 0; cpt < NB_ELEM; cpt++) {
     xbt_dynar_unshift(d, &cpt);
@@ -896,17 +896,17 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
   }
   for (cpt = 0; cpt < NB_ELEM; cpt++) {
     i = xbt_dynar_pop_as(d, int);
-    xbt_test_assert2(i == cpt,
+    xbt_test_assert(i == cpt,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
                      i, cpt);
-    xbt_test_log2("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
+    xbt_test_log("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
   }
   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
   /* in your code is naturally the way to go outside a regression test */
 
 
-  xbt_test_add1
+  xbt_test_add
       ("==== Push %d int, insert 1000 int in the middle, shift everything",
        NB_ELEM);
   d = xbt_dynar_new(sizeof(int), NULL);
@@ -921,20 +921,20 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
 
   for (cpt = 0; cpt < NB_ELEM/2; cpt++) {
     xbt_dynar_shift(d, &i);
-    xbt_test_assert2(i == cpt,
+    xbt_test_assert(i == cpt,
                      "The retrieved value is not the same than the injected one at the begining (%d!=%d)",
                      i, cpt);
     XBT_DEBUG("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
   }
   for (cpt = 999; cpt >= 0; cpt--) {
     xbt_dynar_shift(d, &i);
-    xbt_test_assert2(i == cpt,
+    xbt_test_assert(i == cpt,
                      "The retrieved value is not the same than the injected one in the middle (%d!=%d)",
                      i, cpt);
   }
   for (cpt = 2500; cpt < NB_ELEM; cpt++) {
     xbt_dynar_shift(d, &i);
-    xbt_test_assert2(i == cpt,
+    xbt_test_assert(i == cpt,
                      "The retrieved value is not the same than the injected one at the end (%d!=%d)",
                      i, cpt);
   }
@@ -942,7 +942,7 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
   /* in your code is naturally the way to go outside a regression test */
 
-  xbt_test_add1("==== Push %d int, remove 2000-4000. free the rest",
+  xbt_test_add("==== Push %d int, remove 2000-4000. free the rest",
                 NB_ELEM);
   d = xbt_dynar_new(sizeof(int), NULL);
   for (cpt = 0; cpt < NB_ELEM; cpt++)
@@ -950,7 +950,7 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
 
   for (cpt = 2000; cpt < 4000; cpt++) {
     xbt_dynar_remove_at(d, 2000, &i);
-    xbt_test_assert2(i == cpt,
+    xbt_test_assert(i == cpt,
                      "Remove a bad value. Got %d, expected %d", i, cpt);
     XBT_DEBUG("remove %d, length=%lu", cpt, xbt_dynar_length(d));
   }
@@ -968,17 +968,17 @@ XBT_TEST_UNIT("insert",test_dynar_insert,"Using the xbt_dynar_insert and xbt_dyn
   unsigned int cursor;
   int cpt;
 
-  xbt_test_add1("==== Insert %d int, traverse them, remove them",NB_ELEM);
+  xbt_test_add("==== Insert %d int, traverse them, remove them",NB_ELEM);
   /* Populate_ints [doxygen cruft] */
   /* 1. Populate the dynar */
   for (cpt = 0; cpt < NB_ELEM; cpt++) {
     xbt_dynar_insert_at(d, cpt, &cpt);
-    xbt_test_log2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
+    xbt_test_log("Push %d, length=%lu", cpt, xbt_dynar_length(d));
   }
 
   /* 3. Traverse the dynar */
   xbt_dynar_foreach(d, cursor, cpt) {
-    xbt_test_assert2(cursor == cpt,
+    xbt_test_assert(cursor == cpt,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
                      cursor, cpt);
   }
@@ -988,33 +988,33 @@ XBT_TEST_UNIT("insert",test_dynar_insert,"Using the xbt_dynar_insert and xbt_dyn
   for (cpt = 0; cpt < NB_ELEM; cpt++)
     xbt_dynar_set_as(d, cpt, int, cpt);
   xbt_dynar_foreach(d, cursor, cpt)
-    xbt_test_assert2(cursor == cpt,
+    xbt_test_assert(cursor == cpt,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
                      cursor, cpt);
 
   for (cpt = 0; cpt < NB_ELEM; cpt++) {
     int val;
     xbt_dynar_remove_at(d,0,&val);
-    xbt_test_assert2(cpt == val,
+    xbt_test_assert(cpt == val,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
                      cursor, cpt);
   }
-  xbt_test_assert1(xbt_dynar_length(d) == 0,
+  xbt_test_assert(xbt_dynar_length(d) == 0,
                    "There is still %lu elements in the dynar after removing everything",
                    xbt_dynar_length(d));
   xbt_dynar_free(&d);
 
   /* ********************* */
-  xbt_test_add1("==== Insert %d int in reverse order, traverse them, remove them",NB_ELEM);
+  xbt_test_add("==== Insert %d int in reverse order, traverse them, remove them",NB_ELEM);
   d = xbt_dynar_new(sizeof(int), NULL);
   for (cpt = NB_ELEM-1; cpt >=0; cpt--) {
     xbt_dynar_replace(d, cpt, &cpt);
-    xbt_test_log2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
+    xbt_test_log("Push %d, length=%lu", cpt, xbt_dynar_length(d));
   }
 
   /* 3. Traverse the dynar */
   xbt_dynar_foreach(d, cursor, cpt) {
-    xbt_test_assert2(cursor == cpt,
+    xbt_test_assert(cursor == cpt,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
                      cursor, cpt);
   }
@@ -1023,11 +1023,11 @@ XBT_TEST_UNIT("insert",test_dynar_insert,"Using the xbt_dynar_insert and xbt_dyn
   for (cpt =NB_ELEM-1; cpt >=0; cpt--) {
     int val;
     xbt_dynar_remove_at(d,xbt_dynar_length(d)-1,&val);
-    xbt_test_assert2(cpt == val,
+    xbt_test_assert(cpt == val,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
                      cursor, cpt);
   }
-  xbt_test_assert1(xbt_dynar_length(d) == 0,
+  xbt_test_assert(xbt_dynar_length(d) == 0,
                    "There is still %lu elements in the dynar after removing everything",
                    xbt_dynar_length(d));
   xbt_dynar_free(&d);
@@ -1043,17 +1043,17 @@ XBT_TEST_UNIT("double", test_dynar_double, "Dynars of doubles")
   unsigned int cursor;
   double d1, d2;
 
-  xbt_test_add0("==== Traverse the empty dynar");
+  xbt_test_add("==== Traverse the empty dynar");
   d = xbt_dynar_new(sizeof(int), NULL);
   xbt_dynar_foreach(d, cursor, cpt) {
-    xbt_test_assert0(FALSE,
+    xbt_test_assert(FALSE,
                      "Damnit, there is something in the empty dynar");
   }
   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
   /* in your code is naturally the way to go outside a regression test */
 
-  xbt_test_add0("==== Push/shift 5000 doubles");
+  xbt_test_add("==== Push/shift 5000 doubles");
   d = xbt_dynar_new(sizeof(double), NULL);
   for (cpt = 0; cpt < 5000; cpt++) {
     d1 = (double) cpt;
@@ -1061,14 +1061,14 @@ XBT_TEST_UNIT("double", test_dynar_double, "Dynars of doubles")
   }
   xbt_dynar_foreach(d, cursor, d2) {
     d1 = (double) cursor;
-    xbt_test_assert2(d1 == d2,
+    xbt_test_assert(d1 == d2,
                      "The retrieved value is not the same than the injected one (%f!=%f)",
                      d1, d2);
   }
   for (cpt = 0; cpt < 5000; cpt++) {
     d1 = (double) cpt;
     xbt_dynar_shift(d, &d2);
-    xbt_test_assert2(d1 == d2,
+    xbt_test_assert(d1 == d2,
                      "The retrieved value is not the same than the injected one (%f!=%f)",
                      d1, d2);
   }
@@ -1076,7 +1076,7 @@ XBT_TEST_UNIT("double", test_dynar_double, "Dynars of doubles")
   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
   /* in your code is naturally the way to go outside a regression test */
 
-  xbt_test_add0("==== Unshift/pop 5000 doubles");
+  xbt_test_add("==== Unshift/pop 5000 doubles");
   d = xbt_dynar_new(sizeof(double), NULL);
   for (cpt = 0; cpt < 5000; cpt++) {
     d1 = (double) cpt;
@@ -1085,7 +1085,7 @@ XBT_TEST_UNIT("double", test_dynar_double, "Dynars of doubles")
   for (cpt = 0; cpt < 5000; cpt++) {
     d1 = (double) cpt;
     xbt_dynar_pop(d, &d2);
-    xbt_test_assert2(d1 == d2,
+    xbt_test_assert(d1 == d2,
                      "The retrieved value is not the same than the injected one (%f!=%f)",
                      d1, d2);
   }
@@ -1095,7 +1095,7 @@ XBT_TEST_UNIT("double", test_dynar_double, "Dynars of doubles")
 
 
 
-  xbt_test_add0
+  xbt_test_add
       ("==== Push 5000 doubles, insert 1000 doubles in the middle, shift everything");
   d = xbt_dynar_new(sizeof(double), NULL);
   for (cpt = 0; cpt < 5000; cpt++) {
@@ -1110,7 +1110,7 @@ XBT_TEST_UNIT("double", test_dynar_double, "Dynars of doubles")
   for (cpt = 0; cpt < 2500; cpt++) {
     d1 = (double) cpt;
     xbt_dynar_shift(d, &d2);
-    xbt_test_assert2(d1 == d2,
+    xbt_test_assert(d1 == d2,
                      "The retrieved value is not the same than the injected one at the begining (%f!=%f)",
                      d1, d2);
     XBT_DEBUG("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
@@ -1118,14 +1118,14 @@ XBT_TEST_UNIT("double", test_dynar_double, "Dynars of doubles")
   for (cpt = 999; cpt >= 0; cpt--) {
     d1 = (double) cpt;
     xbt_dynar_shift(d, &d2);
-    xbt_test_assert2(d1 == d2,
+    xbt_test_assert(d1 == d2,
                      "The retrieved value is not the same than the injected one in the middle (%f!=%f)",
                      d1, d2);
   }
   for (cpt = 2500; cpt < 5000; cpt++) {
     d1 = (double) cpt;
     xbt_dynar_shift(d, &d2);
-    xbt_test_assert2(d1 == d2,
+    xbt_test_assert(d1 == d2,
                      "The retrieved value is not the same than the injected one at the end (%f!=%f)",
                      d1, d2);
   }
@@ -1134,7 +1134,7 @@ XBT_TEST_UNIT("double", test_dynar_double, "Dynars of doubles")
   /* in your code is naturally the way to go outside a regression test */
 
 
-  xbt_test_add0("==== Push 5000 double, remove 2000-4000. free the rest");
+  xbt_test_add("==== Push 5000 double, remove 2000-4000. free the rest");
   d = xbt_dynar_new(sizeof(double), NULL);
   for (cpt = 0; cpt < 5000; cpt++) {
     d1 = (double) cpt;
@@ -1143,7 +1143,7 @@ XBT_TEST_UNIT("double", test_dynar_double, "Dynars of doubles")
   for (cpt = 2000; cpt < 4000; cpt++) {
     d1 = (double) cpt;
     xbt_dynar_remove_at(d, 2000, &d2);
-    xbt_test_assert2(d1 == d2,
+    xbt_test_assert(d1 == d2,
                      "Remove a bad value. Got %f, expected %f", d2, d1);
   }
   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
@@ -1165,17 +1165,17 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   char buf[1024];
   char *s1, *s2;
 
-  xbt_test_add0("==== Traverse the empty dynar");
+  xbt_test_add("==== Traverse the empty dynar");
   d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
   xbt_dynar_foreach(d, iter, s1) {
-    xbt_test_assert0(FALSE,
+    xbt_test_assert(FALSE,
                      "Damnit, there is something in the empty dynar");
   }
   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
   /* in your code is naturally the way to go outside a regression test */
 
-  xbt_test_add1("==== Push %d strings, set them again 3 times, shift them",
+  xbt_test_add("==== Push %d strings, set them again 3 times, shift them",
                 NB_ELEM);
   /* Populate_str [doxygen cruft] */
   d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
@@ -1203,7 +1203,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   for (cpt = 0; cpt < NB_ELEM; cpt++) {
     sprintf(buf, "%d", cpt);
     xbt_dynar_shift(d, &s2);
-    xbt_test_assert2(!strcmp(buf, s2),
+    xbt_test_assert(!strcmp(buf, s2),
                      "The retrieved value is not the same than the injected one (%s!=%s)",
                      buf, s2);
     free(s2);
@@ -1212,7 +1212,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
   /* in your code is naturally the way to go outside a regression test */
 
-  xbt_test_add1("==== Unshift, traverse and pop %d strings", NB_ELEM);
+  xbt_test_add("==== Unshift, traverse and pop %d strings", NB_ELEM);
   d = xbt_dynar_new(sizeof(char **), &xbt_free_ref);
   for (cpt = 0; cpt < NB_ELEM; cpt++) {
     sprintf(buf, "%d", cpt);
@@ -1222,7 +1222,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   /* 2. Traverse the dynar with the macro */
   xbt_dynar_foreach(d, iter, s1) {
     sprintf(buf, "%d", NB_ELEM - iter - 1);
-    xbt_test_assert2(!strcmp(buf, s1),
+    xbt_test_assert(!strcmp(buf, s1),
                      "The retrieved value is not the same than the injected one (%s!=%s)",
                      buf, s1);
   }
@@ -1230,7 +1230,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   for (cpt = 0; cpt < NB_ELEM; cpt++) {
     sprintf(buf, "%d", cpt);
     xbt_dynar_pop(d, &s2);
-    xbt_test_assert2(!strcmp(buf, s2),
+    xbt_test_assert(!strcmp(buf, s2),
                      "The retrieved value is not the same than the injected one (%s!=%s)",
                      buf, s2);
     free(s2);
@@ -1241,7 +1241,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   /* in your code is naturally the way to go outside a regression test */
 
 
-  xbt_test_add2
+  xbt_test_add
       ("==== Push %d strings, insert %d strings in the middle, shift everything",
        NB_ELEM, NB_ELEM / 5);
   d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
@@ -1259,7 +1259,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   for (cpt = 0; cpt < NB_ELEM / 2; cpt++) {
     sprintf(buf, "%d", cpt);
     xbt_dynar_shift(d, &s2);
-    xbt_test_assert2(!strcmp(buf, s2),
+    xbt_test_assert(!strcmp(buf, s2),
                      "The retrieved value is not the same than the injected one at the begining (%s!=%s)",
                      buf, s2);
     free(s2);
@@ -1267,7 +1267,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   for (cpt = (NB_ELEM / 5) - 1; cpt >= 0; cpt--) {
     sprintf(buf, "%d", cpt);
     xbt_dynar_shift(d, &s2);
-    xbt_test_assert2(!strcmp(buf, s2),
+    xbt_test_assert(!strcmp(buf, s2),
                      "The retrieved value is not the same than the injected one in the middle (%s!=%s)",
                      buf, s2);
     free(s2);
@@ -1275,7 +1275,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   for (cpt = NB_ELEM / 2; cpt < NB_ELEM; cpt++) {
     sprintf(buf, "%d", cpt);
     xbt_dynar_shift(d, &s2);
-    xbt_test_assert2(!strcmp(buf, s2),
+    xbt_test_assert(!strcmp(buf, s2),
                      "The retrieved value is not the same than the injected one at the end (%s!=%s)",
                      buf, s2);
     free(s2);
@@ -1285,7 +1285,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   /* in your code is naturally the way to go outside a regression test */
 
 
-  xbt_test_add3("==== Push %d strings, remove %d-%d. free the rest",
+  xbt_test_add("==== Push %d strings, remove %d-%d. free the rest",
                 NB_ELEM, 2 * (NB_ELEM / 5), 4 * (NB_ELEM / 5));
   d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
   for (cpt = 0; cpt < NB_ELEM; cpt++) {
@@ -1296,7 +1296,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   for (cpt = 2 * (NB_ELEM / 5); cpt < 4 * (NB_ELEM / 5); cpt++) {
     sprintf(buf, "%d", cpt);
     xbt_dynar_remove_at(d, 2 * (NB_ELEM / 5), &s2);
-    xbt_test_assert2(!strcmp(buf, s2),
+    xbt_test_assert(!strcmp(buf, s2),
                      "Remove a bad value. Got %s, expected %s", s2, buf);
     free(s2);
   }
@@ -1346,7 +1346,7 @@ XBT_TEST_UNIT("synchronized int", test_dynar_sync_int, "Synchronized dynars of i
   xbt_dynar_t d;
   xbt_thread_t pusher, poper;
 
-  xbt_test_add0("==== Have a pusher and a popper on the dynar");
+  xbt_test_add("==== Have a pusher and a popper on the dynar");
   d = xbt_dynar_new_sync(sizeof(int), NULL);
   pusher = xbt_thread_create("pusher", pusher_f, d, 0 /*not joinable */ );
   poper = xbt_thread_create("poper", poper_f, d, 0 /*not joinable */ );
index aa8836c..ade191b 100644 (file)
@@ -241,48 +241,48 @@ XBT_TEST_UNIT("controlflow", test_controlflow, "basic nested control flow")
   xbt_ex_t ex;
   volatile int n = 1;
 
-  xbt_test_add0("basic nested control flow");
+  xbt_test_add("basic nested control flow");
 
   TRY {
     if (n != 1)
-      xbt_test_fail1("M1: n=%d (!= 1)", n);
+      xbt_test_fail("M1: n=%d (!= 1)", n);
     n++;
     TRY {
       if (n != 2)
-        xbt_test_fail1("M2: n=%d (!= 2)", n);
+        xbt_test_fail("M2: n=%d (!= 2)", n);
       n++;
       THROW0(unknown_error, 0, "something");
     }
     CATCH(ex) {
       if (n != 3)
-        xbt_test_fail1("M3: n=%d (!= 3)", n);
+        xbt_test_fail("M3: n=%d (!= 3)", n);
       n++;
       xbt_ex_free(ex);
     }
     n++;
     TRY {
       if (n != 5)
-        xbt_test_fail1("M2: n=%d (!= 5)", n);
+        xbt_test_fail("M2: n=%d (!= 5)", n);
       n++;
       THROW0(unknown_error, 0, "something");
     }
     CATCH(ex) {
       if (n != 6)
-        xbt_test_fail1("M3: n=%d (!= 6)", n);
+        xbt_test_fail("M3: n=%d (!= 6)", n);
       n++;
       RETHROW;
       n++;
     }
-    xbt_test_fail1("MX: n=%d (shouldn't reach this point)", n);
+    xbt_test_fail("MX: n=%d (shouldn't reach this point)", n);
   }
   CATCH(ex) {
     if (n != 7)
-      xbt_test_fail1("M4: n=%d (!= 7)", n);
+      xbt_test_fail("M4: n=%d (!= 7)", n);
     n++;
     xbt_ex_free(ex);
   }
   if (n != 8)
-    xbt_test_fail1("M5: n=%d (!= 8)", n);
+    xbt_test_fail("M5: n=%d (!= 8)", n);
 }
 
 XBT_TEST_UNIT("value", test_value, "exception value passing")
@@ -293,13 +293,13 @@ XBT_TEST_UNIT("value", test_value, "exception value passing")
     THROW0(unknown_error, 2, "toto");
   }
   CATCH(ex) {
-    xbt_test_add0("exception value passing");
+    xbt_test_add("exception value passing");
     if (ex.category != unknown_error)
-      xbt_test_fail1("category=%d (!= 1)", ex.category);
+      xbt_test_fail("category=%d (!= 1)", ex.category);
     if (ex.value != 2)
-      xbt_test_fail1("value=%d (!= 2)", ex.value);
+      xbt_test_fail("value=%d (!= 2)", ex.value);
     if (strcmp(ex.msg, "toto"))
-      xbt_test_fail1("message=%s (!= toto)", ex.msg);
+      xbt_test_fail("message=%s (!= toto)", ex.msg);
     xbt_ex_free(ex);
   }
 }
@@ -316,14 +316,14 @@ XBT_TEST_UNIT("variables", test_variables, "variable value preservation")
     v2 = 5678;
     THROW0(unknown_error, 0, "toto");
   } CATCH(ex) {
-    xbt_test_add0("variable preservation");
+    xbt_test_add("variable preservation");
     if (r1 != 1234)
-      xbt_test_fail1("r1=%d (!= 1234)", r1);
+      xbt_test_fail("r1=%d (!= 1234)", r1);
     if (v1 != 1234)
-      xbt_test_fail1("v1=%d (!= 1234)", v1);
+      xbt_test_fail("v1=%d (!= 1234)", v1);
     /* r2 is allowed to be destroyed because not volatile */
     if (v2 != 5678)
-      xbt_test_fail1("v2=%d (!= 5678)", v2);
+      xbt_test_fail("v2=%d (!= 5678)", v2);
     xbt_ex_free(ex);
   }
 }
@@ -334,7 +334,7 @@ XBT_TEST_UNIT("cleanup", test_cleanup, "cleanup handling")
   volatile int v1;
   int c;
 
-  xbt_test_add0("cleanup handling");
+  xbt_test_add("cleanup handling");
 
   v1 = 1234;
   c = 0;
@@ -343,18 +343,18 @@ XBT_TEST_UNIT("cleanup", test_cleanup, "cleanup handling")
     THROW0(1, 2, "blah");
   } TRY_CLEANUP {
     if (v1 != 5678)
-      xbt_test_fail1("v1 = %d (!= 5678)", v1);
+      xbt_test_fail("v1 = %d (!= 5678)", v1);
     c = 1;
   }
   CATCH(ex) {
     if (v1 != 5678)
-      xbt_test_fail1("v1 = %d (!= 5678)", v1);
+      xbt_test_fail("v1 = %d (!= 5678)", v1);
     if (!(ex.category == 1 && ex.value == 2 && !strcmp(ex.msg, "blah")))
-      xbt_test_fail0("unexpected exception contents");
+      xbt_test_fail("unexpected exception contents");
     xbt_ex_free(ex);
   }
   if (!c)
-    xbt_test_fail0("xbt_ex_free not executed");
+    xbt_test_fail("xbt_ex_free not executed");
 }
 
 
index 344a988..aea987c 100644 (file)
@@ -209,7 +209,7 @@ void fun(void *arg)
 
 XBT_TEST_UNIT("basic", test_parmap_basic, "Basic usage")
 {
-  xbt_test_add0("Create the parmap");
+  xbt_test_add("Create the parmap");
 
   unsigned long i,j;
   xbt_dynar_t data = xbt_dynar_new(sizeof(void *), NULL);
index f56fe33..2577b25 100644 (file)
@@ -354,13 +354,13 @@ static void debuged_add(xbt_set_t set, const char *name, const char *data)
 
   elm->data = xbt_strdup(data);
 
-  xbt_test_log2("Add %s (->%s)", name, data);
+  xbt_test_log("Add %s (->%s)", name, data);
   xbt_set_add(set, (xbt_set_elm_t) elm, &my_elem_free);
 }
 
 static void fill(xbt_set_t * set)
 {
-  xbt_test_add0("Fill in the data set");
+  xbt_test_add("Fill in the data set");
 
   *set = xbt_set_new();
   debuged_add(*set, "12", "12");
@@ -368,9 +368,9 @@ static void fill(xbt_set_t * set)
   debuged_add(*set, "12b", "12b");
   debuged_add(*set, "123", "123");
   debuged_add(*set, "123456", "123456");
-  xbt_test_log0("Child becomes child of what to add");
+  xbt_test_log("Child becomes child of what to add");
   debuged_add(*set, "1234", "1234");
-  xbt_test_log0("Need of common ancestor");
+  xbt_test_log("Need of common ancestor");
   debuged_add(*set, "123457", "123457");
 }
 
@@ -378,9 +378,9 @@ static void search_name(xbt_set_t head, const char *key)
 {
   my_elem_t elm;
 
-  xbt_test_add1("Search by name %s", key);
+  xbt_test_add("Search by name %s", key);
   elm = (my_elem_t) xbt_set_get_by_name(head, key);
-  xbt_test_log2(" Found %s (under ID %d)\n",
+  xbt_test_log(" Found %s (under ID %d)\n",
                 elm ? elm->data : "(null)", elm ? elm->ID : -1);
   if (strcmp(key, elm->name))
     THROW2(mismatch_error, 0, "The key (%s) is not the one expected (%s)",
@@ -395,9 +395,9 @@ static void search_id(xbt_set_t head, int id, const char *key)
 {
   my_elem_t elm;
 
-  xbt_test_add1("Search by id %d", id);
+  xbt_test_add("Search by id %d", id);
   elm = (my_elem_t) xbt_set_get_by_id(head, id);
-  xbt_test_log2("Found %s (data %s)",
+  xbt_test_log("Found %s (data %s)",
                 elm ? elm->name : "(null)", elm ? elm->data : "(null)");
   if (id != elm->ID)
     THROW2(mismatch_error, 0,
@@ -417,9 +417,9 @@ static void traverse(xbt_set_t set)
   my_elem_t elm = NULL;
 
   xbt_set_foreach(set, cursor, elm) {
-    xbt_test_assert0(elm, "Dude ! Got a null elm during traversal!");
-    xbt_test_log3("Id(%d):  %s->%s\n", elm->ID, elm->name, elm->data);
-    xbt_test_assert2(!strcmp(elm->name, elm->data),
+    xbt_test_assert(elm, "Dude ! Got a null elm during traversal!");
+    xbt_test_log("Id(%d):  %s->%s\n", elm->ID, elm->name, elm->data);
+    xbt_test_assert(!strcmp(elm->name, elm->data),
                      "Key(%s) != value(%s). Abording", elm->name,
                      elm->data);
   }
@@ -429,7 +429,7 @@ static void search_not_found(xbt_set_t set, const char *data)
 {
   xbt_ex_t e;
 
-  xbt_test_add1("Search %s (expected not to be found)", data);
+  xbt_test_add("Search %s (expected not to be found)", data);
   TRY {
     xbt_set_get_by_name(set, data);
     THROW1(unknown_error, 0,
@@ -448,14 +448,14 @@ XBT_TEST_UNIT("basic", test_set_basic, "Basic usage")
 {
   set = NULL;
 
-  xbt_test_add0("Traverse the empty set");
+  xbt_test_add("Traverse the empty set");
   traverse(set);
 
-  xbt_test_add0("Free a data set");
+  xbt_test_add("Free a data set");
   fill(&set);
   xbt_set_free(&set);
 
-  xbt_test_add0("Free the NULL data set");
+  xbt_test_add("Free the NULL data set");
   xbt_set_free(&set);
 
 }
@@ -464,20 +464,20 @@ XBT_TEST_UNIT("change", test_set_change, "Changing some values")
 {
   fill(&set);
 
-  xbt_test_add0("Change 123 to 'Changed 123'");
+  xbt_test_add("Change 123 to 'Changed 123'");
   debuged_add(set, "123", "Changed 123");
 
-  xbt_test_add0("Change 123 back to '123'");
+  xbt_test_add("Change 123 back to '123'");
   debuged_add(set, "123", "123");
 
-  xbt_test_add0("Change 12a to 'Dummy 12a'");
+  xbt_test_add("Change 12a to 'Dummy 12a'");
   debuged_add(set, "12a", "Dummy 12a");
 
-  xbt_test_add0("Change 12a to '12a'");
+  xbt_test_add("Change 12a to '12a'");
   debuged_add(set, "12a", "12a");
 
   /*  xbt_dict_dump(head,(void (*)(void*))&printf); */
-  xbt_test_add0("Traverse the resulting data set");
+  xbt_test_add("Traverse the resulting data set");
   traverse(set);
 }
 
@@ -485,9 +485,9 @@ XBT_TEST_UNIT("retrieve", test_set_retrieve, "Retrieving some values")
 {
   my_elem_t elm;
 
-  xbt_test_add0("Search 123");
+  xbt_test_add("Search 123");
   elm = (my_elem_t) xbt_set_get_by_name(set, "123");
-  xbt_test_assert0(elm, "elm must be there");
+  xbt_test_assert(elm, "elm must be there");
   xbt_assert(!strcmp("123", elm->data));
 
   search_not_found(set, "Can't be found");
@@ -510,16 +510,16 @@ XBT_TEST_UNIT("retrieve", test_set_retrieve, "Retrieving some values")
   search_id(set, 5, "1234");
   search_id(set, 6, "123457");
 
-  xbt_test_add0("Traverse the resulting data set");
+  xbt_test_add("Traverse the resulting data set");
   traverse(set);
 
   /*  xbt_dict_dump(head,(void (*)(void*))&printf); */
 
-  xbt_test_add0("Free the data set (twice)");
+  xbt_test_add("Free the data set (twice)");
   xbt_set_free(&set);
   xbt_set_free(&set);
 
-  xbt_test_add0("Traverse the resulting data set");
+  xbt_test_add("Traverse the resulting data set");
   traverse(set);
 }
 
@@ -548,7 +548,7 @@ XBT_TEST_UNIT("remove", test_set_remove, "Removing some values")
 
   debuged_add(set, "12anew", "12anew");
   elm = (my_elem_t) xbt_set_get_by_id(set, 1);
-  xbt_test_assert1(elm->ID == 1, "elm->ID is %d but should be 1", elm->ID);
+  xbt_test_assert(elm->ID == 1, "elm->ID is %d but should be 1", elm->ID);
 
   xbt_set_free(&set);
 }
index bc2361a..441023f 100644 (file)
@@ -235,8 +235,8 @@ XBT_TEST_UNIT("basic", test_swag_basic, "Basic usage")
   obj1->name = "Obj 1";
   obj2->name = "Obj 2";
 
-  xbt_test_add0("Basic usage");
-  xbt_test_log3("%p %p %ld\n", obj1, &(obj1->setB),
+  xbt_test_add("Basic usage");
+  xbt_test_log("%p %p %ld\n", obj1, &(obj1->setB),
                 (long) ((char *) &(obj1->setB) - (char *) obj1));
 
   setA = xbt_swag_new(xbt_swag_offset(*obj1, setA));
@@ -250,17 +250,17 @@ XBT_TEST_UNIT("basic", test_swag_basic, "Basic usage")
   xbt_swag_remove(obj1, setB);
   /*  xbt_swag_remove(obj2, setB); */
 
-  xbt_test_add0("Traverse set A");
+  xbt_test_add("Traverse set A");
   xbt_swag_foreach(obj, setA) {
-    xbt_test_log1("Saw: %s", obj->name);
+    xbt_test_log("Saw: %s", obj->name);
   }
 
-  xbt_test_add0("Traverse set B");
+  xbt_test_add("Traverse set B");
   xbt_swag_foreach(obj, setB) {
-    xbt_test_log1("Saw: %s", obj->name);
+    xbt_test_log("Saw: %s", obj->name);
   }
 
-  xbt_test_add0("Ensure set content and length");
+  xbt_test_add("Ensure set content and length");
   xbt_test_assert(xbt_swag_belongs(obj1, setA));
   xbt_test_assert(xbt_swag_belongs(obj2, setA));
 
index 29016d9..f74500a 100644 (file)
@@ -195,8 +195,8 @@ static void test_sha(const char *clear, const char *hashed)
   char hash[41];
   xbt_sha(clear, hash);
 
-  xbt_test_add1("==== Test with '%s'", clear);
-  xbt_test_assert3(!memcmp(hash, hashed, 40), "Wrong sha: %40s!=%40s (%s)",
+  xbt_test_add("==== Test with '%s'", clear);
+  xbt_test_assert(!memcmp(hash, hashed, 40), "Wrong sha: %40s!=%40s (%s)",
                    hash, hashed, mycmp(hash, hashed, 40));
 }
 
index d0fbddf..83fb7b1 100644 (file)
@@ -453,10 +453,10 @@ xbt_dynar_t xbt_str_split_quoted(const char *s)
 #include "xbt/str.h"
 
 #define mytest(name, input, expected) \
-  xbt_test_add0(name); \
+  xbt_test_add(name); \
   d=xbt_str_split_quoted(input); \
   s=xbt_str_join(d,"XXX"); \
-  xbt_test_assert3(!strcmp(s,expected),\
+  xbt_test_assert(!strcmp(s,expected),\
                    "Input (%s) leads to (%s) instead of (%s)", \
                    input,s,expected);\
                    free(s); \
@@ -487,10 +487,10 @@ XBT_TEST_UNIT("xbt_str_split_quoted", test_split_quoted, "test the function xbt_
 }
 
 #define mytest_str(name, input, separator, expected) \
-  xbt_test_add0(name); \
+  xbt_test_add(name); \
   d=xbt_str_split_str(input, separator); \
   s=xbt_str_join(d,"XXX"); \
-  xbt_test_assert3(!strcmp(s,expected),\
+  xbt_test_assert(!strcmp(s,expected),\
                    "Input (%s) leads to (%s) instead of (%s)", \
                    input,s,expected);\
                    free(s); \
index ed55303..269f8c1 100644 (file)
@@ -329,7 +329,7 @@ static void mytest(const char *input, const char *patterns,
   xbt_strbuff_append(sb, input);
   xbt_strbuff_varsubst(sb, p);
   xbt_dict_free(&p);
-  xbt_test_assert4(!strcmp(sb->data, expected),
+  xbt_test_assert(!strcmp(sb->data, expected),
                    "Input (%s) with patterns (%s) leads to (%s) instead of (%s)",
                    input, patterns, sb->data, expected);
   xbt_strbuff_free(sb);
@@ -338,91 +338,91 @@ static void mytest(const char *input, const char *patterns,
 XBT_TEST_SUITE("xbt_strbuff", "String Buffers");
 XBT_TEST_UNIT("xbt_strbuff_substitute", test_strbuff_substitute, "test the function xbt_strbuff_substitute")
 {
-  xbt_test_add0("Empty");
+  xbt_test_add("Empty");
   mytest("", "", "");
 
-  xbt_test_add0("Value shorter, no braces, only variable");
+  xbt_test_add("Value shorter, no braces, only variable");
   mytest("$tutu", "tutu=t", "t");
-  xbt_test_add0("Value shorter, braces, only variable");
+  xbt_test_add("Value shorter, braces, only variable");
   mytest("${tutu}", "tutu=t", "t");
-  xbt_test_add0("Value shorter, no braces, data after");
+  xbt_test_add("Value shorter, no braces, data after");
   mytest("$tutu toto", "tutu=t", "t toto");
-  xbt_test_add0("Value shorter, braces, data after");
+  xbt_test_add("Value shorter, braces, data after");
   mytest("${tutu} toto", "tutu=t", "t toto");
-  xbt_test_add0("Value shorter, no braces, data before");
+  xbt_test_add("Value shorter, no braces, data before");
   mytest("toto $tutu", "tutu=t", "toto t");
-  xbt_test_add0("Value shorter, braces, data before");
+  xbt_test_add("Value shorter, braces, data before");
   mytest("toto ${tutu}", "tutu=t", "toto t");
-  xbt_test_add0("Value shorter, no braces, data before and after");
+  xbt_test_add("Value shorter, no braces, data before and after");
   mytest("toto $tutu tata", "tutu=t", "toto t tata");
-  xbt_test_add0("Value shorter, braces, data before and after");
+  xbt_test_add("Value shorter, braces, data before and after");
   mytest("toto ${tutu} tata", "tutu=t", "toto t tata");
 
-  xbt_test_add0("Value as long, no braces, only variable");
+  xbt_test_add("Value as long, no braces, only variable");
   mytest("$tutu", "tutu=12345", "12345");
-  xbt_test_add0("Value as long, braces, only variable");
+  xbt_test_add("Value as long, braces, only variable");
   mytest("${tutu}", "tutu=1234567", "1234567");
-  xbt_test_add0("Value as long, no braces, data after");
+  xbt_test_add("Value as long, no braces, data after");
   mytest("$tutu toto", "tutu=12345", "12345 toto");
-  xbt_test_add0("Value as long, braces, data after");
+  xbt_test_add("Value as long, braces, data after");
   mytest("${tutu} toto", "tutu=1234567", "1234567 toto");
-  xbt_test_add0("Value as long, no braces, data before");
+  xbt_test_add("Value as long, no braces, data before");
   mytest("toto $tutu", "tutu=12345", "toto 12345");
-  xbt_test_add0("Value as long, braces, data before");
+  xbt_test_add("Value as long, braces, data before");
   mytest("toto ${tutu}", "tutu=1234567", "toto 1234567");
-  xbt_test_add0("Value as long, no braces, data before and after");
+  xbt_test_add("Value as long, no braces, data before and after");
   mytest("toto $tutu tata", "tutu=12345", "toto 12345 tata");
-  xbt_test_add0("Value as long, braces, data before and after");
+  xbt_test_add("Value as long, braces, data before and after");
   mytest("toto ${tutu} tata", "tutu=1234567", "toto 1234567 tata");
 
-  xbt_test_add0("Value longer, no braces, only variable");
+  xbt_test_add("Value longer, no braces, only variable");
   mytest("$t", "t=tututu", "tututu");
-  xbt_test_add0("Value longer, braces, only variable");
+  xbt_test_add("Value longer, braces, only variable");
   mytest("${t}", "t=tututu", "tututu");
-  xbt_test_add0("Value longer, no braces, data after");
+  xbt_test_add("Value longer, no braces, data after");
   mytest("$t toto", "t=tututu", "tututu toto");
-  xbt_test_add0("Value longer, braces, data after");
+  xbt_test_add("Value longer, braces, data after");
   mytest("${t} toto", "t=tututu", "tututu toto");
-  xbt_test_add0("Value longer, no braces, data before");
+  xbt_test_add("Value longer, no braces, data before");
   mytest("toto $t", "t=tututu", "toto tututu");
-  xbt_test_add0("Value longer, braces, data before");
+  xbt_test_add("Value longer, braces, data before");
   mytest("toto ${t}", "t=tututu", "toto tututu");
-  xbt_test_add0("Value longer, no braces, data before and after");
+  xbt_test_add("Value longer, no braces, data before and after");
   mytest("toto $t tata", "t=tututu", "toto tututu tata");
-  xbt_test_add0("Value longer, braces, data before and after");
+  xbt_test_add("Value longer, braces, data before and after");
   mytest("toto ${t} tata", "t=tututu", "toto tututu tata");
 
-  xbt_test_add0("Value much longer, no braces, only variable");
+  xbt_test_add("Value much longer, no braces, only variable");
   mytest("$t", "t=" force_resize, force_resize);
-  xbt_test_add0("Value much longer, no braces, data after");
+  xbt_test_add("Value much longer, no braces, data after");
   mytest("$t toto", "t=" force_resize, force_resize " toto");
-  xbt_test_add0("Value much longer, braces, data after");
+  xbt_test_add("Value much longer, braces, data after");
   mytest("${t} toto", "t=" force_resize, force_resize " toto");
-  xbt_test_add0("Value much longer, no braces, data before");
+  xbt_test_add("Value much longer, no braces, data before");
   mytest("toto $t", "t=" force_resize, "toto " force_resize);
-  xbt_test_add0("Value much longer, braces, data before");
+  xbt_test_add("Value much longer, braces, data before");
   mytest("toto ${t}", "t=" force_resize, "toto " force_resize);
-  xbt_test_add0("Value much longer, no braces, data before and after");
+  xbt_test_add("Value much longer, no braces, data before and after");
   mytest("toto $t tata", "t=" force_resize, "toto " force_resize " tata");
-  xbt_test_add0("Value much longer, braces, data before and after");
+  xbt_test_add("Value much longer, braces, data before and after");
   mytest("toto ${t} tata", "t=" force_resize,
          "toto " force_resize " tata");
 
-  xbt_test_add0("Escaped $");
+  xbt_test_add("Escaped $");
   mytest("\\$tutu", "tutu=t", "\\$tutu");
-  xbt_test_add0("Space in var name (with braces)");
+  xbt_test_add("Space in var name (with braces)");
   mytest("${tu ti}", "tu_ti=t", "t");
 
-  xbt_test_add0("Two variables");
+  xbt_test_add("Two variables");
   mytest("$toto $tutu", "toto=1 tutu=2", "1 2");
 
   // Commented: I'm too lazy to do a memmove in var name to remove the backslash after use.
   // Users should use braces.
-  //  xbt_test_add0("Escaped space in var name", "$tu\\ ti", "tu_ti=t", "t");
+  //  xbt_test_add("Escaped space in var name", "$tu\\ ti", "tu_ti=t", "t");
 
-  xbt_test_add0("Default value");
+  xbt_test_add("Default value");
   mytest("${t:-toto}", "", "toto");
-  xbt_test_add0("Useless default value (variable already defined)");
+  xbt_test_add("Useless default value (variable already defined)");
   mytest("${t:-toto}", "t=TRUC", "TRUC");
 
 }
index 594fd01..0a3976a 100644 (file)
@@ -81,18 +81,18 @@ XBT_TEST_UNIT("dopar", test_dynar_dopar, "do parallel on dynars of integers")
   int i, cpt;
   unsigned int cursor;
 
-  xbt_test_add1
+  xbt_test_add
       ("==== Push %d int, add 100 to each of them in parallel and check the results",
        NB_ELEM);
   d = xbt_dynar_new(sizeof(int), NULL);
   for (cpt = 0; cpt < NB_ELEM; cpt++) {
     xbt_dynar_push_as(d, int, cpt);     /* This is faster (and possible only with scalars) */
-    xbt_test_log2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
+    xbt_test_log("Push %d, length=%lu", cpt, xbt_dynar_length(d));
   }
   xbt_dynar_dopar(d, add100);
   cpt = 100;
   xbt_dynar_foreach(d, cursor, i) {
-    xbt_test_assert2(i == cpt,
+    xbt_test_assert(i == cpt,
                      "The retrieved value is not the expected one (%d!=%d)",
                      i, cpt);
     cpt++;