Added copyright and license
[libcds.git] / tests / unit / map2 / map_insdel_item_string.cpp
index 09980ce8d05a27f96f4fc82a050593c68affc20d..75693522529ba742700dda5fb5aa7b7680ef4478 100644 (file)
@@ -1,40 +1,55 @@
-//$$CDS-header$$
+/*
+    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 "map2/map_insdel_item_string.h"
 
 namespace map2 {
     CPPUNIT_TEST_SUITE_REGISTRATION( Map_InsDel_Item_string );
 
-    size_t Map_InsDel_Item_string::c_nMapSize = 1000000;
-    size_t Map_InsDel_Item_string::c_nThreadCount = 4;
-    size_t Map_InsDel_Item_string::c_nGoalItem = c_nMapSize / 2;
-    size_t Map_InsDel_Item_string::c_nAttemptCount = 100000;
-    size_t Map_InsDel_Item_string::c_nMaxLoadFactor = 8;
-    bool   Map_InsDel_Item_string::c_bPrintGCState = true;
-
     void Map_InsDel_Item_string::setUpParams( const CppUnitMini::TestCfg& cfg )
     {
         c_nThreadCount = cfg.getSizeT("ThreadCount", c_nThreadCount );
         c_nMapSize = cfg.getSizeT("MapSize", c_nMapSize );
-        c_nGoalItem = cfg.getSizeT("GoalItemIndex", c_nGoalItem);
+        c_nGoalItem = cfg.getSizeT("GoalItem", c_nMapSize / 2 );
         c_nAttemptCount = cfg.getSizeT("AttemptCount", c_nAttemptCount );
         c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor );
         c_bPrintGCState = cfg.getBool("PrintGCStateFlag", true );
-    }
 
-    void Map_InsDel_Item_string::myRun(const char *in_name, bool invert /*= false*/)
-    {
-        setUpParams( m_Cfg.get( "Map_InsDel_Item_string" ));
-
-        run_MichaelMap(in_name, invert);
-        run_SplitList(in_name, invert);
-        run_SkipListMap(in_name, invert);
-        run_EllenBinTreeMap(in_name, invert);
-        run_BronsonAVLTreeMap(in_name, invert);
-        run_StripedMap(in_name, invert);
-        run_RefinableMap(in_name, invert);
-        run_CuckooMap(in_name, invert);
-
-        endTestCase();
+        c_nCuckooInitialSize = cfg.getSizeT("CuckooInitialSize", c_nCuckooInitialSize);
+        c_nCuckooProbesetSize = cfg.getSizeT("CuckooProbesetSize", c_nCuckooProbesetSize);
+        c_nCuckooProbesetThreshold = cfg.getSizeT("CuckooProbesetThreshold", c_nCuckooProbesetThreshold);
+
+        c_nFeldmanMap_HeadBits = cfg.getSizeT("FeldmanMapHeadBits", c_nFeldmanMap_HeadBits);
+        c_nFeldmanMap_ArrayBits = cfg.getSizeT("FeldmanMapArrayBits", c_nFeldmanMap_ArrayBits);
+
+        if ( c_nThreadCount == 0 )
+            c_nThreadCount = std::thread::hardware_concurrency() * 2;
     }
 } // namespace map2