Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please codacy: use long form of negation in C++
[simgrid.git] / src / xbt / cunit.cpp
index 94e16a6..195d368 100644 (file)
@@ -192,8 +192,8 @@ xbt_test_suite_t xbt_test_suite_by_name(const char *name, const char *fmt, ...)
 
   if (_xbt_test_suites)
     xbt_dynar_foreach(_xbt_test_suites, it_suite, suite)
-        if (!strcmp(suite->name, name))
-      return suite;
+      if (not strcmp(suite->name, name))
+        return suite;
 
   va_start(ap, fmt);
   bufname = bvprintf(fmt, ap);
@@ -275,7 +275,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
 
   snprintf(suite_title + 40 - (suite_len + 4) / 2, 81 - (40 - (suite_len + 4) / 2), "[ %s ]", suite->title);
   suite_title[40 + (suite_len + 5) / 2] = '=';
-  if (!suite->enabled)
+  if (not suite->enabled)
     snprintf(suite_title + 70, 11, " DISABLED ");
   fprintf(stderr, "\n%s\n", suite_title);
 
@@ -307,9 +307,9 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
         } else {
           unit->nb_tests++;
 
-          if (test->failed && !test->expected_failure)
+          if (test->failed && not test->expected_failure)
             unit->test_failed++;
-          if (!test->failed && test->expected_failure)
+          if (not test->failed && test->expected_failure)
             unit->test_failed++;
           if (test->expected_failure)
             unit->test_expect++;
@@ -344,7 +344,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
           }
           fprintf(stderr, "      %s: %s [%s:%d]\n", resname, test->title, file, line);
 
-          if ((test->expected_failure && !test->failed) || (!test->expected_failure && test->failed)) {
+          if ((test->expected_failure && not test->failed) || (not test->expected_failure && test->failed)) {
             xbt_dynar_foreach(test->logs, it_log, log) {
               file = (log->file != nullptr ? log->file : file);
               line = (log->line != 0 ? log->line : line);
@@ -358,7 +358,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
         } else {
           fprintf(stderr, "\n");
         }
-      } else if (!unit->enabled) {
+      } else if (not unit->enabled) {
         fprintf(stderr, " disabled\n"); /* no test were run */
       } else if (unit->nb_tests) {
         fprintf(stderr, "...... ok\n"); /* successful */
@@ -382,7 +382,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
         suite->nb_units++;
         if (unit->test_failed)
           suite->unit_failed++;
-      } else if (!unit->enabled) {
+      } else if (not unit->enabled) {
         suite->unit_disabled++;
       } else {
         suite->unit_ignore++;
@@ -398,7 +398,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
     _xbt_test_nb_suites++;
     if (suite->test_failed)
       _xbt_test_suite_failed++;
-  } else if (!suite->enabled) {
+  } else if (not suite->enabled) {
     _xbt_test_suite_disabled++;
   } else {
     _xbt_test_suite_ignore++;
@@ -466,13 +466,13 @@ static void apply_selection(char *selection)
   char suitename[512];
   char unitname[512];
 
-  if (!selection || selection[0] == '\0')
+  if (not selection || selection[0] == '\0')
     return;
 
   /*printf("Test selection: %s\n", selection); */
 
   /* First apply the selection */
-  while (!done) {
+  while (not done) {
     int enabling = 1;
 
     char *p = strchr(sel, ',');
@@ -505,7 +505,7 @@ static void apply_selection(char *selection)
     }
 
     /* Deal with the specific case of 'all' pseudo serie */
-    if (!strcmp("all", suitename)) {
+    if (not strcmp("all", suitename)) {
       xbt_assert(unitname[0] == '\0', "The 'all' pseudo-suite does not accept any unit specification\n");
 
       xbt_dynar_foreach(_xbt_test_suites, it_suite, suite) {
@@ -519,7 +519,7 @@ static void apply_selection(char *selection)
       for (it = 0; it < xbt_dynar_length(_xbt_test_suites); it++) {
         xbt_test_suite_t thissuite =
             xbt_dynar_get_as(_xbt_test_suites, it, xbt_test_suite_t);
-        if (!strcmp(suitename, thissuite->name)) {
+        if (not strcmp(suitename, thissuite->name)) {
           /* Do not disable the whole suite when we just want to disable a child */
           if (enabling || (unitname[0] == '\0'))
             thissuite->enabled = enabling;
@@ -535,7 +535,7 @@ static void apply_selection(char *selection)
                  it2_unit < xbt_dynar_length(thissuite->units);
                  it2_unit++) {
               xbt_test_unit_t thisunit = xbt_dynar_get_as(thissuite->units, it2_unit, xbt_test_unit_t);
-              if (!strcmp(thisunit->name, unitname)) {
+              if (not strcmp(thisunit->name, unitname)) {
                 thisunit->enabled = enabling;
                 break;
               }