Splitted up set_insdelfind test
[libcds.git] / tests / unit / set2 / set_insdelfind.cpp
1 //$$CDS-header$$
2
3 #include "set2/set_insdelfind.h"
4
5 namespace set2 {
6     CPPUNIT_TEST_SUITE_REGISTRATION( Set_InsDelFind );
7
8     size_t Set_InsDelFind::c_nInitialMapSize = 500000;
9     size_t Set_InsDelFind::c_nThreadCount = 8;
10     size_t Set_InsDelFind::c_nMaxLoadFactor = 8;
11     unsigned int Set_InsDelFind::c_nInsertPercentage = 5;
12     unsigned int Set_InsDelFind::c_nDeletePercentage = 5;
13     unsigned int Set_InsDelFind::c_nDuration = 30;
14     bool Set_InsDelFind::c_bPrintGCState = true;
15
16     void Set_InsDelFind::setUpParams( const CppUnitMini::TestCfg& cfg )
17     {
18         c_nInitialMapSize = cfg.getSizeT("InitialMapSize", c_nInitialMapSize );
19         c_nThreadCount = cfg.getSizeT("ThreadCount", c_nThreadCount );
20         c_nMaxLoadFactor = cfg.getSizeT("MaxLoadFactor", c_nMaxLoadFactor );
21         c_nInsertPercentage = cfg.getUInt("InsertPercentage", c_nInsertPercentage );
22         c_nDeletePercentage = cfg.getUInt("DeletePercentage", c_nDeletePercentage );
23         c_nDuration = cfg.getUInt("Duration", c_nDuration );
24         c_bPrintGCState = cfg.getBool("PrintGCStateFlag", c_bPrintGCState );
25
26         if ( c_nThreadCount == 0 )
27             c_nThreadCount = cds::OS::topology::processor_count() * 2;
28
29         CPPUNIT_ASSERT( c_nInsertPercentage + c_nDeletePercentage <= 100 );
30
31         actions * pFirst = m_arrShuffle;
32         actions * pLast = m_arrShuffle + c_nInsertPercentage;
33         std::fill( pFirst, pLast, do_insert );
34         pFirst = pLast;
35         pLast += c_nDeletePercentage;
36         std::fill( pFirst, pLast, do_delete );
37         pFirst = pLast;
38         pLast = m_arrShuffle + sizeof(m_arrShuffle)/sizeof(m_arrShuffle[0]);
39         std::fill( pFirst, pLast, do_find );
40         std::random_shuffle( m_arrShuffle, pLast );
41     }
42
43     void Set_InsDelFind::myRun(const char *in_name, bool invert /*= false*/)
44     {
45         setUpParams( m_Cfg.get( "Map_InsDelFind" ));
46
47         run_MichaelSet(in_name, invert);
48         run_SplitList(in_name, invert);
49         run_SkipListSet(in_name, invert);
50         run_EllenBinTreeSet(in_name, invert);
51         run_StripedSet(in_name, invert);
52         run_RefinableSet(in_name, invert);
53         run_CuckooSet(in_name, invert);
54         run_StdSet(in_name, invert);
55
56         endTestCase();
57     }
58
59     /*
60         CPPUNIT_TEST_SUITE_( Set_InsDelFind, "Map_InsDelFind" )
61             CDSUNIT_TEST_MichaelSet
62             CDSUNIT_TEST_SplitList
63             CDSUNIT_TEST_SkipListSet
64             CDSUNIT_TEST_EllenBinTreeSet
65             CDSUNIT_TEST_StripedSet
66             CDSUNIT_TEST_RefinableSet
67             CDSUNIT_TEST_CuckooSet
68             CDSUNIT_TEST_StdSet
69         CPPUNIT_TEST_SUITE_END()
70         */
71 } // namespace set2