X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=test%2Funit%2Fintrusive-set%2Ftest_intrusive_split_lazy_rcu.h;h=73e5416273557b3ddd1fa42195bcc0c83dad08c9;hb=6924946ceeaae28bc227fe7c9d8e939963bb9d69;hp=33ab6fd502efc89a76bb4fedcf2493b843c0a754;hpb=7448008aa977fe42a83738fbbc63ce11d8ab86f9;p=libcds.git diff --git a/test/unit/intrusive-set/test_intrusive_split_lazy_rcu.h b/test/unit/intrusive-set/test_intrusive_split_lazy_rcu.h index 33ab6fd5..73e54162 100644 --- a/test/unit/intrusive-set/test_intrusive_split_lazy_rcu.h +++ b/test/unit/intrusive-set/test_intrusive_split_lazy_rcu.h @@ -1,11 +1,11 @@ /* This file is a part of libcds - Concurrent Data Structures library - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017 Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CDSUNIT_SET_TEST_INTRUSIVE_SPLIT_LAZY_RCU_H #define CDSUNIT_SET_TEST_INTRUSIVE_SPLIT_LAZY_RCU_H @@ -33,6 +33,7 @@ #include "test_intrusive_set_rcu.h" #include #include +#include namespace ci = cds::intrusive; @@ -68,14 +69,14 @@ TYPED_TEST_P( IntrusiveSplitLazySet, base_cmp ) typedef typename TestFixture::rcu_type rcu_type; typedef typename TestFixture::base_item_type base_item_type; typedef typename TestFixture::mock_disposer mock_disposer; - typedef typename TestFixture::template cmp cmp; + typedef typename TestFixture::template cmp item_cmp; typedef typename TestFixture::hash_int hash_int; typedef ci::LazyList< rcu_type , base_item_type , typename ci::lazy_list::make_traits< ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< rcu_type > > > - , ci::opt::compare< cmp > + , ci::opt::compare< item_cmp > , ci::opt::disposer< mock_disposer > >::type > bucket_type; @@ -95,14 +96,14 @@ TYPED_TEST_P( IntrusiveSplitLazySet, base_less ) typedef typename TestFixture::rcu_type rcu_type; typedef typename TestFixture::base_item_type base_item_type; typedef typename TestFixture::mock_disposer mock_disposer; - typedef typename TestFixture::template less less; + typedef typename TestFixture::template less item_less; typedef typename TestFixture::hash_int hash_int; typedef ci::LazyList< rcu_type , base_item_type , typename ci::lazy_list::make_traits< ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< rcu_type >>> - , ci::opt::less< less > + , ci::opt::less< item_less > , ci::opt::disposer< mock_disposer > >::type > bucket_type; @@ -174,13 +175,102 @@ TYPED_TEST_P( IntrusiveSplitLazySet, base_mutex ) this->test( s ); } +TYPED_TEST_P( IntrusiveSplitLazySet, base_static_bucket_table ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::base_item_type base_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::hash_int hash_int; + + struct list_traits: public ci::lazy_list::traits + { + typedef ci::lazy_list::base_hook< ci::opt::gc> hook; + typedef typename TestFixture::template less less; + typedef typename TestFixture::template cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< rcu_type, base_item_type, list_traits > bucket_type; + + struct set_traits: public ci::split_list::traits + { + typedef hash_int hash; + typedef typename TestFixture::simple_item_counter item_counter; + typedef ci::split_list::stat<> stat; + enum { + dynamic_bucket_table = false + }; + }; + typedef ci::SplitListSet< rcu_type, bucket_type, set_traits > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitLazySet, base_static_bucket_table_free_list ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::base_item_type base_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::hash_int hash_int; + + struct list_traits: public ci::lazy_list::traits + { + typedef ci::lazy_list::base_hook< ci::opt::gc> hook; + typedef typename TestFixture::template less less; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< rcu_type, base_item_type, list_traits > bucket_type; + + struct set_traits: public ci::split_list::traits + { + typedef hash_int hash; + typedef typename TestFixture::simple_item_counter item_counter; + typedef ci::split_list::stat<> stat; + enum { + dynamic_bucket_table = false + }; + typedef ci::FreeList free_list; + }; + typedef ci::SplitListSet< rcu_type, bucket_type, set_traits > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitLazySet, base_free_list ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::base_item_type base_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::hash_int hash_int; + + struct list_traits: public ci::lazy_list::traits + { + typedef ci::lazy_list::base_hook< ci::opt::gc> hook; + typedef typename TestFixture::template cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< rcu_type, base_item_type, list_traits > bucket_type; + + struct set_traits: public ci::split_list::traits + { + typedef hash_int hash; + typedef typename TestFixture::simple_item_counter item_counter; + typedef ci::split_list::stat<> stat; + typedef ci::FreeList free_list; + }; + typedef ci::SplitListSet< rcu_type, bucket_type, set_traits > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} TYPED_TEST_P( IntrusiveSplitLazySet, member_cmp ) { typedef typename TestFixture::rcu_type rcu_type; typedef typename TestFixture::member_item_type member_item_type; typedef typename TestFixture::mock_disposer mock_disposer; - typedef typename TestFixture::template cmp cmp; + typedef typename TestFixture::template cmp item_cmp; typedef typename TestFixture::hash_int hash_int; typedef ci::LazyList< rcu_type @@ -190,7 +280,7 @@ TYPED_TEST_P( IntrusiveSplitLazySet, member_cmp ) offsetof( member_item_type, hMember ), ci::opt::gc >> - , ci::opt::compare< cmp > + , ci::opt::compare< item_cmp > , ci::opt::disposer< mock_disposer > >::type > bucket_type; @@ -210,7 +300,7 @@ TYPED_TEST_P( IntrusiveSplitLazySet, member_less ) typedef typename TestFixture::rcu_type rcu_type; typedef typename TestFixture::member_item_type member_item_type; typedef typename TestFixture::mock_disposer mock_disposer; - typedef typename TestFixture::template less less; + typedef typename TestFixture::template less item_less; typedef typename TestFixture::hash_int hash_int; typedef ci::LazyList< rcu_type @@ -220,7 +310,7 @@ TYPED_TEST_P( IntrusiveSplitLazySet, member_less ) offsetof( member_item_type, hMember ), ci::opt::gc > > - , ci::opt::less< less > + , ci::opt::less< item_less > , ci::opt::disposer< mock_disposer > >::type > bucket_type; @@ -290,13 +380,100 @@ TYPED_TEST_P( IntrusiveSplitLazySet, member_mutex ) this->test( s ); } +TYPED_TEST_P( IntrusiveSplitLazySet, member_static_bucket_table ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::member_item_type member_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::hash_int hash_int; + + struct list_traits: public ci::lazy_list::traits + { + typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc> hook; + typedef typename TestFixture::template less less; + typedef typename TestFixture::template cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< rcu_type, member_item_type, list_traits > bucket_type; + + struct set_traits: public ci::split_list::traits + { + typedef hash_int hash; + typedef typename TestFixture::simple_item_counter item_counter; + enum { + dynamic_bucket_table = false + }; + }; + typedef ci::SplitListSet< rcu_type, bucket_type, set_traits > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitLazySet, member_static_bucket_table_free_list ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::member_item_type member_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::hash_int hash_int; + + struct list_traits: public ci::lazy_list::traits + { + typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc> hook; + typedef typename TestFixture::template less less; + typedef typename TestFixture::template cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< rcu_type, member_item_type, list_traits > bucket_type; + + struct set_traits: public ci::split_list::traits + { + typedef hash_int hash; + typedef typename TestFixture::simple_item_counter item_counter; + enum { + dynamic_bucket_table = false + }; + typedef ci::FreeList free_list; + }; + typedef ci::SplitListSet< rcu_type, bucket_type, set_traits > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} + +TYPED_TEST_P( IntrusiveSplitLazySet, member_free_list ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::member_item_type member_item_type; + typedef typename TestFixture::mock_disposer mock_disposer; + typedef typename TestFixture::hash_int hash_int; + + struct list_traits: public ci::lazy_list::traits + { + typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc> hook; + typedef typename TestFixture::template cmp compare; + typedef mock_disposer disposer; + }; + typedef ci::LazyList< rcu_type, member_item_type, list_traits > bucket_type; + + struct set_traits: public ci::split_list::traits + { + typedef hash_int hash; + typedef typename TestFixture::simple_item_counter item_counter; + typedef ci::FreeList free_list; + }; + typedef ci::SplitListSet< rcu_type, bucket_type, set_traits > set_type; + + set_type s( TestFixture::kSize, 2 ); + this->test( s ); +} // GCC 5: All test names should be written on single line, otherwise a runtime error will be encountered like as // "No test named can be found in this test case" REGISTER_TYPED_TEST_CASE_P( IntrusiveSplitLazySet, - base_cmp, base_less, base_cmpmix, base_mutex, member_cmp, member_less, member_cmpmix, member_mutex + base_cmp, base_less, base_cmpmix, base_mutex, base_static_bucket_table, base_static_bucket_table_free_list, base_free_list, member_cmp, member_less, member_cmpmix, member_mutex, member_static_bucket_table, member_static_bucket_table_free_list, member_free_list ); #endif // CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_LAZY_RCU_H - \ No newline at end of file +