Reorganized map2 unit test to reduce compiling time and memory
[libcds.git] / tests / unit / map2 / map_insdel_func.cpp
1 //$$CDS-header$$
2
3 #include "map2/map_insdel_func.h"
4
5 namespace map2 {
6     CPPUNIT_TEST_SUITE_REGISTRATION( Map_InsDel_func );
7
8     static const size_t def_nMapSize = 1000000;
9     static const size_t def_nInsertThreadCount = 4;
10     static const size_t def_nDeleteThreadCount = 4;
11     static const size_t def_nEnsureThreadCount = 4;
12     static const size_t def_nThreadPassCount = 4;
13     static const size_t def_nMaxLoadFactor = 8;
14
15     size_t  Map_InsDel_func::c_nMapSize = def_nMapSize    ;  // map size
16     size_t  Map_InsDel_func::c_nInsertThreadCount = def_nInsertThreadCount;  // count of insertion thread
17     size_t  Map_InsDel_func::c_nDeleteThreadCount = def_nDeleteThreadCount;  // count of deletion thread
18     size_t  Map_InsDel_func::c_nEnsureThreadCount = def_nEnsureThreadCount;  // count of ensure thread
19     size_t  Map_InsDel_func::c_nThreadPassCount = def_nThreadPassCount;  // pass count for each thread
20     size_t  Map_InsDel_func::c_nMaxLoadFactor = def_nMaxLoadFactor;  // maximum load factor
21     bool    Map_InsDel_func::c_bPrintGCState = true;
22
23     void Map_InsDel_func::setUpParams( const CppUnitMini::TestCfg& cfg ) 
24     {
25         c_nInsertThreadCount = cfg.getULong("InsertThreadCount", def_nInsertThreadCount );
26         c_nDeleteThreadCount = cfg.getULong("DeleteThreadCount", def_nDeleteThreadCount );
27         c_nEnsureThreadCount = cfg.getULong("EnsureThreadCount", def_nEnsureThreadCount );
28         c_nThreadPassCount = cfg.getULong("ThreadPassCount", def_nThreadPassCount );
29         c_nMapSize = cfg.getULong("MapSize", def_nMapSize );
30         c_nMaxLoadFactor = cfg.getULong("MaxLoadFactor", def_nMaxLoadFactor );
31         c_bPrintGCState = cfg.getBool("PrintGCStateFlag", true );
32     }
33
34     void Map_InsDel_func::myRun(const char *in_name, bool invert /*= false*/)
35     {
36         setUpParams( m_Cfg.get( "Map_InsDel_func" ));
37
38         run_MichaelMap(in_name, invert);
39         run_SplitList(in_name, invert);
40         run_SkipListMap(in_name, invert);
41         run_EllenBinTreeMap(in_name, invert);
42         run_BronsonAVLTreeMap(in_name, invert);
43         run_StripedMap(in_name, invert);
44         run_RefinableMap(in_name, invert);
45         run_CuckooMap(in_name, invert);
46
47         endTestCase();
48     }
49 } // namespace map2