Migrated intrusive::MichaelSet unit tests to gtest framework
authorkhizmax <libcds.dev@gmail.com>
Sat, 12 Mar 2016 08:51:10 +0000 (11:51 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sat, 12 Mar 2016 08:51:10 +0000 (11:51 +0300)
26 files changed:
projects/Win/vc14/cds.sln
projects/Win/vc14/gtest-set.vcxproj
projects/Win/vc14/gtest-set.vcxproj.filters
test/unit/set/CMakeLists.txt
test/unit/set/intrusive_michael_lazy_dhp.cpp
test/unit/set/intrusive_michael_lazy_hp.cpp
test/unit/set/intrusive_michael_lazy_nogc.cpp [new file with mode: 0644]
test/unit/set/intrusive_michael_lazy_rcu_gpb.cpp [new file with mode: 0644]
test/unit/set/intrusive_michael_lazy_rcu_gpi.cpp [new file with mode: 0644]
test/unit/set/intrusive_michael_lazy_rcu_gpt.cpp [new file with mode: 0644]
test/unit/set/intrusive_michael_lazy_rcu_shb.cpp [new file with mode: 0644]
test/unit/set/intrusive_michael_lazy_rcu_sht.cpp [new file with mode: 0644]
test/unit/set/intrusive_michael_michael_dhp.cpp
test/unit/set/intrusive_michael_michael_hp.cpp
test/unit/set/intrusive_michael_michael_nogc.cpp [new file with mode: 0644]
test/unit/set/intrusive_michael_michael_rcu_gpb.cpp [new file with mode: 0644]
test/unit/set/intrusive_michael_michael_rcu_gpi.cpp [new file with mode: 0644]
test/unit/set/intrusive_michael_michael_rcu_gpt.cpp [new file with mode: 0644]
test/unit/set/intrusive_michael_michael_rcu_shb.cpp [new file with mode: 0644]
test/unit/set/intrusive_michael_michael_rcu_sht.cpp [new file with mode: 0644]
test/unit/set/test_intrusive_michael_lazy_rcu.h [new file with mode: 0644]
test/unit/set/test_intrusive_michael_michael_rcu.h [new file with mode: 0644]
test/unit/set/test_intrusive_set.h
test/unit/set/test_intrusive_set_hp.h
test/unit/set/test_intrusive_set_nogc.h [new file with mode: 0644]
test/unit/set/test_intrusive_set_rcu.h

index 162f9b236b3324e1f23ddd945e7fdf25567fcf87..a21acd60cc7566d1f1571ed7229e24a206b1201b 100644 (file)
@@ -148,6 +148,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit-set-insdelfind", "unit
        EndProjectSection\r
 EndProject\r
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unit", "unit", "{810490B7-31E5-49AE-8455-CAF99A9658B6}"\r
+       ProjectSection(SolutionItems) = preProject\r
+               ..\..\..\tests\test-hdr\size_check.h = ..\..\..\tests\test-hdr\size_check.h\r
+       EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest-stack", "gtest-stack.vcxproj", "{5407E9D2-67D9-4266-976E-7A90BDE2541D}"\r
        ProjectSection(ProjectDependencies) = postProject\r
@@ -203,6 +206,9 @@ EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress-pqueue", "stress-pqueue.vcxproj", "{51AC349E-B365-4FCF-8778-17A1534E4584}"\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest-set", "gtest-set.vcxproj", "{A589D3F1-A749-4268-ADEC-D0CE13D1E359}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+               {408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239}\r
+       EndProjectSection\r
 EndProject\r
 Global\r
        GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
index 82b5276fbf60694faaaf42b18b0e93466f68bf30..60f94b2ebdc5f04bd48f2b488e4b0c0c6c9d16c2 100644 (file)
     <ClCompile Include="..\..\..\test\unit\main.cpp" />\r
     <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_dhp.cpp" />\r
     <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_hp.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_nogc.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_gpb.cpp">\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4503</DisableSpecificWarnings>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_gpi.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_gpt.cpp">\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4503</DisableSpecificWarnings>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_shb.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_sht.cpp" />\r
     <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_dhp.cpp" />\r
     <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_hp.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_nogc.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_gpb.cpp">\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4503</DisableSpecificWarnings>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_gpi.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_gpt.cpp">\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">4503</DisableSpecificWarnings>\r
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4503</DisableSpecificWarnings>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_shb.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_sht.cpp" />\r
   </ItemGroup>\r
   <ItemGroup>\r
+    <ClInclude Include="..\..\..\test\unit\set\test_intrusive_michael_lazy_rcu.h" />\r
+    <ClInclude Include="..\..\..\test\unit\set\test_intrusive_michael_michael_rcu.h" />\r
     <ClInclude Include="..\..\..\test\unit\set\test_intrusive_set.h" />\r
     <ClInclude Include="..\..\..\test\unit\set\test_intrusive_set_hp.h" />\r
+    <ClInclude Include="..\..\..\test\unit\set\test_intrusive_set_nogc.h" />\r
     <ClInclude Include="..\..\..\test\unit\set\test_intrusive_set_rcu.h" />\r
   </ItemGroup>\r
   <PropertyGroup Label="Globals">\r
index 5048a8b2f8b72d1ef950276589c7bef7dd99ca71..9bef357016a71ca5f33faa99115d59e8b07b63ac 100644 (file)
     <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_dhp.cpp">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_gpb.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_gpi.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_gpt.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_shb.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_sht.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_gpb.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_gpi.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_gpt.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_shb.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_sht.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_nogc.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_nogc.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\..\test\unit\set\test_intrusive_set.h">\r
     <ClInclude Include="..\..\..\test\unit\set\test_intrusive_set_rcu.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\..\..\test\unit\set\test_intrusive_michael_michael_rcu.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\..\..\test\unit\set\test_intrusive_michael_lazy_rcu.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\..\..\test\unit\set\test_intrusive_set_nogc.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
index 7f9eb504d87f7df41a7d2e882f988f7bff9cf876..61228a436be8b8661b2684c709bf114e16c646e7 100644 (file)
@@ -1,11 +1,25 @@
 set(PACKAGE_NAME unit-set)
 
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof")
+
 set(CDSGTEST_SET_SOURCES
     ../main.cpp
     intrusive_michael_lazy_hp.cpp
     intrusive_michael_lazy_dhp.cpp
+    intrusive_michael_lazy_nogc.cpp
+    intrusive_michael_lazy_rcu_gpb.cpp
+    intrusive_michael_lazy_rcu_gpi.cpp
+    intrusive_michael_lazy_rcu_gpt.cpp
+    intrusive_michael_lazy_rcu_shb.cpp
+    intrusive_michael_lazy_rcu_sht.cpp
     intrusive_michael_michael_hp.cpp
     intrusive_michael_michael_dhp.cpp
+    intrusive_michael_michael_nogc.cpp
+    intrusive_michael_michael_rcu_gpb.cpp
+    intrusive_michael_michael_rcu_gpi.cpp
+    intrusive_michael_michael_rcu_gpt.cpp
+    intrusive_michael_michael_rcu_shb.cpp
+    intrusive_michael_michael_rcu_sht.cpp
 )
 
 include_directories(
index 72449894723d6c8b22a9eea5580eeb810d80f75a..633001a01020932960d59283e2856f2954c946a7 100644 (file)
@@ -41,6 +41,7 @@ namespace {
 
     class IntrusiveMichaelLazySet_DHP : public cds_test::intrusive_set_hp
     {
+    protected:
         typedef cds_test::intrusive_set_hp base_class;
 
     protected:
index ebcb94f9fc7ba67df3ed4699e3d8aaceceb865c6..6583d32d4c9a2d0dafebc3ddf90a686a6f99840c 100644 (file)
@@ -41,6 +41,7 @@ namespace {
 
     class IntrusiveMichaelLazySet_HP : public cds_test::intrusive_set_hp
     {
+    protected:
         typedef cds_test::intrusive_set_hp base_class;
 
     protected:
diff --git a/test/unit/set/intrusive_michael_lazy_nogc.cpp b/test/unit/set/intrusive_michael_lazy_nogc.cpp
new file mode 100644 (file)
index 0000000..c183de4
--- /dev/null
@@ -0,0 +1,241 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+      list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.     
+*/
+
+#include "test_intrusive_set_nogc.h"
+
+#include <cds/intrusive/lazy_list_nogc.h>
+#include <cds/intrusive/michael_set_nogc.h>
+
+#include <mutex>
+
+namespace {
+    namespace ci = cds::intrusive;
+    typedef cds::gc::nogc gc_type;
+
+    class IntrusiveMichaelLazySet_NoGC : public cds_test::intrusive_set_nogc
+    {
+    protected:
+        typedef cds_test::intrusive_set_nogc base_class;
+
+    protected:
+        typedef typename base_class::base_int_item< ci::lazy_list::node<gc_type>>   base_item_type;
+        typedef typename base_class::base_int_item< ci::lazy_list::node<gc_type, std::mutex>>   base_mutex_item_type;
+        typedef typename base_class::member_int_item< ci::lazy_list::node<gc_type>> member_item_type;
+        typedef typename base_class::member_int_item< ci::lazy_list::node<gc_type, std::mutex>> member_mutex_item_type;
+
+        //void SetUp()
+        //{}
+
+        //void TearDown()
+        //{}
+    };
+
+
+    TEST_F( IntrusiveMichaelLazySet_NoGC, base_cmp )
+    {
+        typedef ci::LazyList< gc_type
+            , base_item_type
+            ,ci::lazy_list::make_traits<
+                ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< gc_type > > >
+                ,ci::opt::compare< cmp<base_item_type> >
+                ,ci::opt::disposer< mock_disposer >
+                ,ci::opt::back_off< cds::backoff::pause >
+            >::type
+        > bucket_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 );
+    }
+
+    TEST_F( IntrusiveMichaelLazySet_NoGC, base_less )
+    {
+        typedef ci::LazyList< gc_type
+            , base_item_type
+            ,ci::lazy_list::make_traits<
+                ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< gc_type >>>
+                ,ci::opt::less< less<base_item_type> >
+                ,ci::opt::disposer< mock_disposer >
+            >::type
+        > bucket_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 );
+    }
+
+    TEST_F( IntrusiveMichaelLazySet_NoGC, base_cmpmix )
+    {
+        struct list_traits : public ci::lazy_list::traits
+        {
+            typedef ci::lazy_list::base_hook< ci::opt::gc<gc_type>> hook;
+            typedef base_class::less<base_item_type> less;
+            typedef cmp<base_item_type> compare;
+            typedef mock_disposer disposer;
+        };
+        typedef ci::LazyList< gc_type, base_item_type, list_traits > bucket_type;
+
+        struct set_traits : public ci::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef simple_item_counter item_counter;
+        };
+        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+    TEST_F( IntrusiveMichaelLazySet_NoGC, base_mutex )
+    {
+        struct list_traits : public ci::lazy_list::traits
+        {
+            typedef ci::lazy_list::base_hook< ci::opt::gc<gc_type>, ci::opt::lock_type<std::mutex>> hook;
+            typedef base_class::less<base_mutex_item_type> less;
+            typedef cmp<base_mutex_item_type> compare;
+            typedef mock_disposer disposer;
+        };
+        typedef ci::LazyList< gc_type, base_mutex_item_type, list_traits > bucket_type;
+
+        struct set_traits : public ci::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef simple_item_counter item_counter;
+        };
+        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+
+    TEST_F( IntrusiveMichaelLazySet_NoGC, member_cmp )
+    {
+        typedef ci::LazyList< gc_type
+            ,member_item_type
+            ,ci::lazy_list::make_traits<
+                ci::opt::hook< ci::lazy_list::member_hook<
+                    offsetof( member_item_type, hMember ),
+                    ci::opt::gc<gc_type>
+                > >
+                ,ci::opt::compare< cmp<member_item_type> >
+                ,ci::opt::disposer< mock_disposer >
+            >::type
+        >    bucket_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 );
+    }
+
+    TEST_F( IntrusiveMichaelLazySet_NoGC, member_less )
+    {
+        typedef ci::LazyList< gc_type
+            , member_item_type
+            ,ci::lazy_list::make_traits<
+                ci::opt::hook< ci::lazy_list::member_hook<
+                    offsetof( member_item_type, hMember ),
+                    ci::opt::gc<gc_type>
+                > >
+                ,ci::opt::less< less<member_item_type> >
+                ,ci::opt::disposer< mock_disposer >
+            >::type
+        > bucket_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 );
+    }
+
+    TEST_F( IntrusiveMichaelLazySet_NoGC, member_cmpmix )
+    {
+        struct list_traits : public ci::lazy_list::traits
+        {
+            typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<gc_type>> hook;
+            typedef base_class::less<member_item_type> less;
+            typedef cmp<member_item_type> compare;
+            typedef mock_disposer disposer;
+        };
+        typedef ci::LazyList< gc_type, member_item_type, list_traits > bucket_type;
+
+        struct set_traits : public ci::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef simple_item_counter item_counter;
+        };
+        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+    TEST_F( IntrusiveMichaelLazySet_NoGC, member_mutex )
+    {
+        struct list_traits : public ci::lazy_list::traits
+        {
+            typedef ci::lazy_list::member_hook< offsetof( member_mutex_item_type, hMember ), ci::opt::gc<gc_type>, ci::opt::lock_type<std::mutex>> hook;
+            typedef base_class::less<member_mutex_item_type> less;
+            typedef cmp<member_mutex_item_type> compare;
+            typedef mock_disposer disposer;
+        };
+        typedef ci::LazyList< gc_type, member_mutex_item_type, list_traits > bucket_type;
+
+        struct set_traits : public ci::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef simple_item_counter item_counter;
+        };
+        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+} // namespace
diff --git a/test/unit/set/intrusive_michael_lazy_rcu_gpb.cpp b/test/unit/set/intrusive_michael_lazy_rcu_gpb.cpp
new file mode 100644 (file)
index 0000000..f2662d2
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+    list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.
+*/
+
+#include <cds/urcu/general_buffered.h>
+
+#include "test_intrusive_michael_lazy_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::general_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, IntrusiveMichaelLazySet, rcu_implementation );
diff --git a/test/unit/set/intrusive_michael_lazy_rcu_gpi.cpp b/test/unit/set/intrusive_michael_lazy_rcu_gpi.cpp
new file mode 100644 (file)
index 0000000..b35171a
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+    list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.
+*/
+
+#include <cds/urcu/general_instant.h>
+
+#include "test_intrusive_michael_lazy_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::general_instant<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, IntrusiveMichaelLazySet, rcu_implementation );
diff --git a/test/unit/set/intrusive_michael_lazy_rcu_gpt.cpp b/test/unit/set/intrusive_michael_lazy_rcu_gpt.cpp
new file mode 100644 (file)
index 0000000..76ff2f0
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+    list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.
+*/
+
+#include <cds/urcu/general_threaded.h>
+
+#include "test_intrusive_michael_lazy_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::general_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, IntrusiveMichaelLazySet, rcu_implementation );
diff --git a/test/unit/set/intrusive_michael_lazy_rcu_shb.cpp b/test/unit/set/intrusive_michael_lazy_rcu_shb.cpp
new file mode 100644 (file)
index 0000000..a7728a2
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+    list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.
+*/
+
+#include <cds/urcu/signal_buffered.h>
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
+#include "test_intrusive_michael_lazy_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::signal_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, IntrusiveMichaelLazySet, rcu_implementation );
+
+#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
diff --git a/test/unit/set/intrusive_michael_lazy_rcu_sht.cpp b/test/unit/set/intrusive_michael_lazy_rcu_sht.cpp
new file mode 100644 (file)
index 0000000..16c00ba
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+    list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.
+*/
+
+#include <cds/urcu/signal_threaded.h>
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
+#include "test_intrusive_michael_lazy_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::signal_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, IntrusiveMichaelLazySet, rcu_implementation );
+
+#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
index 9b5719f27002c42e2c3d59caaba3ce201f8c34e9..035c21f1bebf27c545586d34a8c079f10fe55832 100644 (file)
@@ -39,6 +39,7 @@ namespace {
 
     class IntrusiveMichaelSet_DHP : public cds_test::intrusive_set_hp
     {
+    protected:
         typedef cds_test::intrusive_set_hp base_class;
 
     protected:
index 7aca853ad7ee59cb635af03fb5252e7b11c7ba0e..a97824d330c291eb04381d0c5d8026f051881641 100644 (file)
@@ -39,6 +39,7 @@ namespace {
 
     class IntrusiveMichaelSet_HP : public cds_test::intrusive_set_hp
     {
+    protected:
         typedef cds_test::intrusive_set_hp base_class;
 
     protected:
diff --git a/test/unit/set/intrusive_michael_michael_nogc.cpp b/test/unit/set/intrusive_michael_michael_nogc.cpp
new file mode 100644 (file)
index 0000000..2ce9e2b
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+      list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.     
+*/
+
+#include "test_intrusive_set_nogc.h"
+
+#include <cds/intrusive/michael_list_nogc.h>
+#include <cds/intrusive/michael_set_nogc.h>
+
+namespace {
+    namespace ci = cds::intrusive;
+    typedef cds::gc::nogc gc_type;
+
+    class IntrusiveMichaelSet_NoGC : public cds_test::intrusive_set_nogc
+    {
+    protected:
+        typedef cds_test::intrusive_set_nogc base_class;
+
+    protected:
+        typedef typename base_class::base_int_item< ci::michael_list::node<gc_type>>   base_item_type;
+        typedef typename base_class::member_int_item< ci::michael_list::node<gc_type>> member_item_type;
+
+        //void SetUp()
+        //{}
+
+        //void TearDown()
+        //{}
+    };
+
+
+    TEST_F( IntrusiveMichaelSet_NoGC, base_cmp )
+    {
+        typedef ci::MichaelList< gc_type
+            , base_item_type
+            ,ci::michael_list::make_traits<
+                ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< gc_type > > >
+                ,ci::opt::compare< cmp<base_item_type> >
+                ,ci::opt::disposer< mock_disposer >
+            >::type
+        > bucket_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 );
+    }
+
+    TEST_F( IntrusiveMichaelSet_NoGC, base_less )
+    {
+        typedef ci::MichaelList< gc_type
+            , base_item_type
+            ,ci::michael_list::make_traits<
+                ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< gc_type >>>
+                ,ci::opt::less< less<base_item_type> >
+                ,ci::opt::disposer< mock_disposer >
+            >::type
+        > bucket_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 );
+    }
+
+    TEST_F( IntrusiveMichaelSet_NoGC, base_cmpmix )
+    {
+        struct list_traits : public ci::michael_list::traits
+        {
+            typedef ci::michael_list::base_hook< ci::opt::gc<gc_type>> hook;
+            typedef base_class::less<base_item_type> less;
+            typedef cmp<base_item_type> compare;
+            typedef mock_disposer disposer;
+        };
+        typedef ci::MichaelList< gc_type, base_item_type, list_traits > bucket_type;
+
+        struct set_traits : public ci::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef simple_item_counter item_counter;
+        };
+        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+
+    TEST_F( IntrusiveMichaelSet_NoGC, member_cmp )
+    {
+        typedef ci::MichaelList< gc_type
+            ,member_item_type
+            ,ci::michael_list::make_traits<
+                ci::opt::hook< ci::michael_list::member_hook<
+                    offsetof( member_item_type, hMember ),
+                    ci::opt::gc<gc_type>
+                > >
+                ,ci::opt::compare< cmp<member_item_type> >
+                ,ci::opt::disposer< mock_disposer >
+            >::type
+        >    bucket_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 );
+    }
+
+    TEST_F( IntrusiveMichaelSet_NoGC, member_less )
+    {
+        typedef ci::MichaelList< gc_type
+            , member_item_type
+            ,ci::michael_list::make_traits<
+                ci::opt::hook< ci::michael_list::member_hook<
+                    offsetof( member_item_type, hMember ),
+                    ci::opt::gc<gc_type>
+                > >
+                ,ci::opt::less< less<member_item_type> >
+                ,ci::opt::disposer< mock_disposer >
+            >::type
+        > bucket_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 );
+    }
+
+    TEST_F( IntrusiveMichaelSet_NoGC, member_cmpmix )
+    {
+        struct list_traits : public ci::michael_list::traits
+        {
+            typedef ci::michael_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<gc_type>> hook;
+            typedef base_class::less<member_item_type> less;
+            typedef cmp<member_item_type> compare;
+            typedef mock_disposer disposer;
+        };
+        typedef ci::MichaelList< gc_type, member_item_type, list_traits > bucket_type;
+
+        struct set_traits : public ci::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef simple_item_counter item_counter;
+        };
+        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+} // namespace
diff --git a/test/unit/set/intrusive_michael_michael_rcu_gpb.cpp b/test/unit/set/intrusive_michael_michael_rcu_gpb.cpp
new file mode 100644 (file)
index 0000000..e8d6f68
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+    list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.
+*/
+
+#include <cds/urcu/general_buffered.h>
+
+#include "test_intrusive_michael_michael_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::general_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, IntrusiveMichaelSet, rcu_implementation );
diff --git a/test/unit/set/intrusive_michael_michael_rcu_gpi.cpp b/test/unit/set/intrusive_michael_michael_rcu_gpi.cpp
new file mode 100644 (file)
index 0000000..3e65ce1
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+    list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.
+*/
+
+#include <cds/urcu/general_instant.h>
+
+#include "test_intrusive_michael_michael_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::general_instant<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, IntrusiveMichaelSet, rcu_implementation );
diff --git a/test/unit/set/intrusive_michael_michael_rcu_gpt.cpp b/test/unit/set/intrusive_michael_michael_rcu_gpt.cpp
new file mode 100644 (file)
index 0000000..b397529
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+    list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.
+*/
+
+#include <cds/urcu/general_threaded.h>
+
+#include "test_intrusive_michael_michael_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::general_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, IntrusiveMichaelSet, rcu_implementation );
diff --git a/test/unit/set/intrusive_michael_michael_rcu_shb.cpp b/test/unit/set/intrusive_michael_michael_rcu_shb.cpp
new file mode 100644 (file)
index 0000000..6f5be5a
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+    list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.
+*/
+
+#include <cds/urcu/signal_buffered.h>
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
+#include "test_intrusive_michael_michael_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::signal_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, IntrusiveMichaelSet, rcu_implementation );
+
+#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
diff --git a/test/unit/set/intrusive_michael_michael_rcu_sht.cpp b/test/unit/set/intrusive_michael_michael_rcu_sht.cpp
new file mode 100644 (file)
index 0000000..a2e76b5
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+    list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.
+*/
+
+#include <cds/urcu/signal_threaded.h>
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
+#include "test_intrusive_michael_michael_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::signal_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, IntrusiveMichaelSet, rcu_implementation );
+
+#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
diff --git a/test/unit/set/test_intrusive_michael_lazy_rcu.h b/test/unit/set/test_intrusive_michael_lazy_rcu.h
new file mode 100644 (file)
index 0000000..c32fdb6
--- /dev/null
@@ -0,0 +1,298 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+      list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.     
+*/
+#ifndef CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_LAZY_RCU_H
+#define CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_LAZY_RCU_H
+
+#include "test_intrusive_set_rcu.h"
+#include <cds/intrusive/lazy_list_rcu.h>
+#include <cds/intrusive/michael_set_rcu.h>
+
+namespace ci = cds::intrusive;
+
+template <class RCU>
+class IntrusiveMichaelLazySet: public cds_test::intrusive_set_rcu
+{
+    typedef cds_test::intrusive_set_rcu base_class;
+public:
+    typedef cds::urcu::gc<RCU> rcu_type;
+    typedef typename base_class::base_int_item< ci::lazy_list::node<rcu_type>>   base_item_type;
+    typedef typename base_class::base_int_item< ci::lazy_list::node<rcu_type, std::mutex>>   base_mutex_item_type;
+    typedef typename base_class::member_int_item< ci::lazy_list::node<rcu_type>> member_item_type;
+    typedef typename base_class::member_int_item< ci::lazy_list::node<rcu_type, std::mutex>> member_mutex_item_type;
+
+protected:
+    void SetUp()
+    {
+        RCU::Construct();
+        cds::threading::Manager::attachThread();
+    }
+
+    void TearDown()
+    {
+        cds::threading::Manager::detachThread();
+        RCU::Destruct();
+    }
+};
+
+TYPED_TEST_CASE_P( IntrusiveMichaelLazySet );
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, base_cmp )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::base_item_type base_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::template cmp<base_item_type> cmp;
+    typedef typename TestFixture::hash_int hash_int;
+
+    typedef ci::LazyList< rcu_type
+        , base_item_type
+        , typename ci::lazy_list::make_traits<
+            ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< rcu_type > > >
+            , ci::opt::compare< cmp >
+            , ci::opt::disposer< mock_disposer >
+        >::type
+    > bucket_type;
+
+    typedef ci::MichaelHashSet< rcu_type, bucket_type,
+        typename ci::michael_set::make_traits<
+            ci::opt::hash< hash_int >
+        >::type
+    > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, base_less )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::base_item_type base_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::template less<base_item_type> less;
+    typedef typename TestFixture::hash_int hash_int;
+
+    typedef ci::LazyList< rcu_type
+        , base_item_type
+        , typename ci::lazy_list::make_traits<
+            ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< rcu_type >>>
+            , ci::opt::less< less >
+            , ci::opt::disposer< mock_disposer >
+        >::type
+    > bucket_type;
+
+    typedef ci::MichaelHashSet< rcu_type, bucket_type,
+        typename ci::michael_set::make_traits<
+            ci::opt::hash< hash_int >
+        >::type
+    > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, base_cmpmix )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::base_item_type base_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::hash_int hash_int;
+
+    struct list_traits : public ci::lazy_list::traits
+    {
+        typedef ci::lazy_list::base_hook< ci::opt::gc<rcu_type>> hook;
+        typedef typename TestFixture::template less<base_item_type> less;
+        typedef typename TestFixture::template cmp<base_item_type> compare;
+        typedef mock_disposer disposer;
+    };
+    typedef ci::LazyList< rcu_type, base_item_type, list_traits > bucket_type;
+
+    struct set_traits : public ci::michael_set::traits
+    {
+        typedef hash_int hash;
+        typedef typename TestFixture::simple_item_counter item_counter;
+    };
+    typedef ci::MichaelHashSet< rcu_type, bucket_type, set_traits > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, base_mutex )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::base_mutex_item_type base_mutex_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::hash_int hash_int;
+
+    struct list_traits : public ci::lazy_list::traits
+    {
+        typedef ci::lazy_list::base_hook< ci::opt::gc<rcu_type>, ci::opt::lock_type<std::mutex>> hook;
+        typedef typename TestFixture::template less<base_mutex_item_type> less;
+        typedef typename TestFixture::template cmp<base_mutex_item_type> compare;
+        typedef mock_disposer disposer;
+    };
+    typedef ci::LazyList< rcu_type, base_mutex_item_type, list_traits > bucket_type;
+
+    struct set_traits : public ci::michael_set::traits
+    {
+        typedef hash_int hash;
+        typedef typename TestFixture::simple_item_counter item_counter;
+    };
+    typedef ci::MichaelHashSet< rcu_type, bucket_type, set_traits > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, member_cmp )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::member_item_type member_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::template cmp<member_item_type> cmp;
+    typedef typename TestFixture::hash_int hash_int;
+
+    typedef ci::LazyList< rcu_type
+        , member_item_type
+        , typename ci::lazy_list::make_traits<
+            ci::opt::hook< ci::lazy_list::member_hook<
+                offsetof( member_item_type, hMember ),
+                ci::opt::gc<rcu_type>
+            >>
+            , ci::opt::compare< cmp >
+            , ci::opt::disposer< mock_disposer >
+        >::type
+    >    bucket_type;
+
+    typedef ci::MichaelHashSet< rcu_type, bucket_type,
+        typename ci::michael_set::make_traits<
+            ci::opt::hash< hash_int >
+        >::type
+    > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, member_less )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::member_item_type member_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::template less<member_item_type> less;
+    typedef typename TestFixture::hash_int hash_int;
+
+    typedef ci::LazyList< rcu_type
+        , member_item_type
+        , typename ci::lazy_list::make_traits<
+            ci::opt::hook< ci::lazy_list::member_hook<
+                offsetof( member_item_type, hMember ),
+                ci::opt::gc<rcu_type>
+            > >
+            , ci::opt::less< less >
+            , ci::opt::disposer< mock_disposer >
+        >::type
+    > bucket_type;
+
+    typedef ci::MichaelHashSet< rcu_type, bucket_type,
+        typename ci::michael_set::make_traits<
+            ci::opt::hash< hash_int >
+        >::type
+    > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, member_cmpmix )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::member_item_type member_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::hash_int hash_int;
+
+    struct list_traits : public ci::lazy_list::traits
+    {
+        typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<rcu_type>> hook;
+        typedef typename TestFixture::template less<member_item_type> less;
+        typedef typename TestFixture::template cmp<member_item_type> compare;
+        typedef mock_disposer disposer;
+    };
+    typedef ci::LazyList< rcu_type, member_item_type, list_traits > bucket_type;
+
+    struct set_traits : public ci::michael_set::traits
+    {
+        typedef hash_int hash;
+        typedef typename TestFixture::simple_item_counter item_counter;
+    };
+    typedef ci::MichaelHashSet< rcu_type, bucket_type, set_traits > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, member_mutex )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::member_mutex_item_type member_mutex_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::hash_int hash_int;
+
+    struct list_traits : public ci::lazy_list::traits
+    {
+        typedef ci::lazy_list::member_hook< offsetof( member_mutex_item_type, hMember ), ci::opt::gc<rcu_type>, ci::opt::lock_type<std::mutex>> hook;
+        typedef typename TestFixture::template less<member_mutex_item_type> less;
+        typedef typename TestFixture::template cmp<member_mutex_item_type> compare;
+        typedef mock_disposer disposer;
+    };
+    typedef ci::LazyList< rcu_type, member_mutex_item_type, list_traits > bucket_type;
+
+    struct set_traits : public ci::michael_set::traits
+    {
+        typedef hash_int hash;
+        typedef typename TestFixture::simple_item_counter item_counter;
+    };
+    typedef ci::MichaelHashSet< rcu_type, bucket_type, set_traits > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+
+// 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( IntrusiveMichaelLazySet,
+    base_cmp, base_less, base_cmpmix, base_mutex, member_cmp, member_less, member_cmpmix, member_mutex
+);
+
+
+#endif // CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_LAZY_RCU_H
\ No newline at end of file
diff --git a/test/unit/set/test_intrusive_michael_michael_rcu.h b/test/unit/set/test_intrusive_michael_michael_rcu.h
new file mode 100644 (file)
index 0000000..199fef5
--- /dev/null
@@ -0,0 +1,243 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+      list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.     
+*/
+#ifndef CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_MICHAEL_RCU_H
+#define CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_MICHAEL_RCU_H
+
+#include "test_intrusive_set_rcu.h"
+#include <cds/intrusive/michael_list_rcu.h>
+#include <cds/intrusive/michael_set_rcu.h>
+
+namespace ci = cds::intrusive;
+
+template <class RCU>
+class IntrusiveMichaelSet: public cds_test::intrusive_set_rcu
+{
+    typedef cds_test::intrusive_set_rcu base_class;
+public:
+    typedef cds::urcu::gc<RCU> rcu_type;
+    typedef typename base_class::base_int_item< ci::michael_list::node<rcu_type>>   base_item_type;
+    typedef typename base_class::member_int_item< ci::michael_list::node<rcu_type>> member_item_type;
+
+protected:
+    void SetUp()
+    {
+        RCU::Construct();
+        cds::threading::Manager::attachThread();
+    }
+
+    void TearDown()
+    {
+        cds::threading::Manager::detachThread();
+        RCU::Destruct();
+    }
+};
+
+TYPED_TEST_CASE_P( IntrusiveMichaelSet );
+
+TYPED_TEST_P( IntrusiveMichaelSet, base_cmp )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::base_item_type base_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::template cmp<base_item_type> cmp;
+    typedef typename TestFixture::hash_int hash_int;
+
+    typedef ci::MichaelList< rcu_type
+        , base_item_type
+        , typename ci::michael_list::make_traits<
+            ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< rcu_type > > >
+            , ci::opt::compare< cmp >
+            , ci::opt::disposer< mock_disposer >
+        >::type
+    > bucket_type;
+
+    typedef ci::MichaelHashSet< rcu_type, bucket_type,
+        typename ci::michael_set::make_traits<
+            ci::opt::hash< hash_int >
+        >::type
+    > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelSet, base_less )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::base_item_type base_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::template less<base_item_type> less;
+    typedef typename TestFixture::hash_int hash_int;
+
+    typedef ci::MichaelList< rcu_type
+        , base_item_type
+        , typename ci::michael_list::make_traits<
+            ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< rcu_type >>>
+            , ci::opt::less< less >
+            , ci::opt::disposer< mock_disposer >
+        >::type
+    > bucket_type;
+
+    typedef ci::MichaelHashSet< rcu_type, bucket_type,
+        typename ci::michael_set::make_traits<
+            ci::opt::hash< hash_int >
+        >::type
+    > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelSet, base_cmpmix )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::base_item_type base_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::hash_int hash_int;
+
+    struct list_traits : public ci::michael_list::traits
+    {
+        typedef ci::michael_list::base_hook< ci::opt::gc<rcu_type>> hook;
+        typedef typename TestFixture::template less<base_item_type> less;
+        typedef typename TestFixture::template cmp<base_item_type> compare;
+        typedef mock_disposer disposer;
+    };
+    typedef ci::MichaelList< rcu_type, base_item_type, list_traits > bucket_type;
+
+    struct set_traits : public ci::michael_set::traits
+    {
+        typedef hash_int hash;
+        typedef typename TestFixture::simple_item_counter item_counter;
+    };
+    typedef ci::MichaelHashSet< rcu_type, bucket_type, set_traits > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+
+TYPED_TEST_P( IntrusiveMichaelSet, member_cmp )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::member_item_type member_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::template cmp<member_item_type> cmp;
+    typedef typename TestFixture::hash_int hash_int;
+
+    typedef ci::MichaelList< rcu_type
+        , member_item_type
+        , typename ci::michael_list::make_traits<
+            ci::opt::hook< ci::michael_list::member_hook<
+                offsetof( member_item_type, hMember ),
+                ci::opt::gc<rcu_type>
+            >>
+            , ci::opt::compare< cmp >
+            , ci::opt::disposer< mock_disposer >
+        >::type
+    >    bucket_type;
+
+    typedef ci::MichaelHashSet< rcu_type, bucket_type,
+        typename ci::michael_set::make_traits<
+            ci::opt::hash< hash_int >
+        >::type
+    > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelSet, member_less )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::member_item_type member_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::template less<member_item_type> less;
+    typedef typename TestFixture::hash_int hash_int;
+
+    typedef ci::MichaelList< rcu_type
+        , member_item_type
+        , typename ci::michael_list::make_traits<
+            ci::opt::hook< ci::michael_list::member_hook<
+                offsetof( member_item_type, hMember ),
+                ci::opt::gc<rcu_type>
+            > >
+            , ci::opt::less< less >
+            , ci::opt::disposer< mock_disposer >
+        >::type
+    > bucket_type;
+
+    typedef ci::MichaelHashSet< rcu_type, bucket_type,
+        typename ci::michael_set::make_traits<
+            ci::opt::hash< hash_int >
+        >::type
+    > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelSet, member_cmpmix )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::member_item_type member_item_type;
+    typedef typename TestFixture::mock_disposer mock_disposer;
+    typedef typename TestFixture::hash_int hash_int;
+
+    struct list_traits : public ci::michael_list::traits
+    {
+        typedef ci::michael_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<rcu_type>> hook;
+        typedef typename TestFixture::template less<member_item_type> less;
+        typedef typename TestFixture::template cmp<member_item_type> compare;
+        typedef mock_disposer disposer;
+    };
+    typedef ci::MichaelList< rcu_type, member_item_type, list_traits > bucket_type;
+
+    struct set_traits : public ci::michael_set::traits
+    {
+        typedef hash_int hash;
+        typedef typename TestFixture::simple_item_counter item_counter;
+    };
+    typedef ci::MichaelHashSet< rcu_type, bucket_type, set_traits > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+
+
+// 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( IntrusiveMichaelSet,
+    base_cmp, base_less, base_cmpmix, member_cmp, member_less, member_cmpmix
+);
+
+
+#endif // CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_MICHAEL_RCU_H
\ No newline at end of file
index 139c92a9e67c9a2bca93240c95ad45f25f11acf8..d4ed30351081c37eb02bb251ab45b96ec0a84337 100644 (file)
@@ -47,7 +47,7 @@ namespace cds_test {
 
     class intrusive_set: public fixture
     {
-    protected:
+    public:
         static size_t const kSize = 100;
 
         struct stat
@@ -258,6 +258,7 @@ namespace cds_test {
             }
         };
 
+    protected:
         template <class Set>
         void test( Set& s )
         {
@@ -266,6 +267,7 @@ namespace cds_test {
 
             ASSERT_TRUE( s.empty() );
             ASSERT_CONTAINER_SIZE( s, 0 );
+            size_t const nSetSize = kSize;
 
             typedef typename Set::value_type value_type;
 
@@ -339,7 +341,7 @@ namespace cds_test {
                 EXPECT_EQ( i.nFindCount, 2 );
             }
             ASSERT_FALSE( s.empty() );
-            ASSERT_CONTAINER_SIZE( s, kSize );
+            ASSERT_CONTAINER_SIZE( s, nSetSize );
 
             std::for_each( data.begin(), data.end(), []( value_type& v ) { v.clear_stat(); });
 
@@ -413,7 +415,7 @@ namespace cds_test {
                 ASSERT_TRUE( s.insert( i ));
             }
             ASSERT_FALSE( s.empty() );
-            ASSERT_CONTAINER_SIZE( s, kSize );
+            ASSERT_CONTAINER_SIZE( s, nSetSize );
 
             // Iterator test
             for ( auto it = s.begin(); it != s.end(); ++it ) {
index 7c122c52b06697bee7ad00e55fd5a627e7e087cd..7ae09c73415d9c9b528a93e5d9f6cb29f53f867f 100644 (file)
@@ -103,17 +103,17 @@ namespace cds_test {
 
                 EXPECT_EQ( i.nFindCount, 0 );
                 gp = s.get( i );
-                ASSERT_TRUE( gp );
+                ASSERT_FALSE( !gp );
                 ++gp->nFindCount;
                 EXPECT_EQ( i.nFindCount, 1 );
 
                 gp = s.get( i.key() );
-                ASSERT_TRUE( gp );
+                ASSERT_FALSE( !gp );
                 ++gp->nFindCount;
                 EXPECT_EQ( i.nFindCount, 2 );
 
                 gp = s.get_with( other_item( i.key()), other_less());
-                ASSERT_TRUE( gp );
+                ASSERT_FALSE( !gp );
                 ++gp->nFindCount;
                 EXPECT_EQ( i.nFindCount, 3 );
 
@@ -129,7 +129,7 @@ namespace cds_test {
                     gp = s.extract_with( other_item( i.key() ), other_less() );
                     break;
                 }
-                ASSERT_TRUE( gp );
+                ASSERT_FALSE( !gp );
                 ++gp->nEraseCount;
                 EXPECT_EQ( i.nEraseCount, 1 );
 
diff --git a/test/unit/set/test_intrusive_set_nogc.h b/test/unit/set/test_intrusive_set_nogc.h
new file mode 100644 (file)
index 0000000..46e06a5
--- /dev/null
@@ -0,0 +1,374 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    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:
+
+    * Redistributions of source code must retain the above copyright notice, this
+      list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    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.     
+*/
+
+#ifndef CDSUNIT_SET_TEST_INTRUSIVE_SET_NOGC_H
+#define CDSUNIT_SET_TEST_INTRUSIVE_SET_NOGC_H
+
+#include <cds_test/check_size.h>
+#include <cds_test/fixture.h>
+
+#include <cds/opt/hash.h>
+#include <functional>   // ref
+
+// forward declaration
+namespace cds { namespace intrusive {}}
+
+namespace cds_test {
+
+    namespace ci = cds::intrusive;
+    namespace co = cds::opt;
+
+    class intrusive_set_nogc: public fixture
+    {
+    public:
+        static size_t const kSize = 100;
+
+        struct stat
+        {
+            unsigned int nFindCount     ;   // count of find-functor calling
+            unsigned int nUpdateNewCount;
+            unsigned int nUpdateCount;
+            unsigned int nDisposeCount;
+
+            stat()
+            {
+                clear_stat();
+            }
+
+            void clear_stat()
+            {
+                memset( this, 0, sizeof( *this ) );
+            }
+        };
+
+        template <typename Node>
+        struct base_int_item
+            : public Node
+            , public stat
+
+        {
+            int nKey;
+            int nVal;
+
+            base_int_item()
+            {}
+
+            explicit base_int_item( int key )
+                : nKey( key )
+                , nVal( key )
+            {}
+
+            base_int_item(int key, int val)
+                : nKey( key )
+                , nVal(val)
+            {}
+
+            base_int_item( base_int_item const& v )
+                : Node()
+                , stat()
+                , nKey( v.nKey )
+                , nVal( v.nVal )
+            {}
+
+            int key() const
+            {
+                return nKey;
+            }
+        };
+
+        template <typename Node>
+        struct member_int_item: public stat
+        {
+            int nKey;
+            int nVal;
+
+            Node hMember;
+
+            stat s;
+
+            member_int_item()
+            {}
+
+            explicit member_int_item( int key )
+                : nKey( key )
+                , nVal( key )
+            {}
+
+            member_int_item(int key, int val)
+                : nKey( key )
+                , nVal(val)
+            {}
+
+            member_int_item(member_int_item const& v )
+                : stat()
+                , nKey( v.nKey )
+                , nVal( v.nVal )
+            {}
+
+            int key() const
+            {
+                return nKey;
+            }
+        };
+
+        struct hash_int {
+            size_t operator()( int i ) const
+            {
+                return co::v::hash<int>()( i );
+            }
+            template <typename Item>
+            size_t operator()( const Item& i ) const
+            {
+                return (*this)( i.key() );
+            }
+        };
+
+        struct simple_item_counter {
+            size_t  m_nCount;
+
+            simple_item_counter()
+                : m_nCount(0)
+            {}
+
+            size_t operator ++()
+            {
+                return ++m_nCount;
+            }
+
+            size_t operator --()
+            {
+                return --m_nCount;
+            }
+
+            void reset()
+            {
+                m_nCount = 0;
+            }
+
+            operator size_t() const
+            {
+                return m_nCount;
+            }
+
+        };
+
+
+        template <typename T>
+        struct less
+        {
+            bool operator ()(const T& v1, const T& v2 ) const
+            {
+                return v1.key() < v2.key();
+            }
+
+            template <typename Q>
+            bool operator ()(const T& v1, const Q& v2 ) const
+            {
+                return v1.key() < v2;
+            }
+
+            template <typename Q>
+            bool operator ()(const Q& v1, const T& v2 ) const
+            {
+                return v1 < v2.key();
+            }
+        };
+
+        template <typename T>
+        struct cmp {
+            int operator ()(const T& v1, const T& v2 ) const
+            {
+                if ( v1.key() < v2.key() )
+                    return -1;
+                return v1.key() > v2.key() ? 1 : 0;
+            }
+
+            template <typename Q>
+            int operator ()(const T& v1, const Q& v2 ) const
+            {
+                if ( v1.key() < v2 )
+                    return -1;
+                return v1.key() > v2 ? 1 : 0;
+            }
+
+            template <typename Q>
+            int operator ()(const Q& v1, const T& v2 ) const
+            {
+                if ( v1 < v2.key() )
+                    return -1;
+                return v1 > v2.key() ? 1 : 0;
+            }
+        };
+
+        struct other_item {
+            int nKey;
+
+            explicit other_item( int k )
+                : nKey( k )
+            {}
+
+            int key() const
+            {
+                return nKey;
+            }
+        };
+
+        struct other_less {
+            template <typename Q, typename T>
+            bool operator()( Q const& lhs, T const& rhs ) const
+            {
+                return lhs.key() < rhs.key();
+            }
+        };
+
+        struct mock_disposer
+        {
+            template <typename T>
+            void operator ()( T * p )
+            {
+                ++p->nDisposeCount;
+            }
+        };
+
+    protected:
+        template <class Set>
+        void test( Set& s )
+        {
+            // Precondition: set is empty
+            // Postcondition: set is empty
+
+            ASSERT_TRUE( s.empty() );
+            ASSERT_CONTAINER_SIZE( s, 0 );
+            size_t const nSetSize = kSize;
+
+            typedef typename Set::value_type value_type;
+
+            std::vector< value_type > data;
+            std::vector< size_t> indices;
+            data.reserve( kSize );
+            indices.reserve( kSize );
+            for ( size_t key = 0; key < kSize; ++key ) {
+                data.push_back( value_type( static_cast<int>( key )));
+                indices.push_back( key );
+            }
+            shuffle( indices.begin(), indices.end() );
+
+            // insert/find
+            for ( auto idx : indices ) {
+                auto& i = data[ idx ];
+
+                ASSERT_TRUE( s.contains( i.nKey ) == nullptr );
+                ASSERT_TRUE( s.contains( i ) == nullptr );
+                ASSERT_TRUE( s.contains( other_item( i.key()), other_less()) == nullptr );
+                ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} ));
+                ASSERT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} ));
+
+                std::pair<bool, bool> updResult;
+
+                updResult = s.update( i, []( bool bNew, value_type&, value_type& )
+                {
+                    ASSERT_TRUE( false );
+                }, false );
+                EXPECT_FALSE( updResult.first );
+                EXPECT_FALSE( updResult.second );
+
+                switch ( i.key() % 2 ) {
+                case 0:
+                    ASSERT_TRUE( s.insert( i ));
+                    ASSERT_FALSE( s.insert( i ));
+                    EXPECT_EQ( i.nUpdateCount, 0 );
+                    updResult = s.update( i, []( bool bNew, value_type& val, value_type& arg) 
+                        {
+                            EXPECT_FALSE( bNew );
+                            EXPECT_EQ( &val, &arg );
+                            ++val.nUpdateCount;
+                        }, false );
+                    EXPECT_TRUE( updResult.first );
+                    EXPECT_FALSE( updResult.second );
+                    EXPECT_EQ( i.nUpdateCount, 1 );
+                    break;
+                case 1:
+                    EXPECT_EQ( i.nUpdateNewCount, 0 );
+                    updResult = s.update( i, []( bool bNew, value_type& val, value_type& arg )
+                    {
+                        EXPECT_TRUE( bNew );
+                        EXPECT_EQ( &val, &arg );
+                        ++val.nUpdateNewCount;
+                    });
+                    EXPECT_TRUE( updResult.first );
+                    EXPECT_TRUE( updResult.second );
+                    EXPECT_EQ( i.nUpdateNewCount, 1 );
+                    break;
+                }
+
+                ASSERT_TRUE( s.contains( i.nKey ) == &i );
+                ASSERT_TRUE( s.contains( i ) == &i );
+                ASSERT_TRUE( s.contains( other_item( i.key() ), other_less()) == &i );
+                EXPECT_EQ( i.nFindCount, 0 );
+                ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } ));
+                EXPECT_EQ( i.nFindCount, 1 );
+                ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } ));
+                EXPECT_EQ( i.nFindCount, 2 );
+            }
+            ASSERT_FALSE( s.empty() );
+            ASSERT_CONTAINER_SIZE( s, nSetSize );
+
+            std::for_each( data.begin(), data.end(), []( value_type& v ) { v.clear_stat(); });
+
+            // Iterator test
+            for ( auto it = s.begin(); it != s.end(); ++it ) {
+                ++it->nFindCount;
+            }
+            for ( auto it = s.cbegin(); it != s.cend(); ++it ) {
+                EXPECT_EQ( it->nFindCount, 1 );
+            }
+            for ( auto& i : data ) {
+                EXPECT_EQ( i.nFindCount, 1 );
+            }
+
+            // clear test
+            for ( auto& i : data ) {
+                EXPECT_EQ( i.nDisposeCount, 0 );
+            }
+            s.clear();
+            for ( auto& i : data ) {
+                EXPECT_EQ( i.nDisposeCount, 1 );
+            }
+
+            ASSERT_TRUE( s.empty());
+            ASSERT_CONTAINER_SIZE( s, 0 );
+            ASSERT_TRUE( s.begin() == s.end() );
+            ASSERT_TRUE( s.cbegin() == s.cend() );
+        }
+    };
+
+} // namespace cds_test
+
+#endif // #ifndef CDSUNIT_SET_TEST_INTRUSIVE_SET_NOGC_H
index 416f3e9473d1c9f8efffcdc793ada4b4e588d006..ff28bef3968f51bda89bbbcaa76c7136dcc88072 100644 (file)
@@ -122,46 +122,53 @@ namespace cds_test {
                     rcu_lock l;
                     EXPECT_EQ( i.nFindCount, 0 );
                     rp = s.get( i );
-                    ASSERT_TRUE( rp );
+                    ASSERT_FALSE( !rp );
                     ++rp->nFindCount;
                     EXPECT_EQ( i.nFindCount, 1 );
 
                     rp = s.get( i.key() );
-                    ASSERT_TRUE( rp );
+                    ASSERT_FALSE( !rp );
                     ++rp->nFindCount;
                     EXPECT_EQ( i.nFindCount, 2 );
 
                     rp = s.get_with( other_item( i.key()), other_less());
-                    ASSERT_TRUE( rp );
+                    ASSERT_FALSE( !rp );
                     ++rp->nFindCount;
                     EXPECT_EQ( i.nFindCount, 3 );
                 }
 
                 if ( Set::c_bExtractLockExternal ) {
-                    rcu_lock l;
+                    {
+                        rcu_lock l;
+
+                        EXPECT_EQ( i.nEraseCount, 0 );
+                        switch ( i.key() % 3 ) {
+                        case 0:
+                            xp = s.extract( i.key());
+                            break;
+                        case 1:
+                            xp = s.extract( i );
+                            break;
+                        case 2:
+                            xp = s.extract_with( other_item( i.key() ), other_less() );
+                            break;
+                        }
+                        ASSERT_FALSE( !xp );
+                        ++xp->nEraseCount;
+                    }
+                    EXPECT_EQ( i.nEraseCount, 1 );
+                    xp.release();
+
+                    {
+                        rcu_lock l;
 
-                    EXPECT_EQ( i.nEraseCount, 0 );
-                    switch ( i.key() % 3 ) {
-                    case 0:
-                        xp = s.extract( i.key());
-                        break;
-                    case 1:
                         xp = s.extract( i );
-                        break;
-                    case 2:
+                        ASSERT_TRUE( !xp );
+                        xp = s.extract( i.key() );
+                        ASSERT_TRUE( !xp );
                         xp = s.extract_with( other_item( i.key() ), other_less() );
-                        break;
+                        ASSERT_TRUE( !xp );
                     }
-                    ASSERT_TRUE( xp );
-                    ++xp->nEraseCount;
-                    EXPECT_EQ( i.nEraseCount, 1 );
-
-                    xp = s.extract( i );
-                    ASSERT_TRUE( !xp );
-                    xp = s.extract( i.key() );
-                    ASSERT_TRUE( !xp );
-                    xp = s.extract_with( other_item( i.key() ), other_less() );
-                    ASSERT_TRUE( !xp );
                 }
                 else {
                     EXPECT_EQ( i.nEraseCount, 0 );
@@ -176,7 +183,7 @@ namespace cds_test {
                         xp = s.extract_with( other_item( i.key() ), other_less() );
                         break;
                     }
-                    ASSERT_TRUE( xp );
+                    ASSERT_FALSE( !xp );
                     ++xp->nEraseCount;
                     EXPECT_EQ( i.nEraseCount, 1 );