File: test_bronson_avltree_map_ptr.h

package info (click to toggle)
libcds 2.3.3-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,632 kB
  • sloc: cpp: 135,002; ansic: 7,234; perl: 243; sh: 237; makefile: 6
file content (702 lines) | stat: -rw-r--r-- 25,886 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
// Copyright (c) 2006-2018 Maxim Khizhinsky
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef CDSUNIT_TREE_TEST_BRONSON_AVLTREE_MAP_PTR_H
#define CDSUNIT_TREE_TEST_BRONSON_AVLTREE_MAP_PTR_H

#include "test_tree_map_data.h"
#include <cds/container/bronson_avltree_map_rcu.h>
#include <cds/sync/pool_monitor.h>
#include <cds/memory/vyukov_queue_pool.h>

namespace {

    namespace cc = cds::container;

    class bronson_avltree_map_ptr: public cds_test::tree_map_fixture
    {
    public:
        static size_t const kSize = 1000;

        struct value_type: public cds_test::tree_map_fixture::value_type
        {
            typedef cds_test::tree_map_fixture::value_type base_class;

            size_t nDisposeCount = 0;

            // Inheriting constructors
            using base_class::value_type;
        };

        struct mock_disposer
        {
            void operator()( value_type * val ) const
            {
                ++val->nDisposeCount;
            }
        };

    protected:
        template <class Map>
        void test( Map& m )
        {
            // Precondition: map is empty
            // Postcondition: map is empty

            ASSERT_TRUE( m.empty());
            ASSERT_CONTAINER_SIZE( m, 0 );

            typedef typename Map::key_type key_type;
            typedef typename std::remove_pointer< typename Map::mapped_type >::type mapped_type;
            size_t const kkSize = kSize;

            std::vector<key_type> arrKeys;
            for ( int i = 0; i < static_cast<int>(kkSize); ++i )
                arrKeys.push_back( key_type( i ));
            shuffle( arrKeys.begin(), arrKeys.end());

            std::vector< value_type > arrVals;
            for ( size_t i = 0; i < kkSize; ++i ) {
                value_type val;
                val.nVal = static_cast<int>( i );
                val.strVal = std::to_string( i );
                arrVals.push_back( val );
            }

            // insert/find
            for ( auto const& i : arrKeys ) {
                value_type& val( arrVals.at( i.nKey ));

                ASSERT_FALSE( m.contains( i.nKey ));
                ASSERT_FALSE( m.contains( i ));
                ASSERT_FALSE( m.contains( other_item( i.nKey ), other_less()));
                ASSERT_FALSE( m.find( i, []( key_type const&, mapped_type& ) {
                    ASSERT_TRUE( false );
                } ));
                ASSERT_FALSE( m.find( i.nKey, []( key_type const&, mapped_type& ) {
                    EXPECT_TRUE( false );
                } ));
                ASSERT_FALSE( m.find_with( other_item( i.nKey ), other_less(), []( key_type const&, mapped_type& ) {
                    EXPECT_TRUE( false );
                } ));

                std::pair< bool, bool > updResult;

                switch ( i.nKey % 6 ) {
                case 0:
                    ASSERT_TRUE( m.insert( i, &val ));
                    ASSERT_FALSE( m.insert( i, &val ));
                    ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
                        v.nVal = k.nKey;
                        v.strVal = std::to_string( k.nKey );
                    } ));
                    break;
                case 1:
                    ASSERT_TRUE( m.insert( i.nKey, &val ));
                    ASSERT_FALSE( m.insert( i.nKey, &val ));
                    ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
                        v.nVal = k.nKey;
                        v.strVal = std::to_string( k.nKey );
                    } ));
                    break;
                case 2:
                    ASSERT_TRUE( m.insert( std::to_string( i.nKey ), &val ));
                    ASSERT_FALSE( m.insert( std::to_string( i.nKey ), &val ));
                    ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
                        v.nVal = k.nKey;
                        v.strVal = std::to_string( k.nKey );
                    } ));
                    break;
                case 3:
                    updResult = m.update( i.nKey, &val, false );
                    ASSERT_FALSE( updResult.first );
                    ASSERT_FALSE( updResult.second );

                    updResult = m.update( i.nKey, &val );
                    ASSERT_TRUE( updResult.first );
                    ASSERT_TRUE( updResult.second );

                    updResult = m.update( i.nKey, &val );
                    ASSERT_TRUE( updResult.first );
                    ASSERT_FALSE( updResult.second );
                    break;
                case 4:
                    updResult = m.update( i, &val, false );
                    ASSERT_FALSE( updResult.first );
                    ASSERT_FALSE( updResult.second );

                    updResult = m.update( i, &val );
                    ASSERT_TRUE( updResult.first );
                    ASSERT_TRUE( updResult.second );

                    updResult = m.update( i, &val );
                    ASSERT_TRUE( updResult.first );
                    ASSERT_FALSE( updResult.second );
                    break;
                case 5:
                    updResult = m.update( val.strVal, &val, false );
                    ASSERT_FALSE( updResult.first );
                    ASSERT_FALSE( updResult.second );

                    updResult = m.update( val.strVal, &val );
                    ASSERT_TRUE( updResult.first );
                    ASSERT_TRUE( updResult.second );

                    updResult = m.update( val.strVal, &val );
                    ASSERT_TRUE( updResult.first );
                    ASSERT_FALSE( updResult.second );
                    break;
                }

                ASSERT_TRUE( m.contains( i.nKey ));
                ASSERT_TRUE( m.contains( i ));
                ASSERT_TRUE( m.contains( other_item( i.nKey ), other_less()));
                ASSERT_TRUE( m.find( i, []( key_type const& k, mapped_type& v ) {
                    EXPECT_EQ( k.nKey, v.nVal );
                    EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                } ));
                ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
                    EXPECT_EQ( k.nKey, v.nVal );
                    EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                } ));
                ASSERT_TRUE( m.find_with( other_item( i.nKey ), other_less(), []( key_type const& k, mapped_type& v ) {
                    EXPECT_EQ( k.nKey, v.nVal );
                    EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                } ));
            }
            ASSERT_FALSE( m.empty());
            ASSERT_CONTAINER_SIZE( m, kkSize );

            ASSERT_TRUE( m.check_consistency());

            shuffle( arrKeys.begin(), arrKeys.end());

            // erase/find
            for ( auto const& i : arrKeys ) {
                value_type const& val( arrVals.at( i.nKey ));

                ASSERT_TRUE( m.contains( i.nKey ));
                ASSERT_TRUE( m.contains( val.strVal ));
                ASSERT_TRUE( m.contains( i ));
                ASSERT_TRUE( m.contains( other_item( i.nKey ), other_less()));
                ASSERT_TRUE( m.find( i, []( key_type const& k, mapped_type& v ) {
                    EXPECT_EQ( k.nKey, v.nVal );
                    EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                } ));
                ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
                    EXPECT_EQ( k.nKey, v.nVal );
                    EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                } ));
                ASSERT_TRUE( m.find_with( other_item( i.nKey ), other_less(), []( key_type const& k, mapped_type& v ) {
                    EXPECT_EQ( k.nKey, v.nVal );
                    EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                } ));


                switch ( i.nKey % 8 ) {
                case 0:
                    ASSERT_TRUE( m.erase( i ));
                    ASSERT_FALSE( m.erase( i ));
                    break;
                case 1:
                    ASSERT_TRUE( m.erase( i.nKey ));
                    ASSERT_FALSE( m.erase( i.nKey ));
                    break;
                case 2:
                    ASSERT_TRUE( m.erase( val.strVal ));
                    ASSERT_FALSE( m.erase( val.strVal ));
                    break;
                case 3:
                    ASSERT_TRUE( m.erase_with( other_item( i.nKey ), other_less()));
                    ASSERT_FALSE( m.erase_with( other_item( i.nKey ), other_less()));
                    break;
                case 4:
                    ASSERT_TRUE( m.erase( i, []( key_type const& k, mapped_type& v ) {
                        EXPECT_EQ( k.nKey, v.nVal );
                        EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
                    }));
                    ASSERT_FALSE( m.erase( i, []( key_type const& /*key*/, mapped_type& /*val*/ ) {
                        EXPECT_TRUE( false );
                    }));
                    break;
                case 5:
                    ASSERT_TRUE( m.erase( i.nKey, []( key_type const& key, mapped_type& v ) {
                        EXPECT_EQ( key.nKey, v.nVal );
                        EXPECT_EQ( std::to_string( key.nKey ), v.strVal );
                    }));
                    ASSERT_FALSE( m.erase( i.nKey, []( key_type const&, mapped_type& ) {
                        EXPECT_TRUE( false );
                    }));
                    break;
                case 6:
                    ASSERT_TRUE( m.erase( val.strVal, []( key_type const& key, mapped_type& v ) {
                        EXPECT_EQ( key.nKey, v.nVal );
                        EXPECT_EQ( std::to_string( key.nKey ), v.strVal );
                    }));
                    ASSERT_FALSE( m.erase( val.strVal, []( key_type const&, mapped_type& ) {
                        EXPECT_TRUE( false );
                    }));
                    break;
                case 7:
                    ASSERT_TRUE( m.erase_with( other_item( i.nKey ), other_less(), []( key_type const& key, mapped_type& v ) {
                        EXPECT_EQ( key.nKey, v.nVal );
                        EXPECT_EQ( std::to_string( key.nKey ), v.strVal );
                    }));
                    ASSERT_FALSE( m.erase_with( other_item( i.nKey ), other_less(), []( key_type const& /*key*/, mapped_type& /*v*/ ) {
                        EXPECT_TRUE( false );
                    }));
                    break;
                }

                ASSERT_FALSE( m.contains( i.nKey ));
                ASSERT_FALSE( m.contains( i ));
                ASSERT_FALSE( m.contains( val.strVal ));
                ASSERT_FALSE( m.contains( other_item( i.nKey ), other_less()));
                ASSERT_FALSE( m.find( i, []( key_type const& /*key*/, mapped_type& /*val*/ ) {
                    ASSERT_TRUE( false );
                } ));
                ASSERT_FALSE( m.find( i.nKey, []( key_type const& /*key*/, mapped_type& /*val*/ ) {
                    EXPECT_TRUE( false );
                } ));
                ASSERT_FALSE( m.find_with( other_item( i.nKey ), other_less(), []( key_type const& /*key*/, mapped_type& /*val*/ ) {
                    EXPECT_TRUE( false );
                } ));
            }
            ASSERT_TRUE( m.empty());
            ASSERT_CONTAINER_SIZE( m, 0 );

            Map::gc::force_dispose();
            for ( auto const& item: arrVals ) {
                EXPECT_EQ( item.nDisposeCount, 1u );
            }

            // clear
            for ( auto const& i : arrKeys ) {
                value_type& val( arrVals.at( i.nKey ));
                ASSERT_TRUE( m.insert( i, &val ));
            }

            ASSERT_FALSE( m.empty());
            ASSERT_CONTAINER_SIZE( m, kkSize );

            m.clear();

            ASSERT_TRUE( m.empty());
            ASSERT_CONTAINER_SIZE( m, 0 );

            Map::gc::force_dispose();
            for ( auto const& item : arrVals ) {
                EXPECT_EQ( item.nDisposeCount, 2u );
            }

            ASSERT_TRUE( m.check_consistency());


            // RCU-specific test related to exempt_ptr
            typedef typename Map::exempt_ptr exempt_ptr;
            exempt_ptr xp;

            // extract
            for ( auto const& i : arrKeys ) {
                value_type& val( arrVals.at( i.nKey ));
                ASSERT_TRUE( m.insert( i, &val ));
            }
            ASSERT_FALSE( m.empty());
            ASSERT_CONTAINER_SIZE( m, kkSize );

            for ( auto const& i : arrKeys ) {
                value_type const& val = arrVals.at( i.nKey );

                EXPECT_TRUE( m.contains( i.nKey ));

                switch ( i.nKey % 4 ) {
                case 0:
                    xp = m.extract( i.nKey );
                    break;
                case 1:
                    xp = m.extract( i );
                    break;
                case 2:
                    xp = m.extract( val.strVal );
                    break;
                case 3:
                    xp = m.extract_with( other_item( i.nKey ), other_less());
                    break;
                }
                ASSERT_FALSE( !xp );
                EXPECT_EQ( xp->nVal, i.nKey );

                EXPECT_FALSE( m.contains( i.nKey ));
            }
            ASSERT_TRUE( m.empty());
            ASSERT_CONTAINER_SIZE( m, 0 );
            xp.release();

            Map::gc::force_dispose();
            for ( auto const& item : arrVals ) {
                EXPECT_EQ( item.nDisposeCount, 3u );
            }

            // extract_min
            shuffle( arrKeys.begin(), arrKeys.end());
            for ( auto const& i : arrKeys ) {
                value_type& val( arrVals.at( i.nKey ));
                ASSERT_TRUE( m.insert( i, &val ));
            }
            ASSERT_FALSE( m.empty());
            ASSERT_CONTAINER_SIZE( m, kkSize );
            ASSERT_TRUE( m.check_consistency());

            int nPrevKey = -1;
            size_t nCount = 0;
            while ( !m.empty()) {
                switch ( nCount % 3 ) {
                case 0:
                    xp = m.extract_min();
                    break;
                case 1:
                    xp = m.extract_min( [nPrevKey]( key_type const& k ) {
                        EXPECT_EQ( k.nKey, nPrevKey + 1 );
                    } );
                    break;
                case 2:
                {
                    key_type key;
                    xp = m.extract_min_key( key );
                    EXPECT_EQ( key.nKey, nPrevKey + 1 );
                }
                break;
                }
                ASSERT_FALSE( !xp );
                EXPECT_EQ( xp->nVal, nPrevKey + 1 );

                nPrevKey = xp->nVal;
                ++nCount;
            }
            ASSERT_TRUE( m.empty());
            ASSERT_CONTAINER_SIZE( m, 0 );
            EXPECT_EQ( nCount, kkSize );
            xp.release();

            Map::gc::force_dispose();
            for ( auto const& item : arrVals ) {
                EXPECT_EQ( item.nDisposeCount, 4u );
            }

            // extract_max
            shuffle( arrKeys.begin(), arrKeys.end());
            for ( auto const& i : arrKeys ) {
                value_type& val( arrVals.at( i.nKey ));
                ASSERT_TRUE( m.insert( i, &val ));
            }
            ASSERT_FALSE( m.empty());
            ASSERT_CONTAINER_SIZE( m, kkSize );
            ASSERT_TRUE( m.check_consistency());

            nPrevKey = static_cast<int>(kkSize);
            nCount = 0;
            while ( !m.empty()) {
                switch ( nCount % 3 ) {
                case 0:
                    xp = m.extract_max();
                    break;
                case 1:
                    xp = m.extract_max( [nPrevKey]( key_type const& k ) {
                        EXPECT_EQ( k.nKey, nPrevKey - 1 );
                    } );
                    break;
                case 2:
                {
                    key_type key;
                    xp = m.extract_max_key( key );
                    EXPECT_EQ( key.nKey, nPrevKey - 1 );
                }
                break;
                }
                ASSERT_FALSE( !xp );
                EXPECT_EQ( xp->nVal, nPrevKey - 1 );

                nPrevKey = xp->nVal;
                ++nCount;
            }
            ASSERT_TRUE( m.empty());
            ASSERT_CONTAINER_SIZE( m, 0 );
            EXPECT_EQ( nCount, kkSize );
            xp.release();

            Map::gc::force_dispose();
            for ( auto const& item : arrVals ) {
                EXPECT_EQ( item.nDisposeCount, 5u );
            }

            // extract min/max on empty map
            xp = m.extract_min();
            EXPECT_TRUE( !xp );
            xp = m.extract_min( []( key_type const& ) { EXPECT_FALSE( true ); } );
            EXPECT_TRUE( !xp );
            xp = m.extract_max();
            EXPECT_TRUE( !xp );
            xp = m.extract_max( []( key_type const& ) { EXPECT_FALSE( true ); } );
            EXPECT_TRUE( !xp );
            {
                key_type key;
                key.nKey = -100;
                xp = m.extract_min_key( key );
                EXPECT_TRUE( !xp );
                EXPECT_EQ( key.nKey, -100 );
                xp = m.extract_max_key( key );
                EXPECT_TRUE( !xp );
                EXPECT_EQ( key.nKey, -100 );
            }

            // checking empty map
            ASSERT_TRUE( m.check_consistency());
        }
    };

    template <class RCU>
    class BronsonAVLTreeMapPtr: public bronson_avltree_map_ptr
    {
        typedef bronson_avltree_map_ptr base_class;
    public:
        typedef cds::urcu::gc<RCU> rcu_type;

    protected:
        void SetUp()
        {
            RCU::Construct();
            cds::threading::Manager::attachThread();
        }

        void TearDown()
        {
            cds::threading::Manager::detachThread();
            RCU::Destruct();
        }
    };

    struct bronson_traits: public cds::container::bronson_avltree::traits
    {
        typedef bronson_avltree_map_ptr::mock_disposer disposer;
    };

    TYPED_TEST_CASE_P( BronsonAVLTreeMapPtr );

    TYPED_TEST_P( BronsonAVLTreeMapPtr, compare )
    {
        typedef typename TestFixture::rcu_type rcu_type;
        typedef typename TestFixture::key_type key_type;
        typedef typename TestFixture::value_type value_type;

        typedef cc::BronsonAVLTreeMap< rcu_type, key_type, value_type*,
            typename cc::bronson_avltree::make_traits<
                cds::opt::compare< typename TestFixture::cmp >
                ,cds::intrusive::opt::disposer< bronson_avltree_map_ptr::mock_disposer >
            >::type
        > map_type;

        map_type m;
        this->test( m );
    }

    TYPED_TEST_P( BronsonAVLTreeMapPtr, less )
    {
        typedef typename TestFixture::rcu_type rcu_type;
        typedef typename TestFixture::key_type key_type;
        typedef typename TestFixture::value_type value_type;

        typedef cc::BronsonAVLTreeMap< rcu_type, key_type, value_type*,
            typename cc::bronson_avltree::make_traits<
                cds::opt::less< typename TestFixture::less >
                , cds::intrusive::opt::disposer< bronson_avltree_map_ptr::mock_disposer >
            >::type
        > map_type;

        map_type m;
        this->test( m );
    }

    TYPED_TEST_P( BronsonAVLTreeMapPtr, cmpmix )
    {
        typedef typename TestFixture::rcu_type rcu_type;
        typedef typename TestFixture::key_type key_type;
        typedef typename TestFixture::value_type value_type;

        typedef cc::BronsonAVLTreeMap< rcu_type, key_type, value_type*,
            typename cc::bronson_avltree::make_traits<
                cds::opt::less< typename TestFixture::less >
                ,cds::opt::compare< typename TestFixture::cmp >
                , cds::intrusive::opt::disposer< bronson_avltree_map_ptr::mock_disposer >
            >::type
        > map_type;

        map_type m;
        this->test( m );
    }

    TYPED_TEST_P( BronsonAVLTreeMapPtr, stat )
    {
        typedef typename TestFixture::rcu_type rcu_type;
        typedef typename TestFixture::key_type key_type;
        typedef typename TestFixture::value_type value_type;

        struct map_traits: public bronson_traits
        {
            typedef typename TestFixture::less  less;
            typedef cc::bronson_avltree::stat<> stat;
        };

        typedef cc::BronsonAVLTreeMap< rcu_type, key_type, value_type*, map_traits > map_type;

        map_type m;
        this->test( m );
    }

    TYPED_TEST_P( BronsonAVLTreeMapPtr, item_counting )
    {
        typedef typename TestFixture::rcu_type rcu_type;
        typedef typename TestFixture::key_type key_type;
        typedef typename TestFixture::value_type value_type;

        struct map_traits: public bronson_traits
        {
            typedef typename TestFixture::cmp    compare;
            typedef cds::atomicity::item_counter item_counter;
        };

        typedef cc::BronsonAVLTreeMap< rcu_type, key_type, value_type*, map_traits > map_type;

        map_type m;
        this->test( m );
    }

    struct bronson_relaxed_insert_traits: public bronson_traits
    {
        static bool const relaxed_insert = true;
    };

    TYPED_TEST_P( BronsonAVLTreeMapPtr, relaxed_insert )
    {
        typedef typename TestFixture::rcu_type rcu_type;
        typedef typename TestFixture::key_type key_type;
        typedef typename TestFixture::value_type value_type;

        struct map_traits: public bronson_relaxed_insert_traits
        {
            typedef typename TestFixture::cmp    compare;
            typedef cds::atomicity::item_counter item_counter;
        };

        typedef cc::BronsonAVLTreeMap< rcu_type, key_type, value_type*, map_traits > map_type;

        map_type m;
        this->test( m );
    }

    TYPED_TEST_P( BronsonAVLTreeMapPtr, seq_cst )
    {
        typedef typename TestFixture::rcu_type rcu_type;
        typedef typename TestFixture::key_type key_type;
        typedef typename TestFixture::value_type value_type;

        struct map_traits: public bronson_traits
        {
            typedef typename TestFixture::cmp    compare;
            typedef cds::atomicity::item_counter item_counter;
            typedef cds::opt::v::sequential_consistent memory_model;
        };

        typedef cc::BronsonAVLTreeMap< rcu_type, key_type, value_type*, map_traits > map_type;

        map_type m;
        this->test( m );
    }

    TYPED_TEST_P( BronsonAVLTreeMapPtr, sync_monitor )
    {
        typedef typename TestFixture::rcu_type rcu_type;
        typedef typename TestFixture::key_type key_type;
        typedef typename TestFixture::value_type value_type;

        struct map_traits: public bronson_traits
        {
            typedef typename TestFixture::cmp    compare;
            typedef cds::atomicity::item_counter item_counter;
            typedef cds::sync::pool_monitor< cds::memory::vyukov_queue_pool< std::mutex >> sync_monitor;
        };

        typedef cc::BronsonAVLTreeMap< rcu_type, key_type, value_type*, map_traits > map_type;

        map_type m;
        this->test( m );
    }

    TYPED_TEST_P( BronsonAVLTreeMapPtr, lazy_sync_monitor )
    {
        typedef typename TestFixture::rcu_type rcu_type;
        typedef typename TestFixture::key_type key_type;
        typedef typename TestFixture::value_type value_type;

        struct map_traits: public bronson_traits
        {
            typedef typename TestFixture::cmp    compare;
            typedef cds::atomicity::item_counter item_counter;
            typedef cds::sync::pool_monitor< cds::memory::lazy_vyukov_queue_pool< std::mutex >> sync_monitor;
        };

        typedef cc::BronsonAVLTreeMap< rcu_type, key_type, value_type*, map_traits > map_type;

        map_type m;
        this->test( m );
    }

    TYPED_TEST_P( BronsonAVLTreeMapPtr, rcu_check_deadlock )
    {
        typedef typename TestFixture::rcu_type rcu_type;
        typedef typename TestFixture::key_type key_type;
        typedef typename TestFixture::value_type value_type;

        struct map_traits: public bronson_traits
        {
            typedef typename TestFixture::cmp    compare;
            typedef cds::atomicity::item_counter item_counter;
            typedef cds::sync::pool_monitor< cds::memory::vyukov_queue_pool< std::mutex >> sync_monitor;
            typedef cds::opt::v::rcu_assert_deadlock rcu_check_deadlock;
        };

        typedef cc::BronsonAVLTreeMap< rcu_type, key_type, value_type*, map_traits > map_type;

        map_type m;
        this->test( m );
    }

    TYPED_TEST_P( BronsonAVLTreeMapPtr, rcu_no_check_deadlock )
    {
        typedef typename TestFixture::rcu_type rcu_type;
        typedef typename TestFixture::key_type key_type;
        typedef typename TestFixture::value_type value_type;

        struct map_traits: public bronson_traits
        {
            typedef typename TestFixture::cmp    compare;
            typedef cds::atomicity::item_counter item_counter;
            typedef cds::sync::pool_monitor< cds::memory::lazy_vyukov_queue_pool< std::mutex >> sync_monitor;
            typedef cds::opt::v::rcu_no_check_deadlock rcu_check_deadlock;
        };

        typedef cc::BronsonAVLTreeMap< rcu_type, key_type, value_type*, map_traits > map_type;

        map_type m;
        this->test( m );
    }

    REGISTER_TYPED_TEST_CASE_P( BronsonAVLTreeMapPtr,
        compare, less, cmpmix, stat, item_counting, relaxed_insert, seq_cst, sync_monitor, lazy_sync_monitor, rcu_check_deadlock, rcu_no_check_deadlock
    );


} // namespace

#endif // #ifndef CDSUNIT_TREE_TEST_BRONSON_AVLTREE_MAP_PTR_H