Merged branch 'master' of https://github.com/Nemo1369/libcds
[libcds.git] / test / unit / intrusive-set / intrusive_michael_iterable_dhp.cpp
index 5075345441b7321144886a7cdf3328e46e8d31cc..1fabda22c735ddd1d7e227fb5cbea71fdb054c98 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:
 
@@ -50,14 +50,14 @@ namespace {
             typedef ci::IterableList< gc_type, item_type, list_traits > list_type;
             typedef ci::MichaelHashSet< gc_type, list_type > set_type;
 
-            cds::gc::dhp::GarbageCollector::Construct( 16, set_type::c_nHazardPtrCount );
+            cds::gc::dhp::smr::construct( set_type::c_nHazardPtrCount );
             cds::threading::Manager::attachThread();
         }
 
         void TearDown()
         {
             cds::threading::Manager::detachThread();
-            cds::gc::dhp::GarbageCollector::Destruct();
+            cds::gc::dhp::smr::destruct();
         }
     };
 
@@ -142,7 +142,7 @@ namespace {
 
         set_type s( kSize, 2 );
         test( s );
-        EXPECT_GE( s.statistics().m_nInsertSuccess, 0 );
+        EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
     }
 
     TEST_F( IntrusiveMichaelIterableSet_DHP, wrapped_stat )
@@ -164,7 +164,28 @@ namespace {
 
         set_type s( kSize, 2 );
         test( s );
-        EXPECT_GE( s.statistics().m_nInsertSuccess, 0 );
+        EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
+    }
+
+    TEST_F( IntrusiveMichaelIterableSet_DHP, derived_list )
+    {
+        class bucket_type: public ci::IterableList< gc_type
+            , item_type
+            ,ci::iterable_list::make_traits<
+                ci::opt::compare< cmp<item_type> >
+                ,ci::opt::disposer< mock_disposer >
+            >::type
+        >
+        {};
+
+        typedef ci::MichaelHashSet< gc_type, bucket_type,
+            ci::michael_set::make_traits<
+                ci::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
     }
 
 } // namespace