2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
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& v ) {
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& v ) {
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& v ) {
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 )));
322 ASSERT_TRUE( str.empty());
327 std::string str = val.strVal;
328 ASSERT_TRUE( m.emplace( i, i.nKey, std::move( str )));
329 ASSERT_TRUE( str.empty());
331 ASSERT_FALSE( m.emplace( i, i.nKey, std::move( str )));
332 ASSERT_TRUE( str.empty());
337 ASSERT_TRUE( m.contains( i.nKey ));
338 ASSERT_TRUE( m.contains( i ));
339 ASSERT_TRUE(( call_contains_with<c_hasFindWith, Map>()( m, i.nKey ) ));
340 ASSERT_TRUE( m.find( i, []( map_pair const& v ) {
341 EXPECT_EQ( v.first.nKey, v.second.nVal );
342 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
344 ASSERT_TRUE( m.find( i.nKey, []( map_pair const& v ) {
345 EXPECT_EQ( v.first.nKey, v.second.nVal );
346 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
348 ASSERT_TRUE(( call_find_with<c_hasFindWith, Map>()( m, i.nKey, []( map_pair const& v ) {
349 EXPECT_EQ( v.first.nKey, v.second.nVal );
350 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
353 ASSERT_FALSE( m.empty() );
354 ASSERT_CONTAINER_SIZE( m, kkSize );
356 shuffle( arrKeys.begin(), arrKeys.end() );
359 for ( auto const& i : arrKeys ) {
360 value_type const& val( arrVals.at( i.nKey ) );
362 ASSERT_TRUE( m.contains( i.nKey ));
363 ASSERT_TRUE( m.contains( val.strVal ) );
364 ASSERT_TRUE( m.contains( i ));
365 ASSERT_TRUE(( call_contains_with<c_hasFindWith, Map>()( m, i.nKey )));
366 ASSERT_TRUE( m.find( i, []( map_pair const& v ) {
367 EXPECT_EQ( v.first.nKey, v.second.nVal );
368 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
370 ASSERT_TRUE( m.find( i.nKey, []( map_pair const& v ) {
371 EXPECT_EQ( v.first.nKey, v.second.nVal );
372 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
374 ASSERT_TRUE(( call_find_with<c_hasFindWith, Map>()( m, i.nKey, []( map_pair const& v ) {
375 EXPECT_EQ( v.first.nKey, v.second.nVal );
376 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
380 switch ( i.nKey % 8 ) {
382 ASSERT_TRUE( m.erase( i ));
383 ASSERT_FALSE( m.erase( i ));
386 ASSERT_TRUE( m.erase( i.nKey ));
387 ASSERT_FALSE( m.erase( i.nKey ));
390 ASSERT_TRUE( m.erase( val.strVal ));
391 ASSERT_FALSE( m.erase( val.strVal ));
394 ASSERT_TRUE(( call_erase_with< c_hasEraseWith, Map>()( m, i.nKey )));
395 ASSERT_FALSE(( call_erase_with< c_hasEraseWith, Map>()( m, i.nKey )));
398 ASSERT_TRUE( m.erase( i, []( map_pair& v ) {
399 EXPECT_EQ( v.first.nKey, v.second.nVal );
400 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
402 ASSERT_FALSE( m.erase( i, []( map_pair& ) {
403 EXPECT_TRUE( false );
407 ASSERT_TRUE( m.erase( i.nKey, []( map_pair& v ) {
408 EXPECT_EQ( v.first.nKey, v.second.nVal );
409 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
411 ASSERT_FALSE( m.erase( i.nKey, []( map_pair& ) {
412 EXPECT_TRUE( false );
416 ASSERT_TRUE( m.erase( val.strVal, []( map_pair& v ) {
417 EXPECT_EQ( v.first.nKey, v.second.nVal );
418 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
420 ASSERT_FALSE( m.erase( val.strVal, []( map_pair& ) {
421 EXPECT_TRUE( false );
425 ASSERT_TRUE(( call_erase_with< c_hasEraseWith, Map >()( m, i.nKey, []( map_pair& v ) {
426 EXPECT_EQ( v.first.nKey, v.second.nVal );
427 EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal );
429 ASSERT_FALSE(( call_erase_with< c_hasEraseWith, Map >()( m, i.nKey, []( map_pair& ) {
430 EXPECT_TRUE( false );
435 ASSERT_FALSE( m.contains( i.nKey ));
436 ASSERT_FALSE( m.contains( i ));
437 ASSERT_FALSE( m.contains( val.strVal ));
438 ASSERT_FALSE(( call_contains_with< c_hasFindWith, Map >()( m, i.nKey )));
439 ASSERT_FALSE( m.find( i, []( map_pair const& ) {
440 ASSERT_TRUE( false );
442 ASSERT_FALSE( m.find( i.nKey, []( map_pair const& ) {
443 EXPECT_TRUE( false );
445 ASSERT_FALSE(( call_find_with< c_hasFindWith, Map >()( m, i.nKey, []( map_pair const& ) {
446 EXPECT_TRUE( false );
449 ASSERT_TRUE( m.empty() );
450 ASSERT_CONTAINER_SIZE( m, 0 );
453 for ( auto const& i : arrKeys )
454 ASSERT_TRUE( m.insert( i ));
456 ASSERT_FALSE( m.empty() );
457 ASSERT_CONTAINER_SIZE( m, kkSize );
461 ASSERT_TRUE( m.empty() );
462 ASSERT_CONTAINER_SIZE( m, 0 );
466 template <typename Traits>
467 class RefinableMap: public StripedMap< Traits >
470 TYPED_TEST_CASE_P( StripedMap );
471 TYPED_TEST_CASE_P( RefinableMap );
474 // ****************************************************************
477 TYPED_TEST_P( StripedMap, compare )
479 typedef cc::StripedMap<
480 typename TestFixture::container_type,
481 cds::opt::hash< typename TestFixture::hash1 >,
482 cds::opt::compare< typename TestFixture::cmp >,
483 cds::opt::mutex_policy< cc::striped_set::striping<>>
490 TYPED_TEST_P( StripedMap, less )
492 typedef cc::StripedMap<
493 typename TestFixture::container_type,
494 cds::opt::hash< typename TestFixture::hash1 >,
495 cds::opt::less< typename TestFixture::less >
503 TYPED_TEST_P( StripedMap, cmpmix )
505 typedef cc::StripedMap<
506 typename TestFixture::container_type,
507 cds::opt::hash< typename TestFixture::hash1 >,
508 cds::opt::less< typename TestFixture::less >,
509 cds::opt::compare< typename TestFixture::cmp >
516 TYPED_TEST_P( StripedMap, spinlock )
518 typedef cc::StripedMap<
519 typename TestFixture::container_type,
520 cds::opt::mutex_policy< cc::striped_set::striping<cds::sync::spin>>,
521 cds::opt::hash< typename TestFixture::hash1 >,
522 cds::opt::less< typename TestFixture::less >,
523 cds::opt::compare< typename TestFixture::cmp >
530 TYPED_TEST_P( StripedMap, load_factor_resizing )
532 typedef cc::StripedMap<
533 typename TestFixture::container_type,
534 cds::opt::hash< typename TestFixture::hash1 >,
535 cds::opt::less< typename TestFixture::less >,
536 cds::opt::compare< typename TestFixture::cmp >,
537 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<4>>
544 TYPED_TEST_P( StripedMap, load_factor_resizing_rt )
546 typedef cc::StripedMap<
547 typename TestFixture::container_type,
548 cds::opt::hash< typename TestFixture::hash1 >,
549 cds::opt::compare< typename TestFixture::cmp >,
550 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<0>>
553 map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 ) );
557 TYPED_TEST_P( StripedMap, single_bucket_resizing )
559 typedef cc::StripedMap<
560 typename TestFixture::container_type,
561 cds::opt::hash< typename TestFixture::hash1 >,
562 cds::opt::compare< typename TestFixture::cmp >,
563 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<6>>
570 TYPED_TEST_P( StripedMap, single_bucket_resizing_rt )
572 typedef cc::StripedMap<
573 typename TestFixture::container_type,
574 cds::opt::hash< typename TestFixture::hash1 >,
575 cds::opt::compare< typename TestFixture::cmp >,
576 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<0>>
579 cc::striped_set::single_bucket_size_threshold<0> resizing_policy( 8 );
580 map_type m( 24, resizing_policy );
584 TYPED_TEST_P( StripedMap, copy_policy_copy )
586 typedef cc::StripedMap<
587 typename TestFixture::container_type,
588 cds::opt::hash< typename TestFixture::hash1 >,
589 cds::opt::less< typename TestFixture::less >,
590 cds::opt::compare< typename TestFixture::cmp >,
591 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<4>>,
592 cds::opt::copy_policy< cc::striped_set::copy_item >
599 TYPED_TEST_P( StripedMap, copy_policy_move )
601 typedef cc::StripedMap<
602 typename TestFixture::container_type,
603 cds::opt::hash< typename TestFixture::hash1 >,
604 cds::opt::compare< typename TestFixture::cmp >,
605 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<0>>,
606 cds::opt::copy_policy< cc::striped_set::move_item >
609 map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 ) );
613 TYPED_TEST_P( StripedMap, copy_policy_swap )
615 typedef cc::StripedMap<
616 typename TestFixture::container_type,
617 cds::opt::hash< typename TestFixture::hash1 >,
618 cds::opt::compare< typename TestFixture::cmp >,
619 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<6>>,
620 cds::opt::copy_policy< cc::striped_set::swap_item >
627 TYPED_TEST_P( StripedMap, copy_policy_special )
629 typedef cc::StripedMap<
630 typename TestFixture::container_type,
631 cds::opt::hash< typename TestFixture::hash1 >,
632 cds::opt::compare< typename TestFixture::cmp >,
633 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<0>>,
634 cds::opt::copy_policy< typename TestFixture::copy_policy >
637 cc::striped_set::single_bucket_size_threshold<0> resizing_policy( 8 );
638 map_type m( 24, resizing_policy );
643 // ****************************************************************
646 TYPED_TEST_P( RefinableMap, compare )
648 typedef cc::StripedMap<
649 typename TestFixture::container_type,
650 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
651 cds::opt::hash< typename TestFixture::hash1 >,
652 cds::opt::compare< typename TestFixture::cmp >
659 TYPED_TEST_P( RefinableMap, less )
661 typedef cc::StripedMap<
662 typename TestFixture::container_type,
663 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
664 cds::opt::hash< typename TestFixture::hash1 >,
665 cds::opt::less< typename TestFixture::less >
673 TYPED_TEST_P( RefinableMap, cmpmix )
675 typedef cc::StripedMap<
676 typename TestFixture::container_type,
677 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
678 cds::opt::hash< typename TestFixture::hash1 >,
679 cds::opt::less< typename TestFixture::less >,
680 cds::opt::compare< typename TestFixture::cmp >
687 TYPED_TEST_P( RefinableMap, spinlock )
689 typedef cc::StripedMap<
690 typename TestFixture::container_type,
691 cds::opt::mutex_policy< cc::striped_set::refinable<cds::sync::reentrant_spin>>,
692 cds::opt::hash< typename TestFixture::hash1 >,
693 cds::opt::less< typename TestFixture::less >,
694 cds::opt::compare< typename TestFixture::cmp >
701 TYPED_TEST_P( RefinableMap, load_factor_resizing )
703 typedef cc::StripedMap<
704 typename TestFixture::container_type,
705 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
706 cds::opt::hash< typename TestFixture::hash1 >,
707 cds::opt::less< typename TestFixture::less >,
708 cds::opt::compare< typename TestFixture::cmp >,
709 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<4>>
716 TYPED_TEST_P( RefinableMap, load_factor_resizing_rt )
718 typedef cc::StripedMap<
719 typename TestFixture::container_type,
720 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
721 cds::opt::hash< typename TestFixture::hash1 >,
722 cds::opt::compare< typename TestFixture::cmp >,
723 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<0>>
726 map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 ) );
730 TYPED_TEST_P( RefinableMap, single_bucket_resizing )
732 typedef cc::StripedMap<
733 typename TestFixture::container_type,
734 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
735 cds::opt::hash< typename TestFixture::hash1 >,
736 cds::opt::compare< typename TestFixture::cmp >,
737 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<6>>
744 TYPED_TEST_P( RefinableMap, single_bucket_resizing_rt )
746 typedef cc::StripedMap<
747 typename TestFixture::container_type,
748 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
749 cds::opt::hash< typename TestFixture::hash1 >,
750 cds::opt::compare< typename TestFixture::cmp >,
751 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<0>>
754 cc::striped_set::single_bucket_size_threshold<0> resizing_policy( 8 );
755 map_type m( 24, resizing_policy );
759 TYPED_TEST_P( RefinableMap, copy_policy_copy )
761 typedef cc::StripedMap<
762 typename TestFixture::container_type,
763 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
764 cds::opt::hash< typename TestFixture::hash1 >,
765 cds::opt::less< typename TestFixture::less >,
766 cds::opt::compare< typename TestFixture::cmp >,
767 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<4>>,
768 cds::opt::copy_policy< cc::striped_set::copy_item >
775 TYPED_TEST_P( RefinableMap, copy_policy_move )
777 typedef cc::StripedMap<
778 typename TestFixture::container_type,
779 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
780 cds::opt::hash< typename TestFixture::hash1 >,
781 cds::opt::compare< typename TestFixture::cmp >,
782 cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<0>>,
783 cds::opt::copy_policy< cc::striped_set::move_item >
786 map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 ) );
790 TYPED_TEST_P( RefinableMap, copy_policy_swap )
792 typedef cc::StripedMap<
793 typename TestFixture::container_type,
794 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
795 cds::opt::hash< typename TestFixture::hash1 >,
796 cds::opt::compare< typename TestFixture::cmp >,
797 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<6>>,
798 cds::opt::copy_policy< cc::striped_set::swap_item >
805 TYPED_TEST_P( RefinableMap, copy_policy_special )
807 typedef cc::StripedMap<
808 typename TestFixture::container_type,
809 cds::opt::mutex_policy< cc::striped_set::refinable<>>,
810 cds::opt::hash< typename TestFixture::hash1 >,
811 cds::opt::compare< typename TestFixture::cmp >,
812 cds::opt::resizing_policy< cc::striped_set::single_bucket_size_threshold<0>>,
813 cds::opt::copy_policy< typename TestFixture::copy_policy >
816 cc::striped_set::single_bucket_size_threshold<0> resizing_policy( 8 );
817 map_type m( 24, resizing_policy );
821 REGISTER_TYPED_TEST_CASE_P( StripedMap,
822 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
825 REGISTER_TYPED_TEST_CASE_P( RefinableMap,
826 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
830 #endif // #ifndef CDSUNIT_STRIPED_MAP_TEST_STRIPED_MAP_H