MultiLevelHashSet test, bugfixing
[libcds.git] / tests / test-hdr / set / hdr_multilevel_hashset_dhp.cpp
index 9e089e01ad9cef23107023a0bfd64a0df3d57604..02989fda8c37082c3e7129b3ff77ad3df6d6dc8f 100644 (file)
@@ -9,6 +9,28 @@ namespace set {
         typedef cds::gc::DHP gc_type;
     } // namespace
 
+    void MultiLevelHashSetHdrTest::dhp_nohash()
+    {
+        typedef size_t key_type;
+
+        struct traits : public cc::multilevel_hashset::traits
+        {
+            typedef get_key<key_type> hash_accessor;
+        };
+        typedef cc::MultiLevelHashSet< gc_type, Item<key_type>, traits > set_type;
+        static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!");
+        test_hp<set_type, nohash<key_type>>(4, 2);
+
+        typedef cc::MultiLevelHashSet<
+            gc_type,
+            Item<key_type>,
+            typename cc::multilevel_hashset::make_traits<
+                cc::multilevel_hashset::hash_accessor< get_key<key_type>>
+            >::type
+        > set_type2;
+        test_hp<set_type2, nohash<key_type>>(4, 2);
+    }
+
     void MultiLevelHashSetHdrTest::dhp_stdhash()
     {
         typedef size_t hash_type;
@@ -55,6 +77,30 @@ namespace set {
         test_hp<set_type2, hash128::make>(4, 2);
     }
 
+    void MultiLevelHashSetHdrTest::dhp_nohash_stat()
+    {
+        typedef size_t key_type;
+
+        struct traits : public cc::multilevel_hashset::traits
+        {
+            typedef get_key<key_type> hash_accessor;
+            typedef cc::multilevel_hashset::stat<> stat;
+        };
+        typedef cc::MultiLevelHashSet< gc_type, Item<key_type>, traits > set_type;
+        static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!");
+        test_hp<set_type, nohash<key_type>>(4, 2);
+
+        typedef cc::MultiLevelHashSet<
+            gc_type,
+            Item<key_type>,
+            typename cc::multilevel_hashset::make_traits<
+                cc::multilevel_hashset::hash_accessor< get_key<key_type>>
+                , co::stat< cc::multilevel_hashset::stat<>>
+            >::type
+        > set_type2;
+        test_hp<set_type2, nohash<key_type>>(4, 2);
+    }
+
     void MultiLevelHashSetHdrTest::dhp_stdhash_stat()
     {
         typedef size_t hash_type;
@@ -105,6 +151,28 @@ namespace set {
         test_hp<set_type2, hash_type::make>(4, 2);
     }
 
+    void MultiLevelHashSetHdrTest::dhp_nohash_5_3()
+    {
+        typedef size_t key_type;
+
+        struct traits: public cc::multilevel_hashset::traits
+        {
+            typedef get_key<key_type> hash_accessor;
+        };
+        typedef cc::MultiLevelHashSet< gc_type, Item<key_type>, traits > set_type;
+        static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
+        test_hp<set_type, nohash<key_type>>(5, 3);
+
+        typedef cc::MultiLevelHashSet<
+            gc_type,
+            Item<key_type>,
+            typename cc::multilevel_hashset::make_traits<
+                cc::multilevel_hashset::hash_accessor< get_key<key_type>>
+            >::type
+        > set_type2;
+        test_hp<set_type2, nohash<key_type>>(5, 3);
+    }
+
     void MultiLevelHashSetHdrTest::dhp_stdhash_5_3()
     {
         typedef size_t hash_type;
@@ -151,6 +219,30 @@ namespace set {
         test_hp<set_type2, hash128::make >(4, 3);
     }
 
+    void MultiLevelHashSetHdrTest::dhp_nohash_5_3_stat()
+    {
+        typedef size_t key_type;
+
+        struct traits: public cc::multilevel_hashset::traits
+        {
+            typedef get_key<key_type> hash_accessor;
+            typedef cc::multilevel_hashset::stat<> stat;
+        };
+        typedef cc::MultiLevelHashSet< gc_type, Item<key_type>, traits > set_type;
+        static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
+        test_hp<set_type, nohash<key_type>>(5, 3);
+
+        typedef cc::MultiLevelHashSet<
+            gc_type,
+            Item<key_type>,
+            typename cc::multilevel_hashset::make_traits<
+                cc::multilevel_hashset::hash_accessor< get_key<key_type>>
+                ,co::stat< cc::multilevel_hashset::stat<>>
+            >::type
+        > set_type2;
+        test_hp<set_type2, nohash<key_type>>(5, 3);
+    }
+
     void MultiLevelHashSetHdrTest::dhp_stdhash_5_3_stat()
     {
         typedef size_t hash_type;
@@ -203,4 +295,5 @@ namespace set {
         test_hp<set_type2, hash_type::make>(4, 3);
     }
 
+
 } // namespace set