Refactors test cases to use gtest
[junction.git] / test / junction_parallel_driver.cpp
index 4fe6d29ac2c538ab1e5822b3a8e1b345c2d5b48b..b9f5d8f07e82f094b007f3b540ea6508dc128a33 100644 (file)
@@ -6,15 +6,12 @@
 #include <gtest/gtest.h>
 
 #include <algorithm>
-#include <cassert>
-#include <chrono>
-#include <iostream>
 #include <memory>
 #include <random>
 
 namespace junction_test {
 
-class JunctionMapInsDelFindTest : public ::testing::Test {
+class JunctionMapInsDelFindTest_Parallel : public ::testing::Test {
 protected:
   typedef junction::ConcurrentMap_Grampa<size_t, size_t> GrampaMap;
   typedef junction::ConcurrentMap_Linear<size_t, size_t> LinearMap;
@@ -112,8 +109,7 @@ protected:
     return map->get(key) != ((Key)0);
   }
 
-  template <typename Map>
-  void run_test(Map* map, size_t pass_count) {
+  template <typename Map> void run_test(Map* map, size_t pass_count) {
     auto qsbrContext = junction::DefaultQSBR.createContext();
 
     std::random_device rd;
@@ -162,28 +158,28 @@ protected:
   }
 };
 
-const unsigned JunctionMapInsDelFindTest::s_nInsertPercentage;
-const unsigned JunctionMapInsDelFindTest::s_nDeletePercentage;
-const unsigned int JunctionMapInsDelFindTest::kShuffleSize;
-JunctionMapInsDelFindTest::actions JunctionMapInsDelFindTest::s_arrShuffle
-    [JunctionMapInsDelFindTest::kShuffleSize];
+const unsigned JunctionMapInsDelFindTest_Parallel::s_nInsertPercentage;
+const unsigned JunctionMapInsDelFindTest_Parallel::s_nDeletePercentage;
+const unsigned int JunctionMapInsDelFindTest_Parallel::kShuffleSize;
+JunctionMapInsDelFindTest_Parallel::actions JunctionMapInsDelFindTest_Parallel::
+    s_arrShuffle[JunctionMapInsDelFindTest_Parallel::kShuffleSize];
 
-TEST_F(JunctionMapInsDelFindTest, JunctionMapCrude) {
+TEST_F(JunctionMapInsDelFindTest_Parallel, JunctionMapCrude) {
   std::unique_ptr<CrudeMap> map(new CrudeMap(kMapSize * 32));
   run_test(map.get(), kCrudePassCount);
 }
 
-TEST_F(JunctionMapInsDelFindTest, JunctionMapLeapfrog) {
+TEST_F(JunctionMapInsDelFindTest_Parallel, JunctionMapLeapfrog) {
   std::unique_ptr<LeapfrogMap> map(new LeapfrogMap());
   run_test(map.get(), kLeapfrogPassCount);
 }
 
-TEST_F(JunctionMapInsDelFindTest, JunctionMapLinear) {
+TEST_F(JunctionMapInsDelFindTest_Parallel, JunctionMapLinear) {
   std::unique_ptr<LinearMap> map(new LinearMap());
   run_test(map.get(), kLinearPassCount);
 }
 
-TEST_F(JunctionMapInsDelFindTest, JunctionMapGrampa) {
+TEST_F(JunctionMapInsDelFindTest_Parallel, JunctionMapGrampa) {
   std::unique_ptr<GrampaMap> map(new GrampaMap());
   run_test(map.get(), kGrampaPassCount);
 }
@@ -194,5 +190,5 @@ int main(int argc, char** argv) {
   // Init Google test
   ::testing::InitGoogleTest(&argc, argv);
   int result = RUN_ALL_TESTS();
-  return 0;
+  return result;
 }