Fixes misc test cases
[libcds.git] / test / stress / misc / deque_driver.cpp
index da84edb..e49b4a7 100644 (file)
@@ -54,15 +54,15 @@ protected:
         }
       }
     }
         }
       }
     }
-    //    while (true) {
-    //      int res = deque->take();
-    //      if (res != EMPTY) {
-    //        sums[index] += res;
-    //        succ_counts[index]++;
-    //      } else {
-    //        break;
-    //      }
-    //    }
+    while (true) {
+      int res = deque->take();
+      if (res != EMPTY) {
+        sums[index] += res;
+        succ_counts[index]++;
+      } else {
+        break;
+      }
+    }
   }
 };
 
   }
 };
 
@@ -103,10 +103,13 @@ TEST_F(ChaseLevDequeTest, DequePushPopTake) {
     received_sum += sums[i];
     overall_count += succ_counts[i];
   }
     received_sum += sums[i];
     overall_count += succ_counts[i];
   }
-  cout << "Sum of push: " << push_sum << "\n";
-  cout << "Received sum:" << received_sum << "\n";
-  cout << "overall_count:" << overall_count << "\n";
-  cout << "push_count=" << push_count << "\n";
+  if (overall_count != push_count || received_sum != push_sum) {
+    cout << "Incorrect deque\n";
+    cout << "Push sum: " << push_sum << "\n";
+    cout << "Received sum:" << received_sum << "\n";
+    cout << "Push count=" << push_count << "\n";
+    cout << "Received count:" << overall_count << "\n";
+  }
 }
 
 } // namespace
 }
 
 } // namespace