X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=test%2Funit%2Fmap%2Fmichael_michael_nogc.cpp;h=1fb9269087ea4cf6b284e9ffff1b25729fcd1dbc;hb=2bb66f1d159d044d2c5dad0f0f968abcb6d53287;hp=b791e4394879049f3907aa2ddd19a4507d303330;hpb=7448008aa977fe42a83738fbbc63ce11d8ab86f9;p=libcds.git diff --git a/test/unit/map/michael_michael_nogc.cpp b/test/unit/map/michael_michael_nogc.cpp index b791e439..1fb92690 100644 --- a/test/unit/map/michael_michael_nogc.cpp +++ b/test/unit/map/michael_michael_nogc.cpp @@ -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. */ #include "test_map_nogc.h" @@ -57,7 +57,7 @@ namespace { >::type > list_type; - typedef cc::MichaelHashMap< gc_type, list_type, + typedef cc::MichaelHashMap< gc_type, list_type, typename cc::michael_map::make_traits< cds::opt::hash< hash1 > >::type @@ -75,7 +75,7 @@ namespace { >::type > list_type; - typedef cc::MichaelHashMap< gc_type, list_type, + typedef cc::MichaelHashMap< gc_type, list_type, typename cc::michael_map::make_traits< cds::opt::hash< hash1 > >::type @@ -94,7 +94,7 @@ namespace { }; typedef cc::MichaelKVList< gc_type, key_type, value_type, list_traits > list_type; - typedef cc::MichaelHashMap< gc_type, list_type, + typedef cc::MichaelHashMap< gc_type, list_type, typename cc::michael_map::make_traits< cds::opt::hash< hash1 > >::type @@ -145,4 +145,48 @@ namespace { test( m ); } + TEST_F( MichaelMap_NoGC, stat ) + { + struct list_traits: public cc::michael_list::traits + { + typedef base_class::less less; + typedef cds::backoff::pause back_off; + typedef cc::michael_list::stat<> stat; + }; + typedef cc::MichaelKVList< gc_type, key_type, value_type, list_traits > list_type; + + struct map_traits: public cc::michael_map::traits + { + typedef hash1 hash; + typedef cds::atomicity::item_counter item_counter; + }; + typedef cc::MichaelHashMap< gc_type, list_type, map_traits > map_type; + + map_type m( kSize, 4 ); + test( m ); + EXPECT_GE( m.statistics().m_nInsertSuccess, 0u ); + } + + TEST_F( MichaelMap_NoGC, wrapped_stat ) + { + struct list_traits: public cc::michael_list::traits + { + typedef base_class::less less; + typedef cds::backoff::pause back_off; + typedef cc::michael_list::wrapped_stat<> stat; + }; + typedef cc::MichaelKVList< gc_type, key_type, value_type, list_traits > list_type; + + struct map_traits: public cc::michael_map::traits + { + typedef hash1 hash; + typedef cds::atomicity::item_counter item_counter; + }; + typedef cc::MichaelHashMap< gc_type, list_type, map_traits > map_type; + + map_type m( kSize, 4 ); + test( m ); + EXPECT_GE( m.statistics().m_nInsertSuccess, 0u ); + } + } // namespace