[UBsan] Fixed set-insdelfind stress test
[libcds.git] / test / stress / set / insdel_find / set_insdelfind.cpp
index 2899bc39636b03290104ad95d2a8317237c11b4e..e35e8ea726e95f2d451b61a76b7761834606dabd 100644 (file)
@@ -47,6 +47,7 @@ namespace set {
     size_t Set_InsDelFind::s_nFeldmanSet_ArrayBits = 4;
 
     size_t Set_InsDelFind::s_nLoadFactor = 2;
+    Set_InsDelFind::actions Set_InsDelFind::s_arrShuffle[Set_InsDelFind::c_nShuffleSize];
 
     void Set_InsDelFind::SetUpTestCase()
     {
@@ -93,6 +94,18 @@ namespace set {
         s_nFeldmanSet_ArrayBits = cfg.get_size_t( "FeldmanMapArrayBits", s_nFeldmanSet_ArrayBits );
         if ( s_nFeldmanSet_ArrayBits == 0 )
             s_nFeldmanSet_ArrayBits = 2;
+
+        actions * pFirst = s_arrShuffle;
+        actions * pLast = s_arrShuffle + s_nInsertPercentage;
+        std::fill( pFirst, pLast, do_insert );
+        pFirst = pLast;
+        pLast += s_nDeletePercentage;
+        std::fill( pFirst, pLast, do_delete );
+        pFirst = pLast;
+        pLast = s_arrShuffle + sizeof( s_arrShuffle ) / sizeof( s_arrShuffle[0] );
+        if ( pFirst < pLast )
+            std::fill( pFirst, pLast, do_find );
+        shuffle( s_arrShuffle, pLast );
     }
 
     std::vector<size_t> Set_InsDelFind_LF::get_load_factors()