Fixed minor compiler warnings
[libcds.git] / test / unit / set / test_michael_michael_rcu.h
index 99f75ee6111141f664b66e55938e57e5896a9456..2d33e02987acfac998c28696ff3e4753697f990d 100644 (file)
@@ -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_MICHAEL_MICHAEL_RCU_H
 #define CDSUNIT_SET_TEST_MICHAEL_MICHAEL_RCU_H
@@ -70,7 +70,7 @@ TYPED_TEST_P( MichaelSet, compare )
         >::type
     > list_type;
 
-    typedef cc::MichaelHashSet< rcu_type, list_type, 
+    typedef cc::MichaelHashSet< rcu_type, list_type,
         typename cc::michael_set::make_traits<
             cds::opt::hash< typename TestFixture::hash_int >
         >::type
@@ -91,7 +91,7 @@ TYPED_TEST_P( MichaelSet, less )
         >::type
     > list_type;
 
-    typedef cc::MichaelHashSet< rcu_type, list_type, 
+    typedef cc::MichaelHashSet< rcu_type, list_type,
         typename cc::michael_set::make_traits<
             cds::opt::hash< typename TestFixture::hash_int >
         >::type
@@ -192,13 +192,62 @@ TYPED_TEST_P( MichaelSet, seq_cst )
     this->test( s );
 }
 
+TYPED_TEST_P( MichaelSet, stat )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::int_item int_item;
+
+    struct list_traits: public cc::michael_list::traits
+    {
+        typedef typename TestFixture::less less;
+        typedef cds::backoff::pause back_off;
+        typedef cc::michael_list::stat<> stat;
+    };
+    typedef cc::MichaelList< rcu_type, int_item, list_traits > list_type;
+
+    struct set_traits: public cc::michael_set::traits
+    {
+        typedef typename TestFixture::hash_int hash;
+        typedef cds::atomicity::item_counter item_counter;
+    };
+    typedef cc::MichaelHashSet< rcu_type, list_type, set_traits >set_type;
+
+    set_type s( TestFixture::kSize, 4 );
+    this->test( s );
+    EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
+}
+
+TYPED_TEST_P( MichaelSet, wrapped_stat )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::int_item int_item;
+
+    struct list_traits: public cc::michael_list::traits
+    {
+        typedef typename TestFixture::less less;
+        typedef cds::backoff::pause back_off;
+        typedef cc::michael_list::wrapped_stat<> stat;
+    };
+    typedef cc::MichaelList< rcu_type, int_item, list_traits > list_type;
+
+    struct set_traits: public cc::michael_set::traits
+    {
+        typedef typename TestFixture::hash_int hash;
+        typedef cds::atomicity::item_counter item_counter;
+    };
+    typedef cc::MichaelHashSet< rcu_type, list_type, set_traits >set_type;
+
+    set_type s( TestFixture::kSize, 4 );
+    this->test( s );
+    EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
+}
 
 // GCC 5: All test names should be written on single line, otherwise a runtime error will be encountered like as
 // "No test named <test_name> can be found in this test case"
 REGISTER_TYPED_TEST_CASE_P( MichaelSet,
-    compare, less, cmpmix, item_counting, backoff, seq_cst
+    compare, less, cmpmix, item_counting, backoff, seq_cst, stat, wrapped_stat
 );
 
 
 #endif // CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_MICHAEL_RCU_H
\ No newline at end of file
+