From: Peizhao Ou Date: Fri, 9 Feb 2018 08:46:01 +0000 (-0800) Subject: Refactors test cases to use gtest X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5b4dbc703dbd0cae064e5ded283614858b46e85a;p=junction.git Refactors test cases to use gtest --- diff --git a/test/junction_parallel_driver.cpp b/test/junction_parallel_driver.cpp index 4fe6d29..b9f5d8f 100644 --- a/test/junction_parallel_driver.cpp +++ b/test/junction_parallel_driver.cpp @@ -6,15 +6,12 @@ #include #include -#include -#include -#include #include #include namespace junction_test { -class JunctionMapInsDelFindTest : public ::testing::Test { +class JunctionMapInsDelFindTest_Parallel : public ::testing::Test { protected: typedef junction::ConcurrentMap_Grampa GrampaMap; typedef junction::ConcurrentMap_Linear LinearMap; @@ -112,8 +109,7 @@ protected: return map->get(key) != ((Key)0); } - template - void run_test(Map* map, size_t pass_count) { + template 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 map(new CrudeMap(kMapSize * 32)); run_test(map.get(), kCrudePassCount); } -TEST_F(JunctionMapInsDelFindTest, JunctionMapLeapfrog) { +TEST_F(JunctionMapInsDelFindTest_Parallel, JunctionMapLeapfrog) { std::unique_ptr map(new LeapfrogMap()); run_test(map.get(), kLeapfrogPassCount); } -TEST_F(JunctionMapInsDelFindTest, JunctionMapLinear) { +TEST_F(JunctionMapInsDelFindTest_Parallel, JunctionMapLinear) { std::unique_ptr map(new LinearMap()); run_test(map.get(), kLinearPassCount); } -TEST_F(JunctionMapInsDelFindTest, JunctionMapGrampa) { +TEST_F(JunctionMapInsDelFindTest_Parallel, JunctionMapGrampa) { std::unique_ptr 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; } diff --git a/test/junction_sequential_driver.cpp b/test/junction_sequential_driver.cpp index d016438..f7779e4 100644 --- a/test/junction_sequential_driver.cpp +++ b/test/junction_sequential_driver.cpp @@ -1,14 +1,12 @@ -#include -#include -#include #include #include #include #include -#include #include +#include + namespace junction_test { class JunctionMapInsDelFindTest : public ::testing::Test {