-#include <junction/ConcurrentMap_Crude.h>
-#include <junction/ConcurrentMap_Grampa.h>
-#include <junction/ConcurrentMap_Leapfrog.h>
-#include <junction/ConcurrentMap_Linear.h>
-
-#include <cds_test/stress_test.h>
-#include <cds_test/stress_test_util.h>
-
-#include <algorithm>
-#include <iostream>
-#include <memory>
-#include <random>
-#include <thread>
+#include "test.h"
namespace junction_test {
class JunctionMapInsDelFindTest_Parallel : public cds_test::stress_fixture {
protected:
- typedef junction::ConcurrentMap_Grampa<size_t, size_t> GrampaMap;
- typedef junction::ConcurrentMap_Linear<size_t, size_t> LinearMap;
- typedef junction::ConcurrentMap_Leapfrog<size_t, size_t> LeapfrogMap;
- typedef junction::ConcurrentMap_Crude<size_t, size_t> CrudeMap;
-
static unsigned s_nInsertPercentage;
static unsigned s_nDeletePercentage;
static size_t s_nGCFrequency; // Run GC after "s_nGCFrequency" operations.
GetConfigNonZeroExpected(LeapfrogPassCount, 850000000);
}
- template <typename Map, typename Key, typename Value>
- static bool map_insert(Map* map, Key key, Value value) {
- auto iter = map->insertOrFind(key);
- if (!iter.getValue() || iter.getValue() != value) {
- // Insert/update the <key,value> pair
- iter.assignValue(value);
- return true;
- } else {
- return false;
- }
- }
-
- template <typename Map, typename Key>
- static bool map_delete(Map* map, Key key) {
- auto iter = map->find(key);
- if (iter.getValue()) {
- iter.eraseValue();
- return true;
- } else {
- return false;
- }
- }
-
- template <typename Map, typename Key>
- 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 <typename Key, typename Value>
- 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 <typename Key> static bool map_delete(CrudeMap* map, Key key) {
- if (!map->get(key)) {
- map->assign(key, ((Key)0));
- return true;
- } else {
- return false;
- }
- }
-
- template <typename Key> static bool map_find(CrudeMap* map, Key key) {
- return map->get(key) != ((Key)0);
- }
-
template <typename Map> static void run_test(Map* map, size_t pass_count) {
auto qsbrContext = junction::DefaultQSBR.createContext();
}
} // 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;
-}