Migrated MichaelHashSet unit test to gtest framework
authorkhizmax <libcds.dev@gmail.com>
Thu, 17 Mar 2016 19:49:52 +0000 (22:49 +0300)
committerkhizmax <libcds.dev@gmail.com>
Thu, 17 Mar 2016 19:49:52 +0000 (22:49 +0300)
14 files changed:
projects/Win/vc14/gtest-set.vcxproj
projects/Win/vc14/gtest-set.vcxproj.filters
test/unit/set/CMakeLists.txt
test/unit/set/michael_lazy_dhp.cpp [new file with mode: 0644]
test/unit/set/michael_lazy_hp.cpp [new file with mode: 0644]
test/unit/set/michael_lazy_nogc.cpp [new file with mode: 0644]
test/unit/set/michael_lazy_rcu_gpb.cpp [new file with mode: 0644]
test/unit/set/michael_lazy_rcu_gpi.cpp [new file with mode: 0644]
test/unit/set/michael_lazy_rcu_gpt.cpp [new file with mode: 0644]
test/unit/set/michael_lazy_rcu_shb.cpp [new file with mode: 0644]
test/unit/set/michael_lazy_rcu_sht.cpp [new file with mode: 0644]
test/unit/set/michael_michael_dhp.cpp
test/unit/set/test_michael_lazy_rcu.h [new file with mode: 0644]
test/unit/set/test_set_rcu.h

index b4a380e83fd81855bbd2d3eda9e757d7af39a9e1..6c27a5a8b665a95ca26cfb1816c009cd5b0add2c 100644 (file)
   </ItemGroup>\r
   <ItemGroup>\r
     <ClCompile Include="..\..\..\test\unit\main.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_dhp.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_hp.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_nogc.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_rcu_gpb.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_rcu_gpi.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\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\michael_lazy_rcu_shb.cpp" />\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_rcu_sht.cpp" />\r
     <ClCompile Include="..\..\..\test\unit\set\michael_michael_dhp.cpp" />\r
     <ClCompile Include="..\..\..\test\unit\set\michael_michael_hp.cpp" />\r
     <ClCompile Include="..\..\..\test\unit\set\michael_michael_nogc.cpp" />\r
@@ -52,6 +67,8 @@
     <ClCompile Include="..\..\..\test\unit\set\michael_michael_rcu_sht.cpp" />\r
   </ItemGroup>\r
   <ItemGroup>\r
+    <ClInclude Include="..\..\..\test\unit\set\test_michael_lazy_rcu.h" />\r
+    <ClInclude Include="..\..\..\test\unit\set\test_michael_michael_rcu.h" />\r
     <ClInclude Include="..\..\..\test\unit\set\test_set.h" />\r
     <ClInclude Include="..\..\..\test\unit\set\test_set_hp.h" />\r
     <ClInclude Include="..\..\..\test\unit\set\test_set_nogc.h" />\r
index df7f87525bb91be0e027b9da8663b49b075398bb..b279b0a6b4694ca09a70882d322c2f5650de40bb 100644 (file)
     <ClCompile Include="..\..\..\test\unit\set\michael_michael_nogc.cpp">\r
       <Filter>Source Files\MichaelSet</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_hp.cpp">\r
+      <Filter>Source Files\MichaelSet</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_dhp.cpp">\r
+      <Filter>Source Files\MichaelSet</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_rcu_gpb.cpp">\r
+      <Filter>Source Files\MichaelSet</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_rcu_gpi.cpp">\r
+      <Filter>Source Files\MichaelSet</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_rcu_gpt.cpp">\r
+      <Filter>Source Files\MichaelSet</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_rcu_shb.cpp">\r
+      <Filter>Source Files\MichaelSet</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_rcu_sht.cpp">\r
+      <Filter>Source Files\MichaelSet</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\test\unit\set\michael_lazy_nogc.cpp">\r
+      <Filter>Source Files\MichaelSet</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\..\test\unit\set\test_set.h">\r
     <ClInclude Include="..\..\..\test\unit\set\test_set_nogc.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\..\..\test\unit\set\test_michael_lazy_rcu.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\..\..\test\unit\set\test_michael_michael_rcu.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
index 8691e718341c6cbc4a5cd1eaa94798b09a12a62e..9dc0776a8d88f54c8afe9860c44f08d3a2a9dc99 100644 (file)
@@ -2,6 +2,14 @@ set(PACKAGE_NAME unit-set)
 
 set(CDSGTEST_SET_SOURCES
     ../main.cpp
+    michael_lazy_hp.cpp
+    michael_lazy_dhp.cpp
+    michael_lazy_nogc.cpp
+    michael_lazy_rcu_gpb.cpp
+    michael_lazy_rcu_gpi.cpp
+    michael_lazy_rcu_gpt.cpp
+    michael_lazy_rcu_shb.cpp
+    michael_lazy_rcu_sht.cpp
     michael_michael_hp.cpp
     michael_michael_dhp.cpp
     michael_michael_nogc.cpp
diff --git a/test/unit/set/michael_lazy_dhp.cpp b/test/unit/set/michael_lazy_dhp.cpp
new file mode 100644 (file)
index 0000000..1ec2a93
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+    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_set_hp.h"
+
+#include <cds/container/lazy_list_dhp.h>
+#include <cds/container/michael_set.h>
+
+namespace {
+    namespace cc = cds::container;
+    typedef cds::gc::DHP gc_type;
+
+    class MichaelLazySet_DHP : public cds_test::container_set_hp
+    {
+    protected:
+        typedef cds_test::container_set_hp base_class;
+
+        void SetUp()
+        {
+            typedef cc::LazyList< gc_type, int_item > list_type;
+            typedef cc::MichaelHashSet< gc_type, list_type >   set_type;
+
+            cds::gc::dhp::GarbageCollector::Construct( 16, set_type::c_nHazardPtrCount );
+            cds::threading::Manager::attachThread();
+        }
+
+        void TearDown()
+        {
+            cds::threading::Manager::detachThread();
+            cds::gc::dhp::GarbageCollector::Destruct();
+        }
+    };
+
+    TEST_F( MichaelLazySet_DHP, compare )
+    {
+        typedef cc::LazyList< gc_type, int_item,
+            typename cc::lazy_list::make_traits<
+                cds::opt::compare< cmp >
+            >::type
+        > list_type;
+
+        typedef cc::MichaelHashSet< gc_type, list_type, 
+            typename cc::michael_set::make_traits<
+                cds::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_DHP, less )
+    {
+        typedef cc::LazyList< gc_type, int_item,
+            typename cc::lazy_list::make_traits<
+                cds::opt::less< base_class::less >
+            >::type
+        > list_type;
+
+        typedef cc::MichaelHashSet< gc_type, list_type, 
+            typename cc::michael_set::make_traits<
+                cds::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_DHP, cmpmix )
+    {
+        struct list_traits : public cc::lazy_list::traits
+        {
+            typedef base_class::less less;
+            typedef cmp compare;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        typedef cc::MichaelHashSet< gc_type, list_type, 
+            typename cc::michael_set::make_traits<
+                cds::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_DHP, item_counting )
+    {
+        struct list_traits : public cc::lazy_list::traits
+        {
+            typedef cmp compare;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        struct set_traits: public cc::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef simple_item_counter item_counter;
+        };
+        typedef cc::MichaelHashSet< gc_type, list_type, set_traits >set_type;
+
+        set_type s( kSize, 3 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_DHP, backoff )
+    {
+        struct list_traits : public cc::lazy_list::traits
+        {
+            typedef cmp compare;
+            typedef cds::backoff::exponential<cds::backoff::pause, cds::backoff::yield> back_off;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        struct set_traits : public cc::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef cds::atomicity::item_counter item_counter;
+        };
+        typedef cc::MichaelHashSet< gc_type, list_type, set_traits >set_type;
+
+        set_type s( kSize, 4 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_DHP, seq_cst )
+    {
+        struct list_traits : public cc::lazy_list::traits
+        {
+            typedef base_class::less less;
+            typedef cds::backoff::pause back_off;
+            typedef cds::opt::v::sequential_consistent memory_model;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        struct set_traits : public cc::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef cds::atomicity::item_counter item_counter;
+        };
+        typedef cc::MichaelHashSet< gc_type, list_type, set_traits >set_type;
+
+        set_type s( kSize, 4 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_DHP, mutex )
+    {
+        struct list_traits: public cc::lazy_list::traits
+        {
+            typedef base_class::less less;
+            typedef cds::backoff::pause back_off;
+            typedef std::mutex lock_type;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        struct set_traits: public cc::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef cds::atomicity::item_counter item_counter;
+        };
+        typedef cc::MichaelHashSet< gc_type, list_type, set_traits >set_type;
+
+        set_type s( kSize, 4 );
+        test( s );
+    }
+
+} // namespace
diff --git a/test/unit/set/michael_lazy_hp.cpp b/test/unit/set/michael_lazy_hp.cpp
new file mode 100644 (file)
index 0000000..af16339
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+    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_set_hp.h"
+
+#include <cds/container/lazy_list_hp.h>
+#include <cds/container/michael_set.h>
+
+namespace {
+    namespace cc = cds::container;
+    typedef cds::gc::HP gc_type;
+
+    class MichaelLazySet_HP : public cds_test::container_set_hp
+    {
+    protected:
+        typedef cds_test::container_set_hp base_class;
+
+        void SetUp()
+        {
+            typedef cc::LazyList< gc_type, int_item > list_type;
+            typedef cc::MichaelHashSet< gc_type, list_type >   set_type;
+
+            // +1 - for guarded_ptr
+            cds::gc::hp::GarbageCollector::Construct( set_type::c_nHazardPtrCount + 1, 1, 16 );
+            cds::threading::Manager::attachThread();
+        }
+
+        void TearDown()
+        {
+            cds::threading::Manager::detachThread();
+            cds::gc::hp::GarbageCollector::Destruct( true );
+        }
+    };
+
+    TEST_F( MichaelLazySet_HP, compare )
+    {
+        typedef cc::LazyList< gc_type, int_item,
+            typename cc::lazy_list::make_traits<
+                cds::opt::compare< cmp >
+            >::type
+        > list_type;
+
+        typedef cc::MichaelHashSet< gc_type, list_type, 
+            typename cc::michael_set::make_traits<
+                cds::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_HP, less )
+    {
+        typedef cc::LazyList< gc_type, int_item,
+            typename cc::lazy_list::make_traits<
+                cds::opt::less< base_class::less >
+            >::type
+        > list_type;
+
+        typedef cc::MichaelHashSet< gc_type, list_type, 
+            typename cc::michael_set::make_traits<
+                cds::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_HP, cmpmix )
+    {
+        struct list_traits : public cc::lazy_list::traits
+        {
+            typedef base_class::less less;
+            typedef cmp compare;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        typedef cc::MichaelHashSet< gc_type, list_type, 
+            typename cc::michael_set::make_traits<
+                cds::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_HP, item_counting )
+    {
+        struct list_traits : public cc::lazy_list::traits
+        {
+            typedef cmp compare;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        struct set_traits: public cc::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef simple_item_counter item_counter;
+        };
+        typedef cc::MichaelHashSet< gc_type, list_type, set_traits >set_type;
+
+        set_type s( kSize, 3 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_HP, backoff )
+    {
+        struct list_traits : public cc::lazy_list::traits
+        {
+            typedef cmp compare;
+            typedef cds::backoff::exponential<cds::backoff::pause, cds::backoff::yield> back_off;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        struct set_traits : public cc::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef cds::atomicity::item_counter item_counter;
+        };
+        typedef cc::MichaelHashSet< gc_type, list_type, set_traits >set_type;
+
+        set_type s( kSize, 4 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_HP, seq_cst )
+    {
+        struct list_traits : public cc::lazy_list::traits
+        {
+            typedef base_class::less less;
+            typedef cds::backoff::pause back_off;
+            typedef cds::opt::v::sequential_consistent memory_model;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        struct set_traits : public cc::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef cds::atomicity::item_counter item_counter;
+        };
+        typedef cc::MichaelHashSet< gc_type, list_type, set_traits >set_type;
+
+        set_type s( kSize, 4 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_HP, mutex )
+    {
+        struct list_traits: public cc::lazy_list::traits
+        {
+            typedef base_class::less less;
+            typedef cds::backoff::pause back_off;
+            typedef std::mutex lock_type;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        struct set_traits: public cc::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef cds::atomicity::item_counter item_counter;
+        };
+        typedef cc::MichaelHashSet< gc_type, list_type, set_traits >set_type;
+
+        set_type s( kSize, 4 );
+        test( s );
+    }
+
+} // namespace
diff --git a/test/unit/set/michael_lazy_nogc.cpp b/test/unit/set/michael_lazy_nogc.cpp
new file mode 100644 (file)
index 0000000..0a7751c
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+    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_set_nogc.h"
+
+#include <cds/container/lazy_list_nogc.h>
+#include <cds/container/michael_set_nogc.h>
+
+namespace {
+    namespace cc = cds::container;
+    typedef cds::gc::nogc gc_type;
+
+    class MichaelLazySet_NoGC : public cds_test::container_set_nogc
+    {
+    protected:
+        typedef cds_test::container_set_nogc base_class;
+
+        //void SetUp()
+        //{}
+
+        //void TearDown()
+        //{}
+    };
+
+    TEST_F( MichaelLazySet_NoGC, compare )
+    {
+        typedef cc::LazyList< gc_type, int_item,
+            typename cc::lazy_list::make_traits<
+                cds::opt::compare< cmp >
+            >::type
+        > list_type;
+
+        typedef cc::MichaelHashSet< gc_type, list_type, 
+            typename cc::michael_set::make_traits<
+                cds::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_NoGC, less )
+    {
+        typedef cc::LazyList< gc_type, int_item,
+            typename cc::lazy_list::make_traits<
+                cds::opt::less< base_class::less >
+            >::type
+        > list_type;
+
+        typedef cc::MichaelHashSet< gc_type, list_type, 
+            typename cc::michael_set::make_traits<
+                cds::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_NoGC, cmpmix )
+    {
+        struct list_traits : public cc::lazy_list::traits
+        {
+            typedef base_class::less less;
+            typedef cmp compare;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        typedef cc::MichaelHashSet< gc_type, list_type, 
+            typename cc::michael_set::make_traits<
+                cds::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_NoGC, item_counting )
+    {
+        struct list_traits : public cc::lazy_list::traits
+        {
+            typedef cmp compare;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        struct set_traits: public cc::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef simple_item_counter item_counter;
+        };
+        typedef cc::MichaelHashSet< gc_type, list_type, set_traits >set_type;
+
+        set_type s( kSize, 3 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_NoGC, backoff )
+    {
+        struct list_traits : public cc::lazy_list::traits
+        {
+            typedef cmp compare;
+            typedef cds::backoff::exponential<cds::backoff::pause, cds::backoff::yield> back_off;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        struct set_traits : public cc::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef cds::atomicity::item_counter item_counter;
+        };
+        typedef cc::MichaelHashSet< gc_type, list_type, set_traits >set_type;
+
+        set_type s( kSize, 4 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_NoGC, seq_cst )
+    {
+        struct list_traits : public cc::lazy_list::traits
+        {
+            typedef base_class::less less;
+            typedef cds::backoff::pause back_off;
+            typedef cds::opt::v::sequential_consistent memory_model;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        struct set_traits : public cc::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef cds::atomicity::item_counter item_counter;
+        };
+        typedef cc::MichaelHashSet< gc_type, list_type, set_traits >set_type;
+
+        set_type s( kSize, 4 );
+        test( s );
+    }
+
+    TEST_F( MichaelLazySet_NoGC, mutex )
+    {
+        struct list_traits : public cc::lazy_list::traits
+        {
+            typedef base_class::less less;
+            typedef cds::backoff::pause back_off;
+            typedef std::mutex lock_type;
+        };
+        typedef cc::LazyList< gc_type, int_item, list_traits > list_type;
+
+        struct set_traits : public cc::michael_set::traits
+        {
+            typedef hash_int hash;
+            typedef cds::atomicity::item_counter item_counter;
+        };
+        typedef cc::MichaelHashSet< gc_type, list_type, set_traits >set_type;
+
+        set_type s( kSize, 4 );
+        test( s );
+    }
+
+} // namespace
diff --git a/test/unit/set/michael_lazy_rcu_gpb.cpp b/test/unit/set/michael_lazy_rcu_gpb.cpp
new file mode 100644 (file)
index 0000000..6cdf4f0
--- /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_michael_lazy_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::general_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, MichaelLazySet, rcu_implementation );
diff --git a/test/unit/set/michael_lazy_rcu_gpi.cpp b/test/unit/set/michael_lazy_rcu_gpi.cpp
new file mode 100644 (file)
index 0000000..f81152c
--- /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_michael_lazy_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::general_instant<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, MichaelLazySet, rcu_implementation );
diff --git a/test/unit/set/michael_lazy_rcu_gpt.cpp b/test/unit/set/michael_lazy_rcu_gpt.cpp
new file mode 100644 (file)
index 0000000..3e7e917
--- /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_michael_lazy_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::general_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, MichaelLazySet, rcu_implementation );
diff --git a/test/unit/set/michael_lazy_rcu_shb.cpp b/test/unit/set/michael_lazy_rcu_shb.cpp
new file mode 100644 (file)
index 0000000..0f65501
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+    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_michael_lazy_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::signal_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, MichaelLazySet, rcu_implementation );
+
+#endif // CDS_URCU_SIGNAL_HANDLING_ENABLED
diff --git a/test/unit/set/michael_lazy_rcu_sht.cpp b/test/unit/set/michael_lazy_rcu_sht.cpp
new file mode 100644 (file)
index 0000000..db2bbb5
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+    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_michael_lazy_rcu.h"
+
+namespace {
+
+    typedef cds::urcu::signal_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, MichaelLazySet, rcu_implementation );
+
+#endif // CDS_URCU_SIGNAL_HANDLING_ENABLED
index fa38663504926785bb01fd694d0cf51f0ace4c00..73f8b1f6753e3cd713915a8c9842e11c6ae1016f 100644 (file)
@@ -47,7 +47,6 @@ namespace {
             typedef cc::MichaelList< gc_type, int_item > list_type;
             typedef cc::MichaelHashSet< gc_type, list_type >   set_type;
 
-            // +1 - for guarded_ptr
             cds::gc::dhp::GarbageCollector::Construct( 16, set_type::c_nHazardPtrCount );
             cds::threading::Manager::attachThread();
         }
diff --git a/test/unit/set/test_michael_lazy_rcu.h b/test/unit/set/test_michael_lazy_rcu.h
new file mode 100644 (file)
index 0000000..832fcaf
--- /dev/null
@@ -0,0 +1,228 @@
+/*
+    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_MICHAEL_LAZY_RCU_H
+#define CDSUNIT_SET_TEST_MICHAEL_LAZY_RCU_H
+
+#include "test_set_rcu.h"
+#include <cds/container/lazy_list_rcu.h>
+#include <cds/container/michael_set_rcu.h>
+
+namespace cc = cds::container;
+
+template <class RCU>
+class MichaelLazySet: public cds_test::container_set_rcu
+{
+    typedef cds_test::container_set_rcu base_class;
+public:
+    typedef cds::urcu::gc<RCU> rcu_type;
+
+protected:
+    void SetUp()
+    {
+        RCU::Construct();
+        cds::threading::Manager::attachThread();
+    }
+
+    void TearDown()
+    {
+        cds::threading::Manager::detachThread();
+        RCU::Destruct();
+    }
+};
+
+TYPED_TEST_CASE_P( MichaelLazySet );
+
+TYPED_TEST_P( MichaelLazySet, compare )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::int_item int_item;
+
+    typedef cc::LazyList< rcu_type, int_item,
+        typename cc::lazy_list::make_traits<
+            cds::opt::compare< typename TestFixture::cmp >
+        >::type
+    > list_type;
+
+    typedef cc::MichaelHashSet< rcu_type, list_type, 
+        typename cc::michael_set::make_traits<
+            cds::opt::hash< typename TestFixture::hash_int >
+        >::type
+    > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+TYPED_TEST_P( MichaelLazySet, less )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::int_item int_item;
+
+    typedef cc::LazyList< rcu_type, int_item,
+        typename cc::lazy_list::make_traits<
+            cds::opt::less< typename TestFixture::less >
+        >::type
+    > list_type;
+
+    typedef cc::MichaelHashSet< rcu_type, list_type, 
+        typename cc::michael_set::make_traits<
+            cds::opt::hash< typename TestFixture::hash_int >
+        >::type
+    > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+TYPED_TEST_P( MichaelLazySet, cmpmix )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::int_item int_item;
+
+    struct list_traits : public cc::lazy_list::traits
+    {
+        typedef typename TestFixture::less less;
+        typedef typename TestFixture::cmp compare;
+    };
+    typedef cc::LazyList< rcu_type, int_item, list_traits > list_type;
+
+    typedef cc::MichaelHashSet< rcu_type, list_type,
+        typename cc::michael_set::make_traits<
+            cds::opt::hash< typename TestFixture::hash_int >
+        >::type
+    > set_type;
+
+    set_type s( TestFixture::kSize, 2 );
+    this->test( s );
+}
+
+TYPED_TEST_P( MichaelLazySet, item_counting )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::int_item int_item;
+
+    struct list_traits : public cc::lazy_list::traits
+    {
+        typedef typename TestFixture::cmp compare;
+    };
+    typedef cc::LazyList< rcu_type, int_item, list_traits > list_type;
+
+    struct set_traits: public cc::michael_set::traits
+    {
+        typedef typename TestFixture::hash_int hash;
+        typedef typename TestFixture::simple_item_counter item_counter;
+    };
+    typedef cc::MichaelHashSet< rcu_type, list_type, set_traits >set_type;
+
+    set_type s( TestFixture::kSize, 3 );
+    this->test( s );
+}
+
+TYPED_TEST_P( MichaelLazySet, backoff )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::int_item int_item;
+
+    struct list_traits : public cc::lazy_list::traits
+    {
+        typedef typename TestFixture::cmp compare;
+        typedef cds::backoff::exponential<cds::backoff::pause, cds::backoff::yield> back_off;
+    };
+    typedef cc::LazyList< 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 );
+}
+
+TYPED_TEST_P( MichaelLazySet, seq_cst )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::int_item int_item;
+
+    struct list_traits : public cc::lazy_list::traits
+    {
+        typedef typename TestFixture::less less;
+        typedef cds::backoff::pause back_off;
+        typedef cds::opt::v::sequential_consistent memory_model;
+    };
+    typedef cc::LazyList< 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 );
+}
+
+TYPED_TEST_P( MichaelLazySet, mutex )
+{
+    typedef typename TestFixture::rcu_type rcu_type;
+    typedef typename TestFixture::int_item int_item;
+
+    struct list_traits : public cc::lazy_list::traits
+    {
+        typedef typename TestFixture::less less;
+        typedef cds::backoff::pause back_off;
+        typedef std::mutex lock_type;
+    };
+    typedef cc::LazyList< 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 );
+}
+
+
+// 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( MichaelLazySet,
+    compare, less, cmpmix, item_counting, backoff, seq_cst, mutex
+);
+
+
+#endif // CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_LAZY_RCU_H
\ No newline at end of file
index d819278a5a4e65b7f5c5345b77b0279ff2f43920..9f720d90e92d791a1bd359d47517b21836003c95 100644 (file)
@@ -89,7 +89,7 @@ namespace cds_test {
 
                 {
                     rcu_lock l;
-                    raw_ptr  rp;
+                    raw_ptr  rp{};
                     ASSERT_TRUE( !rp );
                     switch ( idx % 3 ) {
                     case 0:
@@ -117,37 +117,44 @@ namespace cds_test {
 
                 ASSERT_TRUE( !xp );
                 if ( Set::c_bExtractLockExternal ) {
-                    rcu_lock l;
-
-                    switch ( idx % 3 ) {
-                    case 0:
-                        xp = s.extract( i.key() );
-                        ASSERT_FALSE( !xp );
-                        break;
-                    case 1:
-                        xp = s.extract( i );
-                        ASSERT_FALSE( !xp );
-                        break;
-                    case 2:
-                        xp = s.extract_with( other_item( i.key() ), other_less() );
-                        ASSERT_FALSE( !xp );
-                        break;
+                    {
+                        rcu_lock l;
+
+                        switch ( idx % 3 ) {
+                        case 0:
+                            xp = s.extract( i.key() );
+                            ASSERT_FALSE( !xp );
+                            break;
+                        case 1:
+                            xp = s.extract( i );
+                            ASSERT_FALSE( !xp );
+                            break;
+                        case 2:
+                            xp = s.extract_with( other_item( i.key() ), other_less() );
+                            ASSERT_FALSE( !xp );
+                            break;
+                        }
+                        EXPECT_EQ( xp->key(), i.key() );
+                        EXPECT_EQ( xp->nFindCount, i.key() * 6 );
                     }
-                    EXPECT_EQ( xp->key(), i.key() );
-                    EXPECT_EQ( xp->nFindCount, i.key() * 6 );
-
-                    switch ( idx % 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;
+                    xp.release();
+
+                    {
+                        rcu_lock l;
+
+                        switch ( idx % 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_TRUE( !xp );
                     }
-                    ASSERT_TRUE( !xp );
                 }
                 else {
                     switch ( idx % 3 ) {