[SkipList] Added random-lvel generators for max height 32/24/16
[libcds.git] / test / unit / set / skiplist_hp.cpp
index bf9727ebc2011a5ca670dda8da1b05108537d1de..944f85187b036f449978390e52d2c0554b8d85f1 100644 (file)
@@ -1,11 +1,11 @@
 /*
     This file is a part of libcds - Concurrent Data Structures library
 
-    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
 
     Source code repo: http://github.com/khizmax/libcds/
     Download: http://sourceforge.net/projects/libcds/files/
-    
+
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are met:
 
     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#include "test_set_hp.h"
+#include "test_ordered_set_hp.h"
 
 #include <cds/container/skip_list_set_hp.h>
 
@@ -36,17 +36,13 @@ namespace {
     namespace cc = cds::container;
     typedef cds::gc::HP gc_type;
 
-    class SkipListSet_HP : public cds_test::container_set_hp
+    class SkipListSet_HP: public cds_test::container_ordered_set_hp
     {
     protected:
-        typedef cds_test::container_set_hp base_class;
+        typedef cds_test::container_ordered_set_hp base_class;
 
         void SetUp()
         {
-            struct set_traits: public cc::skip_list::traits
-            {
-                typedef cmp compare;
-            };
             typedef cc::SkipListSet< gc_type, int_item > set_type;
 
             // +1 - for guarded_ptr
@@ -61,102 +57,7 @@ namespace {
         }
     };
 
-    TEST_F( SkipListSet_HP, compare )
-    {
-        typedef cc::SkipListSet< gc_type, int_item,
-            typename cc::skip_list::make_traits<
-                cds::opt::compare< cmp >
-            >::type
-        > set_type;
-
-        set_type s;
-        test( s );
-    }
-
-    TEST_F( SkipListSet_HP, less )
-    {
-        typedef cc::SkipListSet< gc_type, int_item,
-            typename cc::skip_list::make_traits<
-                cds::opt::less< base_class::less >
-            >::type
-        > set_type;
-
-        set_type s;
-        test( s );
-    }
-
-    TEST_F( SkipListSet_HP, cmpmix )
-    {
-        typedef cc::SkipListSet< gc_type, int_item,
-            typename cc::skip_list::make_traits<
-                cds::opt::less< base_class::less >
-                ,cds::opt::compare< cmp >
-            >::type
-        > set_type;
-
-        set_type s;
-        test( s );
-    }
-
-    TEST_F( SkipListSet_HP, item_counting )
-    {
-        struct set_traits: public cc::skip_list::traits
-        {
-            typedef cmp compare;
-            typedef base_class::less less;
-            typedef cds::atomicity::item_counter item_counter;
-        };
-        typedef cc::SkipListSet< gc_type, int_item, set_traits >set_type;
-
-        set_type s;
-        test( s );
-    }
-
-    TEST_F( SkipListSet_HP, backoff )
-    {
-        struct set_traits: public cc::skip_list::traits
-        {
-            typedef cmp compare;
-            typedef base_class::less less;
-            typedef cds::atomicity::item_counter item_counter;
-            typedef cds::backoff::yield back_off;
-        };
-        typedef cc::SkipListSet< gc_type, int_item, set_traits >set_type;
-
-        set_type s;
-        test( s );
-    }
-
-    TEST_F( SkipListSet_HP, stat )
-    {
-        struct set_traits: public cc::skip_list::traits
-        {
-            typedef cmp compare;
-            typedef base_class::less less;
-            typedef cds::atomicity::item_counter item_counter;
-            typedef cds::backoff::yield back_off;
-            typedef cc::skip_list::stat<> stat;
-        };
-        typedef cc::SkipListSet< gc_type, int_item, set_traits >set_type;
-
-        set_type s;
-        test( s );
-    }
-
-    TEST_F( SkipListSet_HP, random_level_generator )
-    {
-        struct set_traits: public cc::skip_list::traits
-        {
-            typedef cmp compare;
-            typedef base_class::less less;
-            typedef cds::atomicity::item_counter item_counter;
-            typedef cc::skip_list::stat<> stat;
-            typedef cc::skip_list::xorshift random_level_generator;
-        };
-        typedef cc::SkipListSet< gc_type, int_item, set_traits >set_type;
-
-        set_type s;
-        test( s );
-    }
+#   define CDSTEST_FIXTURE_NAME SkipListSet_HP
+#   include "skiplist_hp_inl.h"
 
-} // namespace
+}