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 #include "test_intrusive_set.h"
33 #include <cds/intrusive/cuckoo_set.h>
36 namespace ci = cds::intrusive;
38 class IntrusiveCuckooSet : public cds_test::intrusive_set
41 typedef cds_test::intrusive_set base_class;
43 typedef base_class::hash_int hash1;
46 template <typename Set>
49 // Precondition: set is empty
50 // Postcondition: set is empty
52 base_class::test_< Set::c_isSorted>( s );
54 typedef typename Set::value_type value_type;
55 size_t const nSetSize = base_class::kSize;
57 std::vector< value_type > data;
58 data.reserve( nSetSize );
59 for ( size_t key = 0; key < nSetSize; ++key )
60 data.push_back( value_type( static_cast<int>(key) ) );
63 for ( auto& i : data ) {
65 ASSERT_TRUE( s.insert( i ) );
67 ASSERT_FALSE( s.empty() );
68 ASSERT_CONTAINER_SIZE( s, nSetSize );
72 ASSERT_TRUE( s.empty() );
73 ASSERT_CONTAINER_SIZE( s, 0 );
74 for ( auto& i : data ) {
75 EXPECT_EQ( i.nDisposeCount, 1 );
88 //************************************************************
91 TEST_F( IntrusiveCuckooSet, striped_list_basehook_unordered )
93 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 > > item_type;
94 struct set_traits: public ci::cuckoo::traits
96 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
97 typedef base_class::equal_to<item_type> equal_to;
98 typedef mock_disposer disposer;
100 typedef ci::CuckooSet< item_type, set_traits > set_type;
106 TEST_F( IntrusiveCuckooSet, striped_vector_basehook_unordered )
108 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 0 >> item_type;
109 struct set_traits: public ci::cuckoo::traits
111 typedef ci::cuckoo::base_hook< ci::cuckoo::probeset_type< item_type::probeset_type >> hook;
112 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
113 typedef base_class::equal_to<item_type> equal_to;
114 typedef mock_disposer disposer;
116 typedef ci::CuckooSet< item_type, set_traits > set_type;
122 TEST_F( IntrusiveCuckooSet, striped_list_basehook_ordered_cmp )
124 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
126 typedef ci::CuckooSet< item_type
127 ,ci::cuckoo::make_traits<
128 ci::opt::hook< ci::cuckoo::base_hook<
129 ci::cuckoo::probeset_type< item_type::probeset_type >
131 ,ci::opt::hash< std::tuple< hash1, hash2 > >
132 ,ci::opt::compare< cmp<item_type> >
133 ,ci::opt::disposer< mock_disposer >
137 set_type s( 32, 6, 4 );
141 TEST_F( IntrusiveCuckooSet, striped_vector_basehook_ordered_cmp )
143 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<8>, 0 >> item_type;
145 typedef ci::CuckooSet< item_type
146 ,ci::cuckoo::make_traits<
147 ci::opt::hook< ci::cuckoo::base_hook<
148 ci::cuckoo::probeset_type< item_type::probeset_type >
150 ,ci::opt::hash< std::tuple< hash1, hash2 > >
151 ,ci::opt::compare< cmp<item_type> >
152 , ci::opt::disposer< mock_disposer >
156 typename set_type::hash_tuple_type ht;
161 TEST_F( IntrusiveCuckooSet, striped_list_basehook_ordered_less )
163 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
165 typedef ci::CuckooSet< item_type
166 ,ci::cuckoo::make_traits<
167 ci::opt::hook< ci::cuckoo::base_hook<
168 ci::cuckoo::probeset_type< item_type::probeset_type >
170 ,ci::opt::hash< std::tuple< hash1, hash2 > >
171 ,ci::opt::less< less<item_type> >
172 , ci::opt::disposer< mock_disposer >
176 typename set_type::hash_tuple_type ht;
177 set_type s( 32, 6, 4, ht );
181 TEST_F( IntrusiveCuckooSet, striped_vector_basehook_ordered_less )
183 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
185 typedef ci::CuckooSet< item_type
186 ,ci::cuckoo::make_traits<
187 ci::opt::hook< ci::cuckoo::base_hook<
188 ci::cuckoo::probeset_type< item_type::probeset_type >
190 ,ci::opt::hash< std::tuple< hash1, hash2 > >
191 ,ci::opt::less< less<item_type> >
192 ,ci::opt::disposer< mock_disposer >
196 typename set_type::hash_tuple_type ht;
197 set_type s( std::move( ht ));
201 TEST_F( IntrusiveCuckooSet, striped_list_basehook_ordered_cmpmix )
203 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
205 typedef ci::CuckooSet< item_type
206 ,ci::cuckoo::make_traits<
207 ci::opt::hook< ci::cuckoo::base_hook<
208 ci::cuckoo::probeset_type< item_type::probeset_type >
210 ,ci::opt::hash< std::tuple< hash1, hash2 > >
211 ,ci::opt::less< less<item_type> >
212 ,ci::opt::compare< cmp<item_type> >
213 ,ci::opt::disposer< mock_disposer >
217 typename set_type::hash_tuple_type ht;
218 set_type s( 32, 6, 0, std::move( ht ));
222 TEST_F( IntrusiveCuckooSet, striped_vector_basehook_ordered_cmpmix )
224 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
226 typedef ci::CuckooSet< item_type
227 ,ci::cuckoo::make_traits<
228 ci::opt::hook< ci::cuckoo::base_hook<
229 ci::cuckoo::probeset_type< item_type::probeset_type >
231 ,ci::opt::hash< std::tuple< hash1, hash2 > >
232 ,ci::opt::less< less<item_type> >
233 ,ci::opt::compare< cmp<item_type> >
234 ,ci::opt::disposer< mock_disposer >
238 typename set_type::hash_tuple_type ht;
239 set_type s( std::move( ht ));
243 TEST_F( IntrusiveCuckooSet, striped_list_basehook_ordered_stat )
245 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
247 typedef ci::CuckooSet< item_type
248 ,ci::cuckoo::make_traits<
249 ci::opt::hook< ci::cuckoo::base_hook<
250 ci::cuckoo::probeset_type< item_type::probeset_type >
252 ,ci::opt::hash< std::tuple< hash1, hash2 > >
253 ,ci::opt::less< less<item_type> >
254 ,ci::opt::compare< cmp<item_type> >
255 ,ci::opt::stat< ci::cuckoo::stat >
256 ,ci::opt::disposer< mock_disposer >
264 TEST_F( IntrusiveCuckooSet, striped_vector_basehook_ordered_stat )
266 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
268 typedef ci::CuckooSet< item_type
269 ,ci::cuckoo::make_traits<
270 ci::opt::hook< ci::cuckoo::base_hook<
271 ci::cuckoo::probeset_type< item_type::probeset_type >
273 ,ci::opt::hash< std::tuple< hash1, hash2 > >
274 ,ci::opt::less< less<item_type> >
275 ,ci::opt::compare< cmp<item_type> >
276 ,ci::opt::stat< ci::cuckoo::stat >
277 ,ci::opt::disposer< mock_disposer >
285 TEST_F( IntrusiveCuckooSet, striped_list_basehook_unordered_storehash )
287 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
288 struct set_traits: public ci::cuckoo::traits
290 typedef ci::cuckoo::base_hook<
291 ci::cuckoo::probeset_type< item_type::probeset_type >
292 ,ci::cuckoo::store_hash< item_type::hash_array_size >
294 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
295 typedef base_class::equal_to<item_type> equal_to;
296 typedef mock_disposer disposer;
297 typedef ci::cuckoo::stat stat;
299 typedef ci::CuckooSet< item_type, set_traits > set_type;
305 TEST_F( IntrusiveCuckooSet, striped_vector_basehook_unordered_storehash )
307 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 2 >> item_type;
308 struct set_traits: public ci::cuckoo::traits
310 typedef ci::cuckoo::base_hook<
311 ci::cuckoo::probeset_type< item_type::probeset_type >
312 ,ci::cuckoo::store_hash< item_type::hash_array_size >
314 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
315 typedef base_class::equal_to<item_type> equal_to;
316 typedef mock_disposer disposer;
317 typedef ci::cuckoo::stat stat;
319 typedef ci::CuckooSet< item_type, set_traits > set_type;
325 TEST_F( IntrusiveCuckooSet, striped_list_basehook_ordered_storehash )
327 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
329 typedef ci::CuckooSet< item_type
330 ,ci::cuckoo::make_traits<
331 ci::opt::hook< ci::cuckoo::base_hook<
332 ci::cuckoo::probeset_type< item_type::probeset_type >
333 ,ci::cuckoo::store_hash< item_type::hash_array_size >
335 ,cds::opt::hash< std::tuple< hash1, hash2 > >
336 ,cds::opt::less< less<item_type> >
337 ,cds::opt::compare< cmp<item_type> >
338 ,ci::opt::disposer< mock_disposer >
342 typename set_type::hash_tuple_type ht;
343 set_type s( 32, 6, 0, std::move( ht ));
347 TEST_F( IntrusiveCuckooSet, striped_vector_basehook_ordered_storehash )
349 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 2 >> item_type;
351 typedef ci::CuckooSet< item_type
352 ,ci::cuckoo::make_traits<
353 ci::opt::hook< ci::cuckoo::base_hook<
354 ci::cuckoo::probeset_type< item_type::probeset_type >
355 ,ci::cuckoo::store_hash< item_type::hash_array_size >
357 ,cds::opt::hash< std::tuple< hash1, hash2 > >
358 ,cds::opt::less< less<item_type> >
359 ,cds::opt::compare< cmp<item_type> >
360 ,ci::opt::disposer< mock_disposer >
364 typename set_type::hash_tuple_type ht;
365 set_type s( std::move( ht ));
369 //************************************************************
370 // striped member hook
372 TEST_F( IntrusiveCuckooSet, striped_list_memberhook_unordered )
374 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 > > item_type;
375 struct set_traits: public ci::cuckoo::traits
377 typedef ci::cuckoo::member_hook< offsetof( item_type, hMember )> hook;
378 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
379 typedef base_class::equal_to<item_type> equal_to;
380 typedef mock_disposer disposer;
382 typedef ci::CuckooSet< item_type, set_traits > set_type;
388 TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_unordered )
390 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 0 >> item_type;
391 struct set_traits: public ci::cuckoo::traits
394 typedef ci::cuckoo::member_hook< offsetof( item_type, hMember ), ci::cuckoo::probeset_type< item_type::member_type::probeset_type >> hook;
395 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
396 typedef base_class::equal_to<item_type> equal_to;
397 typedef mock_disposer disposer;
399 typedef ci::CuckooSet< item_type, set_traits > set_type;
405 TEST_F( IntrusiveCuckooSet, striped_list_memberhook_ordered_cmp )
407 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
409 typedef ci::CuckooSet< item_type
410 ,ci::cuckoo::make_traits<
411 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
412 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
414 ,ci::opt::hash< std::tuple< hash1, hash2 > >
415 ,ci::opt::compare< cmp<item_type> >
416 ,ci::opt::disposer< mock_disposer >
420 set_type s( 32, 6, 4 );
424 TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_ordered_cmp )
426 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<8>, 0 >> item_type;
428 typedef ci::CuckooSet< item_type
429 ,ci::cuckoo::make_traits<
430 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
431 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
433 ,ci::opt::hash< std::tuple< hash1, hash2 > >
434 ,ci::opt::compare< cmp<item_type> >
435 , ci::opt::disposer< mock_disposer >
439 typename set_type::hash_tuple_type ht;
444 TEST_F( IntrusiveCuckooSet, striped_list_memberhook_ordered_less )
446 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
448 typedef ci::CuckooSet< item_type
449 ,ci::cuckoo::make_traits<
450 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
451 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
453 ,ci::opt::hash< std::tuple< hash1, hash2 > >
454 ,ci::opt::less< less<item_type> >
455 , ci::opt::disposer< mock_disposer >
459 typename set_type::hash_tuple_type ht;
460 set_type s( 32, 6, 4, ht );
464 TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_ordered_less )
466 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
468 typedef ci::CuckooSet< item_type
469 ,ci::cuckoo::make_traits<
470 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
471 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
473 ,ci::opt::hash< std::tuple< hash1, hash2 > >
474 ,ci::opt::less< less<item_type> >
475 ,ci::opt::disposer< mock_disposer >
479 typename set_type::hash_tuple_type ht;
480 set_type s( std::move( ht ));
484 TEST_F( IntrusiveCuckooSet, striped_list_memberhook_ordered_cmpmix )
486 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
488 typedef ci::CuckooSet< item_type
489 ,ci::cuckoo::make_traits<
490 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
491 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
493 ,ci::opt::hash< std::tuple< hash1, hash2 > >
494 ,ci::opt::less< less<item_type> >
495 ,ci::opt::compare< cmp<item_type> >
496 ,ci::opt::disposer< mock_disposer >
500 typename set_type::hash_tuple_type ht;
501 set_type s( 32, 6, 0, std::move( ht ));
505 TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_ordered_cmpmix )
507 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
509 typedef ci::CuckooSet< item_type
510 ,ci::cuckoo::make_traits<
511 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
512 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
514 ,ci::opt::hash< std::tuple< hash1, hash2 > >
515 ,ci::opt::less< less<item_type> >
516 ,ci::opt::compare< cmp<item_type> >
517 ,ci::opt::disposer< mock_disposer >
521 typename set_type::hash_tuple_type ht;
522 set_type s( std::move( ht ));
526 TEST_F( IntrusiveCuckooSet, striped_list_memberhook_ordered_stat )
528 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
530 typedef ci::CuckooSet< item_type
531 ,ci::cuckoo::make_traits<
532 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
533 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
535 ,ci::opt::hash< std::tuple< hash1, hash2 > >
536 ,ci::opt::less< less<item_type> >
537 ,ci::opt::compare< cmp<item_type> >
538 ,ci::opt::stat< ci::cuckoo::stat >
539 ,ci::opt::disposer< mock_disposer >
547 TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_ordered_stat )
549 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
551 typedef ci::CuckooSet< item_type
552 ,ci::cuckoo::make_traits<
553 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
554 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
556 ,ci::opt::hash< std::tuple< hash1, hash2 > >
557 ,ci::opt::less< less<item_type> >
558 ,ci::opt::compare< cmp<item_type> >
559 ,ci::opt::stat< ci::cuckoo::stat >
560 ,ci::opt::disposer< mock_disposer >
568 TEST_F( IntrusiveCuckooSet, striped_list_memberhook_unordered_storehash )
570 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
571 struct set_traits: public ci::cuckoo::traits
573 typedef ci::cuckoo::member_hook< offsetof( item_type, hMember ),
574 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
575 ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
577 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
578 typedef base_class::equal_to<item_type> equal_to;
579 typedef mock_disposer disposer;
580 typedef ci::cuckoo::stat stat;
582 typedef ci::CuckooSet< item_type, set_traits > set_type;
588 TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_unordered_storehash )
590 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 2 >> item_type;
591 struct set_traits: public ci::cuckoo::traits
593 typedef ci::cuckoo::member_hook< offsetof( item_type, hMember ),
594 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
595 ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
597 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
598 typedef base_class::equal_to<item_type> equal_to;
599 typedef mock_disposer disposer;
600 typedef ci::cuckoo::stat stat;
602 typedef ci::CuckooSet< item_type, set_traits > set_type;
608 TEST_F( IntrusiveCuckooSet, striped_list_memberhook_ordered_storehash )
610 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
612 typedef ci::CuckooSet< item_type
613 ,ci::cuckoo::make_traits<
614 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
615 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
616 ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
618 ,cds::opt::hash< std::tuple< hash1, hash2 > >
619 ,cds::opt::less< less<item_type> >
620 ,cds::opt::compare< cmp<item_type> >
621 ,ci::opt::disposer< mock_disposer >
625 typename set_type::hash_tuple_type ht;
626 set_type s( 32, 6, 0, std::move( ht ));
630 TEST_F( IntrusiveCuckooSet, striped_vector_memberhook_ordered_storehash )
632 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 2 >> item_type;
634 typedef ci::CuckooSet< item_type
635 ,ci::cuckoo::make_traits<
636 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
637 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
638 ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
640 ,cds::opt::hash< std::tuple< hash1, hash2 > >
641 ,cds::opt::less< less<item_type> >
642 ,cds::opt::compare< cmp<item_type> >
643 ,ci::opt::disposer< mock_disposer >
647 typename set_type::hash_tuple_type ht;
648 set_type s( std::move( ht ));
652 //************************************************************
653 // refinable base hook
655 TEST_F( IntrusiveCuckooSet, refinable_list_basehook_unordered )
657 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 > > item_type;
658 struct set_traits: public ci::cuckoo::traits
660 typedef ci::cuckoo::refinable<> mutex_policy;
661 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
662 typedef base_class::equal_to<item_type> equal_to;
663 typedef mock_disposer disposer;
665 typedef ci::CuckooSet< item_type, set_traits > set_type;
671 TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_unordered )
673 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 0 >> item_type;
674 struct set_traits: public ci::cuckoo::traits
676 typedef ci::cuckoo::refinable<> mutex_policy;
677 typedef ci::cuckoo::base_hook< ci::cuckoo::probeset_type< item_type::probeset_type >> hook;
678 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
679 typedef base_class::equal_to<item_type> equal_to;
680 typedef mock_disposer disposer;
682 typedef ci::CuckooSet< item_type, set_traits > set_type;
688 TEST_F( IntrusiveCuckooSet, refinable_list_basehook_ordered_cmp )
690 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
692 typedef ci::CuckooSet< item_type
693 ,ci::cuckoo::make_traits<
694 ci::opt::hook< ci::cuckoo::base_hook<
695 ci::cuckoo::probeset_type< item_type::probeset_type >
697 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
698 ,ci::opt::hash< std::tuple< hash1, hash2 > >
699 ,ci::opt::compare< cmp<item_type> >
700 ,ci::opt::disposer< mock_disposer >
704 set_type s( 32, 6, 4 );
708 TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_ordered_cmp )
710 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<8>, 0 >> item_type;
712 typedef ci::CuckooSet< item_type
713 ,ci::cuckoo::make_traits<
714 ci::opt::hook< ci::cuckoo::base_hook<
715 ci::cuckoo::probeset_type< item_type::probeset_type >
717 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
718 ,ci::opt::hash< std::tuple< hash1, hash2 > >
719 ,ci::opt::compare< cmp<item_type> >
720 , ci::opt::disposer< mock_disposer >
724 typename set_type::hash_tuple_type ht;
729 TEST_F( IntrusiveCuckooSet, refinable_list_basehook_ordered_less )
731 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
733 typedef ci::CuckooSet< item_type
734 ,ci::cuckoo::make_traits<
735 ci::opt::hook< ci::cuckoo::base_hook<
736 ci::cuckoo::probeset_type< item_type::probeset_type >
738 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
739 ,ci::opt::hash< std::tuple< hash1, hash2 > >
740 ,ci::opt::less< less<item_type> >
741 ,ci::opt::disposer< mock_disposer >
745 typename set_type::hash_tuple_type ht;
746 set_type s( 32, 6, 4, ht );
750 TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_ordered_less )
752 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
754 typedef ci::CuckooSet< item_type
755 ,ci::cuckoo::make_traits<
756 ci::opt::hook< ci::cuckoo::base_hook<
757 ci::cuckoo::probeset_type< item_type::probeset_type >
759 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
760 ,ci::opt::hash< std::tuple< hash1, hash2 > >
761 ,ci::opt::less< less<item_type> >
762 ,ci::opt::disposer< mock_disposer >
766 typename set_type::hash_tuple_type ht;
767 set_type s( std::move( ht ));
771 TEST_F( IntrusiveCuckooSet, refinable_list_basehook_ordered_cmpmix )
773 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
775 typedef ci::CuckooSet< item_type
776 ,ci::cuckoo::make_traits<
777 ci::opt::hook< ci::cuckoo::base_hook<
778 ci::cuckoo::probeset_type< item_type::probeset_type >
780 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
781 ,ci::opt::hash< std::tuple< hash1, hash2 > >
782 ,ci::opt::less< less<item_type> >
783 ,ci::opt::compare< cmp<item_type> >
784 ,ci::opt::disposer< mock_disposer >
788 typename set_type::hash_tuple_type ht;
789 set_type s( 32, 6, 0, std::move( ht ));
793 TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_ordered_cmpmix )
795 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
797 typedef ci::CuckooSet< item_type
798 ,ci::cuckoo::make_traits<
799 ci::opt::hook< ci::cuckoo::base_hook<
800 ci::cuckoo::probeset_type< item_type::probeset_type >
802 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
803 ,ci::opt::hash< std::tuple< hash1, hash2 > >
804 ,ci::opt::less< less<item_type> >
805 ,ci::opt::compare< cmp<item_type> >
806 ,ci::opt::disposer< mock_disposer >
810 typename set_type::hash_tuple_type ht;
811 set_type s( std::move( ht ));
815 TEST_F( IntrusiveCuckooSet, refinable_list_basehook_ordered_stat )
817 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
819 typedef ci::CuckooSet< item_type
820 ,ci::cuckoo::make_traits<
821 ci::opt::hook< ci::cuckoo::base_hook<
822 ci::cuckoo::probeset_type< item_type::probeset_type >
824 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
825 ,ci::opt::hash< std::tuple< hash1, hash2 > >
826 ,ci::opt::less< less<item_type> >
827 ,ci::opt::compare< cmp<item_type> >
828 ,ci::opt::stat< ci::cuckoo::stat >
829 ,ci::opt::disposer< mock_disposer >
837 TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_ordered_stat )
839 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
841 typedef ci::CuckooSet< item_type
842 ,ci::cuckoo::make_traits<
843 ci::opt::hook< ci::cuckoo::base_hook<
844 ci::cuckoo::probeset_type< item_type::probeset_type >
846 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
847 ,ci::opt::hash< std::tuple< hash1, hash2 > >
848 ,ci::opt::less< less<item_type> >
849 ,ci::opt::compare< cmp<item_type> >
850 ,ci::opt::stat< ci::cuckoo::stat >
851 ,ci::opt::disposer< mock_disposer >
859 TEST_F( IntrusiveCuckooSet, refinable_list_basehook_unordered_storehash )
861 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
862 struct set_traits: public ci::cuckoo::traits
864 typedef ci::cuckoo::base_hook<
865 ci::cuckoo::probeset_type< item_type::probeset_type >
866 ,ci::cuckoo::store_hash< item_type::hash_array_size >
868 typedef ci::cuckoo::refinable<> mutex_policy;
869 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
870 typedef base_class::equal_to<item_type> equal_to;
871 typedef mock_disposer disposer;
872 typedef ci::cuckoo::stat stat;
874 typedef ci::CuckooSet< item_type, set_traits > set_type;
880 TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_unordered_storehash )
882 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 2 >> item_type;
883 struct set_traits: public ci::cuckoo::traits
885 typedef ci::cuckoo::base_hook<
886 ci::cuckoo::probeset_type< item_type::probeset_type >
887 ,ci::cuckoo::store_hash< item_type::hash_array_size >
889 typedef ci::cuckoo::refinable<> mutex_policy;
890 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
891 typedef base_class::equal_to<item_type> equal_to;
892 typedef mock_disposer disposer;
893 typedef ci::cuckoo::stat stat;
895 typedef ci::CuckooSet< item_type, set_traits > set_type;
901 TEST_F( IntrusiveCuckooSet, refinable_list_basehook_ordered_storehash )
903 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
905 typedef ci::CuckooSet< item_type
906 ,ci::cuckoo::make_traits<
907 ci::opt::hook< ci::cuckoo::base_hook<
908 ci::cuckoo::probeset_type< item_type::probeset_type >
909 ,ci::cuckoo::store_hash< item_type::hash_array_size >
911 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
912 ,cds::opt::hash< std::tuple< hash1, hash2 > >
913 ,cds::opt::less< less<item_type> >
914 ,cds::opt::compare< cmp<item_type> >
915 ,ci::opt::disposer< mock_disposer >
919 typename set_type::hash_tuple_type ht;
920 set_type s( 32, 6, 0, std::move( ht ));
924 TEST_F( IntrusiveCuckooSet, refinable_vector_basehook_ordered_storehash )
926 typedef base_class::base_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 2 >> item_type;
928 typedef ci::CuckooSet< item_type
929 ,ci::cuckoo::make_traits<
930 ci::opt::hook< ci::cuckoo::base_hook<
931 ci::cuckoo::probeset_type< item_type::probeset_type >
932 ,ci::cuckoo::store_hash< item_type::hash_array_size >
934 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
935 ,cds::opt::hash< std::tuple< hash1, hash2 > >
936 ,cds::opt::less< less<item_type> >
937 ,cds::opt::compare< cmp<item_type> >
938 ,ci::opt::disposer< mock_disposer >
942 typename set_type::hash_tuple_type ht;
943 set_type s( std::move( ht ));
947 //************************************************************
948 // refinable member hook
950 TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_unordered )
952 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 > > item_type;
953 struct set_traits: public ci::cuckoo::traits
955 typedef ci::cuckoo::member_hook< offsetof( item_type, hMember )> hook;
956 typedef ci::cuckoo::refinable<> mutex_policy;
957 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
958 typedef base_class::equal_to<item_type> equal_to;
959 typedef mock_disposer disposer;
961 typedef ci::CuckooSet< item_type, set_traits > set_type;
967 TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_unordered )
969 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 0 >> item_type;
970 struct set_traits: public ci::cuckoo::traits
973 typedef ci::cuckoo::member_hook< offsetof( item_type, hMember ), ci::cuckoo::probeset_type< item_type::member_type::probeset_type >> hook;
974 typedef ci::cuckoo::refinable<> mutex_policy;
975 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
976 typedef base_class::equal_to<item_type> equal_to;
977 typedef mock_disposer disposer;
979 typedef ci::CuckooSet< item_type, set_traits > set_type;
985 TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_ordered_cmp )
987 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
989 typedef ci::CuckooSet< item_type
990 ,ci::cuckoo::make_traits<
991 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
992 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
994 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
995 ,ci::opt::hash< std::tuple< hash1, hash2 > >
996 ,ci::opt::compare< cmp<item_type> >
997 ,ci::opt::disposer< mock_disposer >
1001 set_type s( 32, 6, 4 );
1005 TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_ordered_cmp )
1007 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<8>, 0 >> item_type;
1009 typedef ci::CuckooSet< item_type
1010 ,ci::cuckoo::make_traits<
1011 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
1012 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
1014 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
1015 ,ci::opt::hash< std::tuple< hash1, hash2 > >
1016 ,ci::opt::compare< cmp<item_type> >
1017 ,ci::opt::disposer< mock_disposer >
1021 typename set_type::hash_tuple_type ht;
1026 TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_ordered_less )
1028 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
1030 typedef ci::CuckooSet< item_type
1031 ,ci::cuckoo::make_traits<
1032 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
1033 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
1035 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
1036 ,ci::opt::hash< std::tuple< hash1, hash2 > >
1037 ,ci::opt::less< less<item_type> >
1038 ,ci::opt::disposer< mock_disposer >
1042 typename set_type::hash_tuple_type ht;
1043 set_type s( 32, 6, 4, ht );
1047 TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_ordered_less )
1049 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
1051 typedef ci::CuckooSet< item_type
1052 ,ci::cuckoo::make_traits<
1053 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
1054 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
1056 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
1057 ,ci::opt::hash< std::tuple< hash1, hash2 > >
1058 ,ci::opt::less< less<item_type> >
1059 ,ci::opt::disposer< mock_disposer >
1063 typename set_type::hash_tuple_type ht;
1064 set_type s( std::move( ht ));
1068 TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_ordered_cmpmix )
1070 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
1072 typedef ci::CuckooSet< item_type
1073 ,ci::cuckoo::make_traits<
1074 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
1075 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
1077 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
1078 ,ci::opt::hash< std::tuple< hash1, hash2 > >
1079 ,ci::opt::less< less<item_type> >
1080 ,ci::opt::compare< cmp<item_type> >
1081 ,ci::opt::disposer< mock_disposer >
1085 typename set_type::hash_tuple_type ht;
1086 set_type s( 32, 6, 0, std::move( ht ));
1090 TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_ordered_cmpmix )
1092 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
1094 typedef ci::CuckooSet< item_type
1095 ,ci::cuckoo::make_traits<
1096 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
1097 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
1099 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
1100 ,ci::opt::hash< std::tuple< hash1, hash2 > >
1101 ,ci::opt::less< less<item_type> >
1102 ,ci::opt::compare< cmp<item_type> >
1103 ,ci::opt::disposer< mock_disposer >
1107 typename set_type::hash_tuple_type ht;
1108 set_type s( std::move( ht ));
1112 TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_ordered_stat )
1114 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 0 >> item_type;
1116 typedef ci::CuckooSet< item_type
1117 ,ci::cuckoo::make_traits<
1118 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
1119 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
1121 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
1122 ,ci::opt::hash< std::tuple< hash1, hash2 > >
1123 ,ci::opt::less< less<item_type> >
1124 ,ci::opt::compare< cmp<item_type> >
1125 ,ci::opt::stat< ci::cuckoo::stat >
1126 ,ci::opt::disposer< mock_disposer >
1134 TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_ordered_stat )
1136 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 0 >> item_type;
1138 typedef ci::CuckooSet< item_type
1139 ,ci::cuckoo::make_traits<
1140 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
1141 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
1143 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
1144 ,ci::opt::hash< std::tuple< hash1, hash2 > >
1145 ,ci::opt::less< less<item_type> >
1146 ,ci::opt::compare< cmp<item_type> >
1147 ,ci::opt::stat< ci::cuckoo::stat >
1148 ,ci::opt::disposer< mock_disposer >
1156 TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_unordered_storehash )
1158 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
1159 struct set_traits: public ci::cuckoo::traits
1161 typedef ci::cuckoo::member_hook< offsetof( item_type, hMember ),
1162 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
1163 ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
1165 typedef ci::cuckoo::refinable<> mutex_policy;
1166 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
1167 typedef base_class::equal_to<item_type> equal_to;
1168 typedef mock_disposer disposer;
1169 typedef ci::cuckoo::stat stat;
1171 typedef ci::CuckooSet< item_type, set_traits > set_type;
1177 TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_unordered_storehash )
1179 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<4>, 2 >> item_type;
1180 struct set_traits: public ci::cuckoo::traits
1182 typedef ci::cuckoo::member_hook< offsetof( item_type, hMember ),
1183 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
1184 ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
1186 typedef ci::cuckoo::refinable<> mutex_policy;
1187 typedef cds::opt::hash_tuple< hash1, hash2 > hash;
1188 typedef base_class::equal_to<item_type> equal_to;
1189 typedef mock_disposer disposer;
1190 typedef ci::cuckoo::stat stat;
1192 typedef ci::CuckooSet< item_type, set_traits > set_type;
1194 set_type s( 32, 4 );
1198 TEST_F( IntrusiveCuckooSet, refinable_list_memberhook_ordered_storehash )
1200 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::list, 2 >> item_type;
1202 typedef ci::CuckooSet< item_type
1203 ,ci::cuckoo::make_traits<
1204 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
1205 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
1206 ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
1208 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
1209 ,cds::opt::hash< std::tuple< hash1, hash2 > >
1210 ,cds::opt::less< less<item_type> >
1211 ,cds::opt::compare< cmp<item_type> >
1212 ,ci::opt::disposer< mock_disposer >
1216 typename set_type::hash_tuple_type ht;
1217 set_type s( 32, 6, 0, std::move( ht ));
1221 TEST_F( IntrusiveCuckooSet, refinable_vector_memberhook_ordered_storehash )
1223 typedef base_class::member_int_item< ci::cuckoo::node< ci::cuckoo::vector<6>, 2 >> item_type;
1225 typedef ci::CuckooSet< item_type
1226 ,ci::cuckoo::make_traits<
1227 ci::opt::hook< ci::cuckoo::member_hook< offsetof( item_type, hMember ),
1228 ci::cuckoo::probeset_type< item_type::member_type::probeset_type >
1229 ,ci::cuckoo::store_hash< item_type::member_type::hash_array_size >
1231 ,ci::opt::mutex_policy<ci::cuckoo::refinable<>>
1232 ,cds::opt::hash< std::tuple< hash1, hash2 > >
1233 ,cds::opt::less< less<item_type> >
1234 ,cds::opt::compare< cmp<item_type> >
1235 ,ci::opt::disposer< mock_disposer >
1239 typename set_type::hash_tuple_type ht;
1240 set_type s( std::move( ht ));