From: khizmax Date: Sat, 19 Mar 2016 07:37:26 +0000 (+0300) Subject: Added static bucket table test for SplitListSet X-Git-Tag: v2.2.0~336 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=1871ebdcba9e861cdc268fc8da55362326622677;p=libcds.git Added static bucket table test for SplitListSet --- diff --git a/test/unit/set/split_lazy_dhp.cpp b/test/unit/set/split_lazy_dhp.cpp index 83d30525..3054096c 100644 --- a/test/unit/set/split_lazy_dhp.cpp +++ b/test/unit/set/split_lazy_dhp.cpp @@ -79,7 +79,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -97,7 +97,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 1 ); test( s ); } @@ -116,7 +116,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -137,7 +137,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 4 ); test( s ); } @@ -158,7 +158,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -180,7 +180,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 3 ); test( s ); } @@ -203,7 +203,32 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 2 ); + test( s ); + } + + struct set_static_traits: public cc::split_list::traits + { + static bool const dynamic_bucket_table = false; + }; + + TEST_F( SplitListLazySet_DHP, static_bucket_table ) + { + struct set_traits: public set_static_traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s( kSize, 4 ); test( s ); } diff --git a/test/unit/set/split_lazy_hp.cpp b/test/unit/set/split_lazy_hp.cpp index 07c42f93..1b387491 100644 --- a/test/unit/set/split_lazy_hp.cpp +++ b/test/unit/set/split_lazy_hp.cpp @@ -80,7 +80,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -98,7 +98,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -117,7 +117,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 3 ); test( s ); } @@ -138,7 +138,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 4 ); test( s ); } @@ -159,7 +159,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -181,7 +181,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 4 ); test( s ); } @@ -204,7 +204,32 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 2 ); + test( s ); + } + + struct set_static_traits: public cc::split_list::traits + { + static bool const dynamic_bucket_table = false; + }; + + TEST_F( SplitListLazySet_HP, static_bucket_table ) + { + struct set_traits: public set_static_traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s( kSize, 4 ); test( s ); } diff --git a/test/unit/set/split_lazy_nogc.cpp b/test/unit/set/split_lazy_nogc.cpp index eab17132..afa95ab8 100644 --- a/test/unit/set/split_lazy_nogc.cpp +++ b/test/unit/set/split_lazy_nogc.cpp @@ -63,7 +63,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -81,7 +81,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -100,7 +100,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 1 ); test( s ); } @@ -121,7 +121,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 3 ); test( s ); } @@ -142,7 +142,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 4 ); test( s ); } @@ -164,7 +164,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -187,8 +187,34 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 3 ); test( s ); } + struct set_static_traits: public cc::split_list::traits + { + static bool const dynamic_bucket_table = false; + }; + + TEST_F( SplitListLazySet_NoGC, static_bucket_table ) + { + struct set_traits: public set_static_traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s( kSize, 4 ); + test( s ); + } + + } // namespace diff --git a/test/unit/set/split_michael_dhp.cpp b/test/unit/set/split_michael_dhp.cpp index 4f88b2e3..31b8dd94 100644 --- a/test/unit/set/split_michael_dhp.cpp +++ b/test/unit/set/split_michael_dhp.cpp @@ -79,7 +79,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -116,7 +116,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 3 ); test( s ); } @@ -137,7 +137,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 4 ); test( s ); } @@ -158,7 +158,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -180,7 +180,32 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 2 ); + test( s ); + } + + struct set_static_traits: public cc::split_list::traits + { + static bool const dynamic_bucket_table = false; + }; + + TEST_F( SplitListMichaelSet_DHP, static_bucket_table ) + { + struct set_traits: public set_static_traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s( kSize, 4 ); test( s ); } diff --git a/test/unit/set/split_michael_hp.cpp b/test/unit/set/split_michael_hp.cpp index d5bba0f0..0b779e2f 100644 --- a/test/unit/set/split_michael_hp.cpp +++ b/test/unit/set/split_michael_hp.cpp @@ -80,7 +80,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -98,7 +98,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -117,7 +117,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -138,7 +138,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 4 ); test( s ); } @@ -159,7 +159,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -181,7 +181,32 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 3 ); + test( s ); + } + + struct set_static_traits: public cc::split_list::traits + { + static bool const dynamic_bucket_table = false; + }; + + TEST_F( SplitListMichaelSet_HP, static_bucket_table ) + { + struct set_traits: public set_static_traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s( kSize, 4 ); test( s ); } diff --git a/test/unit/set/split_michael_nogc.cpp b/test/unit/set/split_michael_nogc.cpp index d8714da9..50af1e81 100644 --- a/test/unit/set/split_michael_nogc.cpp +++ b/test/unit/set/split_michael_nogc.cpp @@ -63,7 +63,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -81,7 +81,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } @@ -100,7 +100,7 @@ namespace { >::type > set_type; - set_type s; + set_type s( kSize, 3 ); test( s ); } @@ -121,7 +121,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 4 ); test( s ); } @@ -142,7 +142,7 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 5 ); test( s ); } @@ -164,8 +164,34 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - set_type s; + set_type s( kSize, 2 ); test( s ); } + struct set_static_traits: public cc::split_list::traits + { + static bool const dynamic_bucket_table = false; + }; + + TEST_F( SplitListMichaelSet_NoGC, static_bucket_table ) + { + struct set_traits: public set_static_traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s( kSize, 4 ); + test( s ); + } + + } // namespace diff --git a/test/unit/set/test_split_lazy_rcu.h b/test/unit/set/test_split_lazy_rcu.h index 72e9a791..44fec2b2 100644 --- a/test/unit/set/test_split_lazy_rcu.h +++ b/test/unit/set/test_split_lazy_rcu.h @@ -78,7 +78,7 @@ TYPED_TEST_P( SplitListLazySet, compare ) >::type > set_type; - set_type s; + set_type s( TestFixture::kSize, 2 ); this->test( s ); } @@ -100,7 +100,7 @@ TYPED_TEST_P( SplitListLazySet, less ) >::type > set_type; - set_type s; + set_type s( TestFixture::kSize, 4 ); this->test( s ); } @@ -123,7 +123,7 @@ TYPED_TEST_P( SplitListLazySet, cmpmix ) >::type > set_type; - set_type s; + set_type s( TestFixture::kSize, 2 ); this->test( s ); } @@ -148,7 +148,7 @@ TYPED_TEST_P( SplitListLazySet, item_counting ) }; typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; - set_type s; + set_type s( TestFixture::kSize, 1 ); this->test( s ); } @@ -173,7 +173,7 @@ TYPED_TEST_P( SplitListLazySet, stat ) }; typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; - set_type s; + set_type s( TestFixture::kSize, 3 ); this->test( s ); } @@ -199,7 +199,7 @@ TYPED_TEST_P( SplitListLazySet, back_off ) }; typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; - set_type s; + set_type s( TestFixture::kSize, 2 ); this->test( s ); } @@ -226,14 +226,46 @@ TYPED_TEST_P( SplitListLazySet, mutex ) }; typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; - set_type s; + set_type s( TestFixture::kSize, 2 ); this->test( s ); } +namespace { + struct set_static_traits: public cc::split_list::traits + { + static bool const dynamic_bucket_table = false; + }; +} + +TYPED_TEST_P( SplitListLazySet, static_bucket_table ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + struct set_traits: public set_static_traits + { + typedef cc::lazy_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::lazy_list::traits + { + typedef typename TestFixture::cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; + + set_type s( TestFixture::kSize, 4 ); + test( s ); +} + + // GCC 5: All this->test names should be written on single line, otherwise a runtime error will be encountered like as // "No this->test named can be found in this this->test case" REGISTER_TYPED_TEST_CASE_P( SplitListLazySet, - compare, less, cmpmix, item_counting, stat, back_off, mutex + compare, less, cmpmix, item_counting, stat, back_off, mutex, static_bucket_table ); diff --git a/test/unit/set/test_split_michael_rcu.h b/test/unit/set/test_split_michael_rcu.h index 7952ed86..4b2ac548 100644 --- a/test/unit/set/test_split_michael_rcu.h +++ b/test/unit/set/test_split_michael_rcu.h @@ -59,7 +59,6 @@ protected: TYPED_TEST_CASE_P( SplitListMichaelSet ); -//TYPED_TEST_P( SplitListMichaelSet, compare ) TYPED_TEST_P( SplitListMichaelSet, compare ) { typedef typename TestFixture::rcu_type rcu_type; @@ -78,7 +77,7 @@ TYPED_TEST_P( SplitListMichaelSet, compare ) >::type > set_type; - set_type s; + set_type s( TestFixture::kSize, 2 ); this->test( s ); } @@ -100,7 +99,7 @@ TYPED_TEST_P( SplitListMichaelSet, less ) >::type > set_type; - set_type s; + set_type s( TestFixture::kSize, 2 ); this->test( s ); } @@ -123,7 +122,7 @@ TYPED_TEST_P( SplitListMichaelSet, cmpmix ) >::type > set_type; - set_type s; + set_type s( TestFixture::kSize, 3 ); this->test( s ); } @@ -148,7 +147,7 @@ TYPED_TEST_P( SplitListMichaelSet, item_counting ) }; typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; - set_type s; + set_type s( TestFixture::kSize, 8 ); this->test( s ); } @@ -173,7 +172,7 @@ TYPED_TEST_P( SplitListMichaelSet, stat ) }; typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; - set_type s; + set_type s( TestFixture::kSize, 4 ); this->test( s ); } @@ -199,15 +198,46 @@ TYPED_TEST_P( SplitListMichaelSet, back_off ) }; typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; - set_type s; + set_type s( TestFixture::kSize, 2 ); this->test( s ); } +namespace { + struct set_static_traits: public cc::split_list::traits + { + static bool const dynamic_bucket_table = false; + }; +} + +TYPED_TEST_P( SplitListMichaelSet, static_bucket_table ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::int_item int_item; + typedef typename TestFixture::hash_int hash_int; + + struct set_traits: public set_static_traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef typename TestFixture::cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< rcu_type, int_item, set_traits > set_type; + + set_type s( TestFixture::kSize, 4 ); + test( s ); +} + // GCC 5: All this->test names should be written on single line, otherwise a runtime error will be encountered like as // "No this->test named can be found in this this->test case" REGISTER_TYPED_TEST_CASE_P( SplitListMichaelSet, - compare, less, cmpmix, item_counting, stat, back_off + compare, less, cmpmix, item_counting, stat, back_off, static_bucket_table );