2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
6 Source code repo: http://github.com/khizmax/libcds/
7 Download: http://sourceforge.net/projects/libcds/files/
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
12 * Redistributions of source code must retain the above copyright notice, this
13 list of conditions and the following disclaimer.
15 * Redistributions in binary form must reproduce the above copyright notice,
16 this list of conditions and the following disclaimer in the documentation
17 and/or other materials provided with the distribution.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef CDSUNIT_STRIPED_MAP_TEST_STRIPED_MAP_H
32 #define CDSUNIT_STRIPED_MAP_TEST_STRIPED_MAP_H
34 #include "test_map_data.h"
36 #include <cds/container/striped_map.h>
39 namespace cc = cds::container;
41 template <bool Exist, typename Map>
42 struct call_contains_with
44 bool operator()( Map& m, int key ) const
46 return m.contains( cds_test::striped_map_fixture::other_item( key ), cds_test::striped_map_fixture::other_less());
50 template <typename Map>
51 struct call_contains_with<false, Map>
53 bool operator()( Map& m, int key ) const
55 return m.contains( key );
59 template <bool Exist, typename Map>
62 template <typename Func>
63 bool operator()( Map& m, int key, Func f ) const
65 return m.find_with( cds_test::striped_map_fixture::other_item( key ), cds_test::striped_map_fixture::other_less(), f );
69 template <typename Map>
70 struct call_find_with<false, Map>
72 template <typename Func>
73 bool operator()( Map& m, int key, Func f ) const
75 return m.find( key, f );
79 template <bool Exist, typename Map>
80 struct call_erase_with
82 bool operator()( Map& m, int key ) const
84 return m.erase_with( cds_test::striped_map_fixture::other_item( key ), cds_test::striped_map_fixture::other_less());
87 template <typename Func>
88 bool operator()( Map& m, int key, Func f ) const
90 return m.erase_with( cds_test::striped_map_fixture::other_item( key ), cds_test::striped_map_fixture::other_less(), f );
94 template <typename Map>
95 struct call_erase_with<false, Map>
97 bool operator()( Map& m, int key ) const
99 return m.erase( key );
102 template <typename Func>
103 bool operator()( Map& m, int key, Func f ) const
105 return m.erase( key, f );
109 template <typename Traits>
110 class StripedMap: public cds_test::striped_map_fixture
113 static size_t const kSize = 1000;
116 typedef typename Traits::container_type container_type;
117 typedef typename Traits::copy_policy copy_policy;
119 static bool const c_hasFindWith = Traits::c_hasFindWith;
120 static bool const c_hasEraseWith = Traits::c_hasEraseWith;
131 // Precondition: map is empty
132 // Postcondition: map is empty
134 ASSERT_TRUE( m.empty());
135 ASSERT_CONTAINER_SIZE( m, 0 );
137 typedef typename Map::value_type map_pair;
139 size_t const kkSize = kSize;
141 std::vector<key_type> arrKeys;
142 for ( int i = 0; i < static_cast<int>(kkSize); ++i )
143 arrKeys.push_back( key_type( i ));
144 shuffle( arrKeys.begin(), arrKeys.end());
146 std::vector< value_type > arrVals;
147 for ( size_t i = 0; i < kkSize; ++i ) {
149 val.nVal = static_cast<int>( i );
150 val.strVal = std::to_string( i );
151 arrVals.push_back( val );
155 for ( auto const& i : arrKeys ) {
156 value_type const& val( arrVals.at( i.nKey ));
158 ASSERT_FALSE( m.contains( i.nKey ));
159 ASSERT_FALSE( m.contains( i ));
160 ASSERT_FALSE(( call_contains_with<c_hasFindWith, Map>()( m, i.nKey )));
161 ASSERT_FALSE( m.find( i, []( map_pair const& ) {
162 ASSERT_TRUE( false );
164 ASSERT_FALSE( m.find( i.nKey, []( map_pair const& ) {
165 EXPECT_TRUE( false );
167 ASSERT_FALSE(( call_find_with< c_hasFindWith, Map>()( m, i.nKey, []( map_pair const& ) {
168 EXPECT_TRUE( false );
171 std::pair< bool, bool > updResult;
173 switch ( i.nKey % 16 ) {
175 ASSERT_TRUE( m.insert( i ));
176 ASSERT_FALSE( m.insert( i ));
177 ASSERT_TRUE( m.find( i.nKey, []( map_pair& v ) {
178 v.second.nVal = v.first.nKey;
179 v.second.strVal = std::to_string( v.first.nKey );
183 ASSERT_TRUE( m.insert( i.nKey ));
184 ASSERT_FALSE( m.insert( i.nKey ));
185 ASSERT_TRUE( m.find( i.nKey, []( map_pair& v ) {
186 v.second.nVal = v.first.nKey;
187 v.second.strVal = std::to_string( v.first.nKey );
191 ASSERT_TRUE( m.insert( std::to_string( i.nKey )));
192 ASSERT_FALSE( m.insert( std::to_string( i.nKey )));
193 ASSERT_TRUE( m.find( i.nKey, []( map_pair& v ) {
194 v.second.nVal = v.first.nKey;
195 v.second.strVal = std::to_string( v.first.nKey );
199 ASSERT_TRUE( m.insert( i, val ));
200 ASSERT_FALSE( m.insert( i, val ));
203 ASSERT_TRUE( m.insert( i.nKey, val.strVal ));
204 ASSERT_FALSE( m.insert( i.nKey, val.strVal ));
207 ASSERT_TRUE( m.insert( val.strVal, i.nKey ));
208 ASSERT_FALSE( m.insert( val.strVal, i.nKey ));
211 ASSERT_TRUE( m.insert_with( i, []( map_pair& v ) {
212 v.second.nVal = v.first.nKey;
213 v.second.strVal = std::to_string( v.first.nKey );
215 ASSERT_FALSE( m.insert_with( i, []( map_pair& ) {
216 EXPECT_TRUE( false );
220 ASSERT_TRUE( m.insert_with( i.nKey, []( map_pair& v ) {
221 v.second.nVal = v.first.nKey;
222 v.second.strVal = std::to_string( v.first.nKey );
224 ASSERT_FALSE( m.insert_with( i.nKey, []( map_pair& ) {
225 EXPECT_TRUE( false );
229 ASSERT_TRUE( m.insert_with( val.strVal, []( map_pair& v ) {
230 v.second.nVal = v.first.nKey;
231 v.second.strVal = std::to_string( v.first.nKey );
233 ASSERT_FALSE( m.insert_with( val.strVal, []( map_pair& ) {
234 EXPECT_TRUE( false );
238 updResult = m.update( i.nKey, []( bool, map_pair& ) {
239 EXPECT_TRUE( false );
241 ASSERT_FALSE( updResult.first );
242 ASSERT_FALSE( updResult.second );
244 updResult = m.update( i.nKey, []( bool bNew, map_pair& v ) {
246 v.second.nVal = v.first.nKey;
248 ASSERT_TRUE( updResult.first );
249 ASSERT_TRUE( updResult.second );
251 updResult = m.update( i.nKey, []( bool bNew, map_pair& v ) {
252 EXPECT_FALSE( bNew );
253 EXPECT_EQ( v.first.nKey, v.second.nVal );
254 v.second.strVal = std::to_string( v.second.nVal );
256 ASSERT_TRUE( updResult.first );
257 ASSERT_FALSE( updResult.second );
260 updResult = m.update( i, []( bool, map_pair& ) {
261 EXPECT_TRUE( false );
263 ASSERT_FALSE( updResult.first );
264 ASSERT_FALSE( updResult.second );
266 updResult = m.update( i, []( bool bNew, map_pair& v ) {
268 v.second.nVal = v.first.nKey;
270 ASSERT_TRUE( updResult.first );
271 ASSERT_TRUE( updResult.second );
273 updResult = m.update( i, []( bool bNew, map_pair& v ) {
274 EXPECT_FALSE( bNew );
275 EXPECT_EQ( v.first.nKey, v.second.nVal );
276 v.second.strVal = std::to_string( v.second.nVal );
278 ASSERT_TRUE( updResult.first );
279 ASSERT_FALSE( updResult.second );
282 updResult = m.update( val.strVal, []( bool, map_pair& ) {
283 EXPECT_TRUE( false );
285 ASSERT_FALSE( updResult.first );
286 ASSERT_FALSE( updResult.second );
288 updResult = m.update( val.strVal, []( bool bNew, map_pair& v ) {
290 v.second.nVal = v.first.nKey;
292 ASSERT_TRUE( updResult.first );
293 ASSERT_TRUE( updResult.second );
295 updResult = m.update( val.strVal, []( bool bNew, map_pair& v ) {
296 EXPECT_FALSE( bNew );
297 EXPECT_EQ( v.first.nKey, v.second.nVal );
298 v.second.strVal = std::to_string( v.second.nVal );
300 ASSERT_TRUE( updResult.first );
301 ASSERT_FALSE( updResult.second );
304 ASSERT_TRUE( m.emplace( i.nKey ));
305 ASSERT_FALSE( m.emplace( i.nKey ));
306 ASSERT_TRUE( m.find( i.nKey, []( map_pair& v ) {
307 v.second.nVal = v.first.nKey;
308 v.second.strVal = std::to_string( v.first.nKey );
312 ASSERT_TRUE( m.emplace( i, i.nKey ));
313 ASSERT_FALSE( m.emplace( i, i.nKey ));
317 std::string str = val.strVal;
318 ASSERT_TRUE( m.emplace( i, std::move( str )));
319 ASSERT_TRUE( str.empty());
321 ASSERT_FALSE( m.emplace( i, std::move( str )));
326 std::string str = val.strVal;
327 ASSERT_TRUE( m.emplace( i, i.nKey, std::move( str )));
328 ASSERT_TRUE( str.empty());
330 ASSERT_FALSE( m.emplace( i, i.nKey, std::move( str )));
335 ASSERT_TRUE( m.contains( i.nKey ));
336 ASSERT_TRUE( m.contains( i ));
337 ASSERT_TRUE(( call_contains_with<c_hasFindWith, Map>()( m, i.nKey )));
338 ASSERT_TRUE( m.find( i, []( map_pair const& v ) {
339 EXPECT_EQ( v.first.nKey, v.second.nVal );
340 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
342 ASSERT_TRUE( m.find( i.nKey, []( map_pair const& v ) {
343 EXPECT_EQ( v.first.nKey, v.second.nVal );
344 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
346 ASSERT_TRUE(( call_find_with<c_hasFindWith, Map>()( m, i.nKey, []( map_pair const& v ) {
347 EXPECT_EQ( v.first.nKey, v.second.nVal );
348 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
351 ASSERT_FALSE( m.empty());
352 ASSERT_CONTAINER_SIZE( m, kkSize );
354 shuffle( arrKeys.begin(), arrKeys.end());
357 for ( auto const& i : arrKeys ) {
358 value_type const& val( arrVals.at( i.nKey ));
360 ASSERT_TRUE( m.contains( i.nKey ));
361 ASSERT_TRUE( m.contains( val.strVal ));
362 ASSERT_TRUE( m.contains( i ));
363 ASSERT_TRUE(( call_contains_with<c_hasFindWith, Map>()( m, i.nKey )));
364 ASSERT_TRUE( m.find( i, []( map_pair const& v ) {
365 EXPECT_EQ( v.first.nKey, v.second.nVal );
366 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
368 ASSERT_TRUE( m.find( i.nKey, []( map_pair const& v ) {
369 EXPECT_EQ( v.first.nKey, v.second.nVal );
370 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
372 ASSERT_TRUE(( call_find_with<c_hasFindWith, Map>()( m, i.nKey, []( map_pair const& v ) {
373 EXPECT_EQ( v.first.nKey, v.second.nVal );
374 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
378 switch ( i.nKey % 8 ) {
380 ASSERT_TRUE( m.erase( i ));
381 ASSERT_FALSE( m.erase( i ));
384 ASSERT_TRUE( m.erase( i.nKey ));
385 ASSERT_FALSE( m.erase( i.nKey ));
388 ASSERT_TRUE( m.erase( val.strVal ));
389 ASSERT_FALSE( m.erase( val.strVal ));
392 ASSERT_TRUE(( call_erase_with< c_hasEraseWith, Map>()( m, i.nKey )));
393 ASSERT_FALSE(( call_erase_with< c_hasEraseWith, Map>()( m, i.nKey )));
396 ASSERT_TRUE( m.erase( i, []( map_pair& v ) {
397 EXPECT_EQ( v.first.nKey, v.second.nVal );
398 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
400 ASSERT_FALSE( m.erase( i, []( map_pair& ) {
401 EXPECT_TRUE( false );
405 ASSERT_TRUE( m.erase( i.nKey, []( map_pair& v ) {
406 EXPECT_EQ( v.first.nKey, v.second.nVal );
407 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
409 ASSERT_FALSE( m.erase( i.nKey, []( map_pair& ) {
410 EXPECT_TRUE( false );
414 ASSERT_TRUE( m.erase( val.strVal, []( map_pair& v ) {
415 EXPECT_EQ( v.first.nKey, v.second.nVal );
416 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
418 ASSERT_FALSE( m.erase( val.strVal, []( map_pair& ) {
419 EXPECT_TRUE( false );
423 ASSERT_TRUE(( call_erase_with< c_hasEraseWith, Map >()( m, i.nKey, []( map_pair& v ) {
424 EXPECT_EQ( v.first.nKey, v.second.nVal );
425 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
427 ASSERT_FALSE(( call_erase_with< c_hasEraseWith, Map >()( m, i.nKey, []( map_pair& ) {
428 EXPECT_TRUE( false );
433 ASSERT_FALSE( m.contains( i.nKey ));
434 ASSERT_FALSE( m.contains( i ));
435 ASSERT_FALSE( m.contains( val.strVal ));
436 ASSERT_FALSE(( call_contains_with< c_hasFindWith, Map >()( m, i.nKey )));
437 ASSERT_FALSE( m.find( i, []( map_pair const& ) {
438 ASSERT_TRUE( false );
440 ASSERT_FALSE( m.find( i.nKey, []( map_pair const& ) {
441 EXPECT_TRUE( false );
443 ASSERT_FALSE(( call_find_with< c_hasFindWith, Map >()( m, i.nKey, []( map_pair const& ) {
444 EXPECT_TRUE( false );
447 ASSERT_TRUE( m.empty());
448 ASSERT_CONTAINER_SIZE( m, 0 );
451 for ( auto const& i : arrKeys )
452 ASSERT_TRUE( m.insert( i ));
454 ASSERT_FALSE( m.empty());
455 ASSERT_CONTAINER_SIZE( m, kkSize );
459 ASSERT_TRUE( m.empty());
460 ASSERT_CONTAINER_SIZE( m, 0 );
464 template <typename Traits>
465 class RefinableMap: public StripedMap< Traits >
468 TYPED_TEST_CASE_P( StripedMap );
469 TYPED_TEST_CASE_P( RefinableMap );
472 // ****************************************************************
475 TYPED_TEST_P( StripedMap, compare )
477 typedef cc::StripedMap<
478 typename TestFixture::container_type,
479 cds::opt::hash< typename TestFixture::hash1 >,
480 cds::opt::compare< typename TestFixture::cmp >,
481 cds::opt::mutex_policy< cc::striped_set::striping<>>
488 TYPED_TEST_P( StripedMap, less )
490 typedef cc::StripedMap<
491 typename TestFixture::container_type,
492 cds::opt::hash< typename TestFixture::hash1 >,
493 cds::opt::less< typename TestFixture::less >
501 TYPED_TEST_P( StripedMap, cmpmix )
503 typedef cc::StripedMap<
504 typename TestFixture::container_type,
505 cds::opt::hash< typename TestFixture::hash1 >,
506 cds::opt::less< typename TestFixture::less >,
507 cds::opt::compare< typename TestFixture::cmp >
514 TYPED_TEST_P( StripedMap, spinlock )
516 typedef cc::StripedMap<
517 typename TestFixture::container_type,
518 cds::opt::mutex_policy< cc::striped_set::striping<cds::sync::spin>>,
519 cds::opt::hash< typename TestFixture::hash1 >,
520 cds::opt::less< typename TestFixture::less >,
521 cds::opt::compare< typename TestFixture::cmp >
528 TYPED_TEST_P( StripedMap, load_factor_resizing )
530 typedef cc::StripedMap<
531 typename TestFixture::container_type,
532 cds::opt::hash< typename TestFixture::hash1 >,
533 cds::opt::less< typename TestFixture::less >,
534 cds::opt::compare< typename TestFixture::cmp >,
535 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<4>>
542 TYPED_TEST_P( StripedMap, load_factor_resizing_rt )
544 typedef cc::StripedMap<
545 typename TestFixture::container_type,
546 cds::opt::hash< typename TestFixture::hash1 >,
547 cds::opt::compare< typename TestFixture::cmp >,
548 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<0>>
551 map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 ));
555 TYPED_TEST_P( StripedMap, single_bucket_resizing )
557 typedef cc::StripedMap<
558 typename TestFixture::container_type,
559 cds::opt::hash< typename TestFixture::hash1 >,
560 cds::opt::compare< typename TestFixture::cmp >,
561 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<6>>
568 TYPED_TEST_P( StripedMap, single_bucket_resizing_rt )
570 typedef cc::StripedMap<
571 typename TestFixture::container_type,
572 cds::opt::hash< typename TestFixture::hash1 >,
573 cds::opt::compare< typename TestFixture::cmp >,
574 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<0>>
577 cc::striped_set::single_bucket_size_threshold<0> resizing_policy( 8 );
578 map_type m( 24, resizing_policy );
582 TYPED_TEST_P( StripedMap, copy_policy_copy )
584 typedef cc::StripedMap<
585 typename TestFixture::container_type,
586 cds::opt::hash< typename TestFixture::hash1 >,
587 cds::opt::less< typename TestFixture::less >,
588 cds::opt::compare< typename TestFixture::cmp >,
589 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<4>>,
590 cds::opt::copy_policy< cc::striped_set::copy_item >
597 TYPED_TEST_P( StripedMap, copy_policy_move )
599 typedef cc::StripedMap<
600 typename TestFixture::container_type,
601 cds::opt::hash< typename TestFixture::hash1 >,
602 cds::opt::compare< typename TestFixture::cmp >,
603 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<0>>,
604 cds::opt::copy_policy< cc::striped_set::move_item >
607 map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 ));
611 TYPED_TEST_P( StripedMap, copy_policy_swap )
613 typedef cc::StripedMap<
614 typename TestFixture::container_type,
615 cds::opt::hash< typename TestFixture::hash1 >,
616 cds::opt::compare< typename TestFixture::cmp >,
617 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<6>>,
618 cds::opt::copy_policy< cc::striped_set::swap_item >
625 TYPED_TEST_P( StripedMap, copy_policy_special )
627 typedef cc::StripedMap<
628 typename TestFixture::container_type,
629 cds::opt::hash< typename TestFixture::hash1 >,
630 cds::opt::compare< typename TestFixture::cmp >,
631 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<0>>,
632 cds::opt::copy_policy< typename TestFixture::copy_policy >
635 cc::striped_set::single_bucket_size_threshold<0> resizing_policy( 8 );
636 map_type m( 24, resizing_policy );
641 // ****************************************************************
644 TYPED_TEST_P( RefinableMap, compare )
646 typedef cc::StripedMap<
647 typename TestFixture::container_type,
648 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
649 cds::opt::hash< typename TestFixture::hash1 >,
650 cds::opt::compare< typename TestFixture::cmp >
657 TYPED_TEST_P( RefinableMap, less )
659 typedef cc::StripedMap<
660 typename TestFixture::container_type,
661 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
662 cds::opt::hash< typename TestFixture::hash1 >,
663 cds::opt::less< typename TestFixture::less >
671 TYPED_TEST_P( RefinableMap, cmpmix )
673 typedef cc::StripedMap<
674 typename TestFixture::container_type,
675 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
676 cds::opt::hash< typename TestFixture::hash1 >,
677 cds::opt::less< typename TestFixture::less >,
678 cds::opt::compare< typename TestFixture::cmp >
685 TYPED_TEST_P( RefinableMap, spinlock )
687 typedef cc::StripedMap<
688 typename TestFixture::container_type,
689 cds::opt::mutex_policy< cc::striped_set::refinable<cds::sync::reentrant_spin>>,
690 cds::opt::hash< typename TestFixture::hash1 >,
691 cds::opt::less< typename TestFixture::less >,
692 cds::opt::compare< typename TestFixture::cmp >
699 TYPED_TEST_P( RefinableMap, load_factor_resizing )
701 typedef cc::StripedMap<
702 typename TestFixture::container_type,
703 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
704 cds::opt::hash< typename TestFixture::hash1 >,
705 cds::opt::less< typename TestFixture::less >,
706 cds::opt::compare< typename TestFixture::cmp >,
707 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<4>>
714 TYPED_TEST_P( RefinableMap, load_factor_resizing_rt )
716 typedef cc::StripedMap<
717 typename TestFixture::container_type,
718 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
719 cds::opt::hash< typename TestFixture::hash1 >,
720 cds::opt::compare< typename TestFixture::cmp >,
721 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<0>>
724 map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 ));
728 TYPED_TEST_P( RefinableMap, single_bucket_resizing )
730 typedef cc::StripedMap<
731 typename TestFixture::container_type,
732 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
733 cds::opt::hash< typename TestFixture::hash1 >,
734 cds::opt::compare< typename TestFixture::cmp >,
735 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<6>>
742 TYPED_TEST_P( RefinableMap, single_bucket_resizing_rt )
744 typedef cc::StripedMap<
745 typename TestFixture::container_type,
746 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
747 cds::opt::hash< typename TestFixture::hash1 >,
748 cds::opt::compare< typename TestFixture::cmp >,
749 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<0>>
752 cc::striped_set::single_bucket_size_threshold<0> resizing_policy( 8 );
753 map_type m( 24, resizing_policy );
757 TYPED_TEST_P( RefinableMap, copy_policy_copy )
759 typedef cc::StripedMap<
760 typename TestFixture::container_type,
761 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
762 cds::opt::hash< typename TestFixture::hash1 >,
763 cds::opt::less< typename TestFixture::less >,
764 cds::opt::compare< typename TestFixture::cmp >,
765 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<4>>,
766 cds::opt::copy_policy< cc::striped_set::copy_item >
773 TYPED_TEST_P( RefinableMap, copy_policy_move )
775 typedef cc::StripedMap<
776 typename TestFixture::container_type,
777 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
778 cds::opt::hash< typename TestFixture::hash1 >,
779 cds::opt::compare< typename TestFixture::cmp >,
780 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<0>>,
781 cds::opt::copy_policy< cc::striped_set::move_item >
784 map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 ));
788 TYPED_TEST_P( RefinableMap, copy_policy_swap )
790 typedef cc::StripedMap<
791 typename TestFixture::container_type,
792 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
793 cds::opt::hash< typename TestFixture::hash1 >,
794 cds::opt::compare< typename TestFixture::cmp >,
795 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<6>>,
796 cds::opt::copy_policy< cc::striped_set::swap_item >
803 TYPED_TEST_P( RefinableMap, copy_policy_special )
805 typedef cc::StripedMap<
806 typename TestFixture::container_type,
807 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
808 cds::opt::hash< typename TestFixture::hash1 >,
809 cds::opt::compare< typename TestFixture::cmp >,
810 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<0>>,
811 cds::opt::copy_policy< typename TestFixture::copy_policy >
814 cc::striped_set::single_bucket_size_threshold<0> resizing_policy( 8 );
815 map_type m( 24, resizing_policy );
819 REGISTER_TYPED_TEST_CASE_P( StripedMap,
820 compare, less, cmpmix, spinlock, load_factor_resizing, load_factor_resizing_rt, single_bucket_resizing, single_bucket_resizing_rt, copy_policy_copy, copy_policy_move, copy_policy_swap, copy_policy_special
823 REGISTER_TYPED_TEST_CASE_P( RefinableMap,
824 compare, less, cmpmix, spinlock, load_factor_resizing, load_factor_resizing_rt, single_bucket_resizing, single_bucket_resizing_rt, copy_policy_copy, copy_policy_move, copy_policy_swap, copy_policy_special
828 #endif // #ifndef CDSUNIT_STRIPED_MAP_TEST_STRIPED_MAP_H