intrusive::SplitListSet refactoring
[libcds.git] / tests / test-hdr / set / hdr_intrusive_splitlist_set_rcu_sht.cpp
index a82dc518786e27572ace2e99fa1c5a400ea34658..8bf2323d0d938437c1ad005a63d8829e74364d13 100644 (file)
@@ -32,7 +32,7 @@ namespace set {
                 ,co::memory_model<co::v::relaxed_ordering>
             >::type
         > set;
-        static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
+        static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
 
         test_rcu_int<set>();
 #endif
@@ -57,7 +57,7 @@ namespace set {
                 ,co::memory_model<co::v::sequential_consistent>
             >::type
         > set;
-        static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
+        static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
 
         test_rcu_int<set>();
 #endif
@@ -84,7 +84,7 @@ namespace set {
                 ,ci::split_list::dynamic_bucket_table<true>
             >::type
         > set;
-        static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
+        static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
 
         test_rcu_int<set>();
 #endif
@@ -111,7 +111,7 @@ namespace set {
                 co::hash< hash_int >
             >::type
         > set;
-        static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
+        static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
 
         test_rcu_int<set>();
 #endif
@@ -139,7 +139,7 @@ namespace set {
                 ,co::memory_model<co::v::relaxed_ordering>
             >::type
         > set;
-        static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
+        static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
 
         test_rcu_int<set>();
 #endif
@@ -169,7 +169,7 @@ namespace set {
                 ,co::memory_model<co::v::sequential_consistent>
             >::type
         > set;
-        static_assert( set::options::dynamic_bucket_table, "Set has static bucket table" );
+        static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
 
         test_rcu_int<set>();
 #endif
@@ -197,7 +197,7 @@ namespace set {
                 ,co::memory_model<co::v::relaxed_ordering>
             >::type
         > set;
-        static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
+        static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
 
         test_rcu_int<set>();
 #endif
@@ -223,7 +223,7 @@ namespace set {
                 ,co::memory_model<co::v::sequential_consistent>
             >::type
         > set;
-        static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
+        static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
 
         test_rcu_int<set>();
 #endif
@@ -250,7 +250,7 @@ namespace set {
                 ,ci::split_list::dynamic_bucket_table<false>
             >::type
         > set;
-        static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
+        static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
 
         test_rcu_int<set>();
 #endif
@@ -279,7 +279,7 @@ namespace set {
                 ,co::memory_model<co::v::relaxed_ordering>
             >::type
         > set;
-        static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
+        static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
 
         test_rcu_int<set>();
 #endif
@@ -308,7 +308,7 @@ namespace set {
                 ,co::memory_model<co::v::sequential_consistent>
             >::type
         > set;
-        static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
+        static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
 
         test_rcu_int<set>();
 #endif
@@ -338,7 +338,125 @@ namespace set {
                 ,ci::split_list::dynamic_bucket_table<false>
             >::type
         > set;
-        static_assert( !set::options::dynamic_bucket_table, "Set has dynamic bucket table" );
+        static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
+
+        test_rcu_int<set>();
+#endif
+    }
+
+    void IntrusiveHashSetHdrTest::split_dyn_RCU_SHT_base_cmpmix_stat()
+    {
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+        typedef base_int_item< ci::split_list::node<ci::michael_list::node<rcu_type> > > item;
+        struct list_traits : public ci::michael_list::traits
+        {
+            typedef ci::michael_list::base_hook< co::gc<rcu_type> > hook;
+            typedef IntrusiveHashSetHdrTest::less<item> less;
+            typedef cmp<item> compare;
+            typedef faked_disposer disposer;
+        };
+        typedef ci::MichaelList< rcu_type, item, list_traits > ord_list;
+
+        struct set_traits : public ci::split_list::make_traits<ci::split_list::dynamic_bucket_table<true> >::type
+        {
+            typedef hash_int hash;
+            typedef simple_item_counter item_counter;
+            typedef ci::split_list::stat<> stat;
+        };
+        typedef ci::SplitListSet< rcu_type, ord_list, set_traits > set;
+
+        static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
+
+        test_rcu_int<set>();
+#endif
+    }
+
+    void IntrusiveHashSetHdrTest::split_dyn_RCU_SHT_member_cmpmix_stat()
+    {
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+        typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
+        struct list_traits :
+            public ci::michael_list::make_traits<
+                ci::opt::hook< ci::michael_list::member_hook<
+                    offsetof( item, hMember ),
+                    co::gc<rcu_type>
+                > >
+                ,co::compare< cmp<item> >
+                ,co::less< less<item> >
+                ,ci::opt::disposer< faked_disposer >
+            >::type
+        {};
+        typedef ci::MichaelList< rcu_type, item, list_traits > ord_list;
+
+        struct set_traits :
+            public ci::split_list::make_traits<
+                co::hash< hash_int >
+                ,co::item_counter< simple_item_counter >
+                ,co::memory_model<co::v::sequential_consistent>
+                ,co::stat< ci::split_list::stat<>>
+            >::type
+        {};
+        typedef ci::SplitListSet< rcu_type, ord_list, set_traits > set;
+        static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
+
+        test_rcu_int<set>();
+#endif
+    }
+
+    void IntrusiveHashSetHdrTest::split_st_RCU_SHT_base_cmpmix_stat()
+    {
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+        typedef base_int_item< ci::split_list::node<ci::michael_list::node<rcu_type> > > item;
+        typedef ci::MichaelList< rcu_type
+            ,item
+            ,ci::michael_list::make_traits<
+                ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
+                ,co::less< less<item> >
+                ,co::compare< cmp<item> >
+                ,ci::opt::disposer< faked_disposer >
+            >::type
+        >    ord_list;
+
+        typedef ci::SplitListSet< rcu_type, ord_list,
+            ci::split_list::make_traits<
+                co::hash< hash_int >
+                ,co::item_counter< simple_item_counter >
+                ,ci::split_list::dynamic_bucket_table<false>
+                ,co::stat< ci::split_list::stat<>>
+            >::type
+        > set;
+        static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
+
+        test_rcu_int<set>();
+#endif
+    }
+
+    void IntrusiveHashSetHdrTest::split_st_RCU_SHT_member_cmpmix_stat()
+    {
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+        typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
+        typedef ci::MichaelList< rcu_type
+            ,item
+            ,ci::michael_list::make_traits<
+                ci::opt::hook< ci::michael_list::member_hook<
+                    offsetof( item, hMember ),
+                    co::gc<rcu_type>
+                > >
+                ,co::compare< cmp<item> >
+                ,co::less< less<item> >
+                ,ci::opt::disposer< faked_disposer >
+            >::type
+        >    ord_list;
+
+        typedef ci::SplitListSet< rcu_type, ord_list,
+            ci::split_list::make_traits<
+                co::hash< hash_int >
+                ,co::item_counter< simple_item_counter >
+                ,ci::split_list::dynamic_bucket_table<false>
+                ,co::stat< ci::split_list::stat<> >
+            >::type
+        > set;
+        static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
 
         test_rcu_int<set>();
 #endif