stress-test set/map: use hash_size option for FeldmanHashSet/Map
authorkhizmax <libcds.dev@gmail.com>
Sun, 13 Nov 2016 20:19:15 +0000 (23:19 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sun, 13 Nov 2016 20:19:15 +0000 (23:19 +0300)
test/stress/map/delodd/map_delodd.h
test/stress/map/delodd/map_delodd_feldman_hashmap.cpp
test/stress/map/map_type_feldman_hashmap.h
test/stress/set/delodd/set_delodd.h
test/stress/set/delodd/set_delodd_feldman_hashset.cpp
test/stress/set/set_type_feldman_hashset.h

index e2ea79a..af0c76d 100644 (file)
@@ -37,18 +37,15 @@ namespace map {
         {
             uint32_t  nKey;
             uint16_t  nThread;
-            uint16_t  pad_;
 
             key_thread( size_t key, size_t threadNo )
                 : nKey( static_cast<uint32_t>(key))
                 , nThread( static_cast<uint16_t>(threadNo))
-                , pad_(0)
             {}
 
             key_thread()
                 : nKey()
                 , nThread()
-                , pad_( 0 )
             {}
         };
 
index 55ca039..9e2e3dd 100644 (file)
 
 namespace map {
 
-    CDSSTRESS_FeldmanHashMap_fixed( Map_DelOdd, run_test_extract, key_thread, size_t )
+    namespace {
+        class Map_DelOdd2: public map::Map_DelOdd {
+        public:
+            template <typename Map>
+            void run()
+            {
+                typedef typename Map::traits original_traits;
+                struct traits: public original_traits {
+                    enum { hash_size = sizeof( uint32_t ) + sizeof( uint16_t ) };
+                };
+                typedef typename Map::template rebind_traits< traits >::result map_type;
+
+                run_test_extract<map_type>();
+            }
+        };
+
+        CDSSTRESS_FeldmanHashMap_fixed( Map_DelOdd2, run, key_thread, size_t )
+    }
 
 } // namespace map
index 7758640..674b9ac 100644 (file)
@@ -47,6 +47,12 @@ namespace map {
     {
         typedef cc::FeldmanHashMap< GC, Key, T, Traits > base_class;
     public:
+
+        template <typename OtherTraits>
+        struct rebind_traits {
+            typedef FeldmanHashMap<GC, Key, T, OtherTraits > result;
+        };
+
         template <typename Config>
         FeldmanHashMap( Config const& cfg)
             : base_class( cfg.s_nFeldmanMap_HeadBits, cfg.s_nFeldmanMap_ArrayBits )
index 03bb671..72c0c4c 100644 (file)
@@ -36,18 +36,15 @@ namespace set {
     {
         uint32_t  nKey;
         uint16_t  nThread;
-        uint16_t  pad_;
 
         key_thread( size_t key, size_t threadNo )
             : nKey( static_cast<uint32_t>(key))
             , nThread( static_cast<uint16_t>(threadNo))
-            , pad_(0)
         {}
 
         key_thread()
             : nKey()
             , nThread()
-            , pad_( 0 )
         {}
     };
 
index 6fd7e34..2d09f3c 100644 (file)
 
 namespace set {
 
-    CDSSTRESS_FeldmanHashSet_fixed( Set_DelOdd, run_test_extract, key_thread, size_t )
+    namespace {
+        class Set_DelOdd2: public set::Set_DelOdd
+        {
+        public:
+            template <typename Set>
+            void run()
+            {
+                typedef typename Set::traits original_traits;
+                struct traits: public original_traits
+                {
+                    enum { hash_size = sizeof(uint32_t) + sizeof(uint16_t) };
+                };
+
+                typedef typename Set::template rebind_traits< traits >::result set_type;
+                run_test_extract< set_type >();
+            }
+        };
+
+        CDSSTRESS_FeldmanHashSet_fixed( Set_DelOdd2, run, key_thread, size_t )
+    }
 
 } // namespace set
index 44c3ddf..ab20e1f 100644 (file)
@@ -63,6 +63,11 @@ namespace set {
         typedef typename T::hasher hasher;
         typedef typename get_extracted_ptr<GC>::extracted_ptr extracted_ptr;
 
+        template <typename OtherTraits>
+        struct rebind_traits {
+            typedef FeldmanHashSet<GC, T, OtherTraits > result;
+        };
+
         template <class Config>
         FeldmanHashSet( Config const& cfg )
             : base_class( cfg.s_nFeldmanSet_HeadBits, cfg.s_nFeldmanSet_ArrayBits )