X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=test%2Funit%2Fmap%2Ftest_split_michael_rcu.h;h=ef71fe4c94293e67e20abaedbe40cd034d92788f;hb=40e34e6d0b104b6f5aff506ad67d43fd410e52bc;hp=47713fe4b1e32032db3df266006f892b225cf7e3;hpb=dcfc955eac8d172e1da77d150edc6e17b54ef5a0;p=libcds.git diff --git a/test/unit/map/test_split_michael_rcu.h b/test/unit/map/test_split_michael_rcu.h index 47713fe4..ef71fe4c 100644 --- a/test/unit/map/test_split_michael_rcu.h +++ b/test/unit/map/test_split_michael_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_MAP_TEST_SPLIT_LIST_MICHAEL_RCU_H #define CDSUNIT_MAP_TEST_SPLIT_LIST_MICHAEL_RCU_H @@ -33,6 +33,7 @@ #include "test_map_rcu.h" #include #include +#include namespace cc = cds::container; @@ -66,11 +67,11 @@ TYPED_TEST_P( SplitListMichaelMap, compare ) typedef typename TestFixture::value_type value_type; typedef typename TestFixture::hash1 hash1; - typedef cc::SplitListMap< rcu_type, key_type, value_type, + typedef cc::SplitListMap< rcu_type, key_type, value_type, typename cc::split_list::make_traits< cc::split_list::ordered_list< cc::michael_list_tag > , cds::opt::hash< hash1 > - , cc::split_list::ordered_list_traits< + , cc::split_list::ordered_list_traits< typename cc::michael_list::make_traits< cds::opt::compare< typename TestFixture::cmp > >::type @@ -93,7 +94,7 @@ TYPED_TEST_P( SplitListMichaelMap, less ) typename cc::split_list::make_traits< cc::split_list::ordered_list< cc::michael_list_tag > , cds::opt::hash< hash1 > - , cc::split_list::ordered_list_traits< + , cc::split_list::ordered_list_traits< typename cc::michael_list::make_traits< cds::opt::less< typename TestFixture::less > >::type @@ -116,7 +117,7 @@ TYPED_TEST_P( SplitListMichaelMap, cmpmix ) typename cc::split_list::make_traits< cc::split_list::ordered_list< cc::michael_list_tag > , cds::opt::hash< hash1 > - , cc::split_list::ordered_list_traits< + , cc::split_list::ordered_list_traits< typename cc::michael_list::make_traits< cds::opt::less< typename TestFixture::less > , cds::opt::compare< typename TestFixture::cmp > @@ -208,6 +209,31 @@ TYPED_TEST_P( SplitListMichaelMap, back_off ) this->test( m ); } +TYPED_TEST_P( SplitListMichaelMap, free_list ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::key_type key_type; + typedef typename TestFixture::value_type value_type; + typedef typename TestFixture::hash1 hash1; + + struct map_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash1 hash; + typedef cds::intrusive::FreeList free_list; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef typename TestFixture::cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListMap< rcu_type, key_type, value_type, map_traits > map_type; + + map_type m( TestFixture::kSize, 2 ); + this->test( m ); +} + namespace { struct set_static_traits: public cc::split_list::traits { @@ -240,8 +266,34 @@ TYPED_TEST_P( SplitListMichaelMap, static_bucket_table ) this->test( m ); } +TYPED_TEST_P( SplitListMichaelMap, static_bucket_table_free_list ) +{ + typedef typename TestFixture::rcu_type rcu_type; + typedef typename TestFixture::key_type key_type; + typedef typename TestFixture::value_type value_type; + typedef typename TestFixture::hash1 hash1; + + struct map_traits: public set_static_traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash1 hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::intrusive::FreeList free_list; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef typename TestFixture::cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListMap< rcu_type, key_type, value_type, map_traits > map_type; + + map_type m( TestFixture::kSize, 4 ); + this->test( m ); +} + REGISTER_TYPED_TEST_CASE_P( SplitListMichaelMap, - compare, less, cmpmix, item_counting, stat, back_off, static_bucket_table + compare, less, cmpmix, item_counting, stat, back_off, free_list, static_bucket_table, static_bucket_table_free_list );