SplitListMap refactoring
[libcds.git] / tests / test-hdr / map / hdr_splitlist_map_nogc.cpp
index 537893f10561e70735f3af90c5e8e78a98311b4e..4ba4f6a6dff2d462fb522ec4ae4d6df7b762453b 100644 (file)
@@ -7,7 +7,7 @@
 namespace map {
 
     namespace {
-        struct nogc_cmp_traits: public cc::split_list::type_traits
+        struct nogc_cmp_traits: public cc::split_list::traits
         {
             typedef cc::michael_list_tag                ordered_list;
             typedef HashMapHdrTest::hash_int            hash;
@@ -15,13 +15,13 @@ namespace map {
             typedef cc::opt::v::relaxed_ordering        memory_model;
             enum { dynamic_bucket_table = false };
 
-            struct ordered_list_traits: public cc::michael_list::type_traits
+            struct ordered_list_traits: public cc::michael_list::traits
             {
                 typedef HashMapHdrTest::cmp   compare;
             };
         };
 
-        struct nogc_less_traits: public cc::split_list::type_traits
+        struct nogc_less_traits: public cc::split_list::traits
         {
             typedef cc::michael_list_tag                ordered_list;
             typedef HashMapHdrTest::hash_int            hash;
@@ -29,24 +29,29 @@ namespace map {
             typedef cc::opt::v::sequential_consistent                      memory_model;
             enum { dynamic_bucket_table = false };
 
-            struct ordered_list_traits: public cc::michael_list::type_traits
+            struct ordered_list_traits: public cc::michael_list::traits
             {
                 typedef HashMapHdrTest::less   less;
             };
         };
 
-        struct nogc_cmpmix_traits: public cc::split_list::type_traits
+        struct nogc_cmpmix_traits: public cc::split_list::traits
         {
             typedef cc::michael_list_tag                ordered_list;
             typedef HashMapHdrTest::hash_int            hash;
             typedef HashMapHdrTest::simple_item_counter item_counter;
 
-            struct ordered_list_traits: public cc::michael_list::type_traits
+            struct ordered_list_traits: public cc::michael_list::traits
             {
                 typedef HashMapHdrTest::cmp   compare;
                 typedef std::less<HashMapHdrTest::key_type>     less;
             };
         };
+
+        struct nogc_cmpmix_stat_traits : public nogc_cmpmix_traits
+        {
+            typedef cc::split_list::stat<> stat;
+        };
     }
 
     void HashMapHdrTest::Split_nogc_cmp()
@@ -115,6 +120,7 @@ namespace map {
                 cc::split_list::ordered_list<cc::michael_list_tag>
                 ,cc::opt::hash< hash_int >
                 ,cc::opt::item_counter< simple_item_counter >
+                , cc::opt::stat< cc::split_list::empty_stat >
                 ,cc::split_list::ordered_list_traits<
                     cc::michael_list::make_traits<
                     cc::opt::less< std::less<key_type> >
@@ -126,6 +132,31 @@ namespace map {
         test_int_nogc< opt_map >();
     }
 
+    void HashMapHdrTest::Split_nogc_cmpmix_stat()
+    {
+        // traits-based version
+        typedef cc::SplitListMap< cds::gc::nogc, key_type, value_type, nogc_cmpmix_stat_traits > map_type;
+        test_int_nogc< map_type >();
+
+        // option-based version
+        typedef cc::SplitListMap< cds::gc::nogc,
+            key_type,
+            value_type,
+            cc::split_list::make_traits<
+                cc::split_list::ordered_list<cc::michael_list_tag>
+                ,cc::opt::hash< hash_int >
+                ,cc::opt::item_counter< simple_item_counter >
+                ,cc::opt::stat< cc::split_list::stat<> >
+                ,cc::split_list::ordered_list_traits<
+                    cc::michael_list::make_traits<
+                    cc::opt::less< std::less<key_type> >
+                        ,cc::opt::compare< cmp >
+                    >::type
+                >
+            >::type
+        > opt_map;
+        test_int_nogc< opt_map >();
+    }
 
 } // namespace map