Added hash_size option support to FeldmanHashMap
[libcds.git] / test / unit / map / feldman_hashmap_dhp.cpp
index aa58903e3e2e8b834e3c49a3695ca46de9927912..c40613c611464e6e2cc2bfca1655e84eeb8101c4 100644 (file)
@@ -129,4 +129,23 @@ namespace {
         test( m );
     }
 
+    TEST_F( FeldmanHashMap_DHP, explicit_key_size )
+    {
+        struct map_traits: public cc::feldman_hashmap::traits
+        {
+            enum: size_t {
+                hash_size = sizeof( int ) + sizeof( uint16_t )
+            };
+            typedef hash2 hash;
+            typedef less2 less;
+            typedef cc::feldman_hashmap::stat<> stat;
+        };
+        typedef cc::FeldmanHashMap< gc_type, key_type2, value_type, map_traits > map_type;
+
+        map_type m( 5, 3 );
+        EXPECT_EQ( m.head_size(), static_cast<size_t>(1 << 6) );
+        EXPECT_EQ( m.array_node_size(), static_cast<size_t>(1 << 3) );
+        test( m );
+    }
+
 } // namespace