X-Git-Url: http://plrg.eecs.uci.edu/git/?p=junction.git;a=blobdiff_plain;f=test%2Fjunction_parallel_driver.cpp;h=dd1bda270bac8bf6647901fbe930a85958a11637;hp=b6f74f6fb2213d327ae68250ae7ba58e93778290;hb=b2483eaa1c48b4bb4ecae3539f57adad89535d03;hpb=a5c4f9abb37cd877dbb7be486657e9dca281274d diff --git a/test/junction_parallel_driver.cpp b/test/junction_parallel_driver.cpp index b6f74f6..dd1bda2 100644 --- a/test/junction_parallel_driver.cpp +++ b/test/junction_parallel_driver.cpp @@ -1,26 +1,9 @@ -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include +#include "test.h" namespace junction_test { class JunctionMapInsDelFindTest_Parallel : public cds_test::stress_fixture { protected: - typedef junction::ConcurrentMap_Grampa GrampaMap; - typedef junction::ConcurrentMap_Linear LinearMap; - typedef junction::ConcurrentMap_Leapfrog LeapfrogMap; - typedef junction::ConcurrentMap_Crude CrudeMap; - static unsigned s_nInsertPercentage; static unsigned s_nDeletePercentage; static size_t s_nGCFrequency; // Run GC after "s_nGCFrequency" operations. @@ -71,64 +54,6 @@ protected: GetConfigNonZeroExpected(LeapfrogPassCount, 850000000); } - template - static bool map_insert(Map* map, Key key, Value value) { - auto iter = map->insertOrFind(key); - if (!iter.getValue() || iter.getValue() != value) { - // Insert/update the pair - iter.assignValue(value); - return true; - } else { - return false; - } - } - - template - static bool map_delete(Map* map, Key key) { - auto iter = map->find(key); - if (iter.getValue()) { - iter.eraseValue(); - return true; - } else { - return false; - } - } - - template - static bool map_find(Map* map, Key key) { - auto iter = map->find(key); - if (iter.getValue()) { - return true; - } else { - return false; - } - } - - // Specialization for CrudeMap - template - static bool map_insert(CrudeMap* map, Key key, Value value) { - auto old_val = map->get(key); - if (!old_val || old_val != value) { - map->assign(key, value); - return true; - } else { - return false; - } - } - - template static bool map_delete(CrudeMap* map, Key key) { - if (!map->get(key)) { - map->assign(key, ((Key)0)); - return true; - } else { - return false; - } - } - - template static bool map_find(CrudeMap* map, Key key) { - return map->get(key) != ((Key)0); - } - template static void run_test(Map* map, size_t pass_count) { auto qsbrContext = junction::DefaultQSBR.createContext(); @@ -221,13 +146,3 @@ TEST_F(JunctionMapInsDelFindTest_Parallel, JunctionMapGrampa) { } } // namespace junction_test - -int main(int argc, char** argv) { - // Read test config file - cds_test::init_config(argc, argv); - - // Init Google test - ::testing::InitGoogleTest(&argc, argv); - int result = RUN_ALL_TESTS(); - return result; -}