3 #include "map/hdr_cuckoo_map.h"
4 #include <cds/container/cuckoo_map.h>
9 typedef CuckooMapHdrTest::hash_int hash1;
10 struct hash2: private hash1
12 typedef hash1 base_class;
14 size_t operator()( int i ) const
16 size_t h = ~( base_class::operator()(i));
17 return ~h + 0x9e3779b9 + (h << 6) + (h >> 2);
22 void CuckooMapHdrTest::Cuckoo_striped_list()
24 CPPUNIT_MESSAGE( "equal");
26 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
27 cc::cuckoo::make_traits<
28 co::equal_to< std::equal_to<int> >
29 ,co::hash< std::tuple< hash1, hash2 > >
36 CPPUNIT_MESSAGE( "equal, store hash");
38 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
39 cc::cuckoo::make_traits<
40 co::mutex_policy< cc::cuckoo::striping<> >
41 ,co::equal_to< std::equal_to< int > >
42 ,cc::cuckoo::store_hash< true >
43 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
44 ,co::hash< std::tuple< hash1, hash2 > >
51 CPPUNIT_MESSAGE( "cmp");
53 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
54 cc::cuckoo::make_traits<
55 co::compare< CuckooMapHdrTest::cmp >
56 ,cc::cuckoo::store_hash< false >
57 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
58 ,co::hash< std::tuple< hash1, hash2 > >
65 CPPUNIT_MESSAGE( "cmp, store hash");
67 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
68 cc::cuckoo::make_traits<
69 co::mutex_policy< cc::cuckoo::striping<> >
70 ,co::compare< CuckooMapHdrTest::cmp >
71 ,cc::cuckoo::store_hash< true >
72 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
73 ,co::hash< std::tuple< hash1, hash2 > >
80 CPPUNIT_MESSAGE( "less");
82 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
83 cc::cuckoo::make_traits<
84 co::less< std::less<int> >
85 ,co::hash< std::tuple< hash1, hash2 > >
86 ,co::mutex_policy< cc::cuckoo::striping<> >
87 ,cc::cuckoo::store_hash< false >
88 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
95 CPPUNIT_MESSAGE( "less, store hash");
97 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
98 cc::cuckoo::make_traits<
99 co::mutex_policy< cc::cuckoo::striping<> >
100 ,co::less< std::less<int> >
101 ,cc::cuckoo::store_hash< true >
102 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
103 ,co::hash< std::tuple< hash1, hash2 > >
107 test_cuckoo<map_t>();
110 CPPUNIT_MESSAGE( "less+cmp");
112 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
113 cc::cuckoo::make_traits<
114 co::less< std::less<int> >
115 ,co::compare< CuckooMapHdrTest::cmp >
116 ,co::hash< std::tuple< hash1, hash2 > >
117 ,co::mutex_policy< cc::cuckoo::striping<> >
118 ,cc::cuckoo::store_hash< false >
119 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
123 test_cuckoo<map_t>();
126 CPPUNIT_MESSAGE( "less+cmp, store hash");
128 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
129 cc::cuckoo::make_traits<
130 co::mutex_policy< cc::cuckoo::striping<> >
131 ,co::less< std::less<int> >
132 ,co::hash< std::tuple< hash1, hash2 > >
133 ,co::compare< CuckooMapHdrTest::cmp >
134 ,cc::cuckoo::store_hash< true >
135 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
139 test_cuckoo<map_t>();
142 CPPUNIT_MESSAGE( "less+cmp+equal");
144 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
145 cc::cuckoo::make_traits<
146 co::less< std::less<int> >
147 ,co::compare< CuckooMapHdrTest::cmp >
148 ,co::equal_to< std::equal_to<int> >
149 ,co::hash< std::tuple< hash1, hash2 > >
150 ,co::mutex_policy< cc::cuckoo::striping<> >
151 ,cc::cuckoo::store_hash< false >
152 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
156 test_cuckoo<map_t>();
159 CPPUNIT_MESSAGE( "less+cmp+equal, store hash");
161 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
162 cc::cuckoo::make_traits<
163 co::mutex_policy< cc::cuckoo::striping<> >
164 ,co::less< std::less<int> >
165 ,co::compare< CuckooMapHdrTest::cmp >
166 ,co::equal_to< std::equal_to< int > >
167 ,cc::cuckoo::store_hash< true >
168 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
169 ,co::hash< std::tuple< hash1, hash2 > >
173 test_cuckoo<map_t>();
179 void CuckooMapHdrTest::Cuckoo_striped_vector()
181 CPPUNIT_MESSAGE( "equal");
183 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
184 cc::cuckoo::make_traits<
185 co::equal_to< std::equal_to<int> >
186 ,co::hash< std::tuple< hash1, hash2 > >
187 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
191 test_cuckoo<map_t>();
194 CPPUNIT_MESSAGE( "equal, store hash");
196 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
197 cc::cuckoo::make_traits<
198 co::mutex_policy< cc::cuckoo::striping<> >
199 ,co::equal_to< std::equal_to< int > >
200 ,cc::cuckoo::store_hash< true >
201 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
202 ,co::hash< std::tuple< hash1, hash2 > >
206 test_cuckoo<map_t>();
209 CPPUNIT_MESSAGE( "cmp");
211 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
212 cc::cuckoo::make_traits<
213 co::compare< CuckooMapHdrTest::cmp >
214 ,cc::cuckoo::store_hash< false >
215 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
216 ,co::hash< std::tuple< hash1, hash2 > >
220 test_cuckoo<map_t>();
223 CPPUNIT_MESSAGE( "cmp, store hash");
225 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
226 cc::cuckoo::make_traits<
227 co::mutex_policy< cc::cuckoo::striping<> >
228 ,co::compare< CuckooMapHdrTest::cmp >
229 ,cc::cuckoo::store_hash< true >
230 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
231 ,co::hash< std::tuple< hash1, hash2 > >
235 test_cuckoo<map_t>();
238 CPPUNIT_MESSAGE( "less");
240 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
241 cc::cuckoo::make_traits<
242 co::less< std::less<int> >
243 ,co::hash< std::tuple< hash1, hash2 > >
244 ,co::mutex_policy< cc::cuckoo::striping<> >
245 ,cc::cuckoo::store_hash< false >
246 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
250 test_cuckoo<map_t>();
253 CPPUNIT_MESSAGE( "less, store hash");
255 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
256 cc::cuckoo::make_traits<
257 co::mutex_policy< cc::cuckoo::striping<> >
258 ,co::less< std::less<int> >
259 ,cc::cuckoo::store_hash< true >
260 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
261 ,co::hash< std::tuple< hash1, hash2 > >
265 test_cuckoo<map_t>();
268 CPPUNIT_MESSAGE( "less+cmp");
270 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
271 cc::cuckoo::make_traits<
272 co::less< std::less<int> >
273 ,co::compare< CuckooMapHdrTest::cmp >
274 ,co::hash< std::tuple< hash1, hash2 > >
275 ,co::mutex_policy< cc::cuckoo::striping<> >
276 ,cc::cuckoo::store_hash< false >
277 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
281 test_cuckoo<map_t>();
284 CPPUNIT_MESSAGE( "less+cmp, store hash");
286 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
287 cc::cuckoo::make_traits<
288 co::mutex_policy< cc::cuckoo::striping<> >
289 ,co::less< std::less<int> >
290 ,co::hash< std::tuple< hash1, hash2 > >
291 ,co::compare< CuckooMapHdrTest::cmp >
292 ,cc::cuckoo::store_hash< true >
293 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
297 test_cuckoo<map_t>();
300 CPPUNIT_MESSAGE( "less+cmp+equal");
302 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
303 cc::cuckoo::make_traits<
304 co::less< std::less<int> >
305 ,co::compare< CuckooMapHdrTest::cmp >
306 ,co::equal_to< std::equal_to<int> >
307 ,co::hash< std::tuple< hash1, hash2 > >
308 ,co::mutex_policy< cc::cuckoo::striping<> >
309 ,cc::cuckoo::store_hash< false >
310 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
314 test_cuckoo<map_t>();
317 CPPUNIT_MESSAGE( "less+cmp+equal, store hash");
319 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
320 cc::cuckoo::make_traits<
321 co::mutex_policy< cc::cuckoo::striping<> >
322 ,co::less< std::less<int> >
323 ,co::compare< CuckooMapHdrTest::cmp >
324 ,co::equal_to< std::equal_to< int > >
325 ,cc::cuckoo::store_hash< true >
326 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
327 ,co::hash< std::tuple< hash1, hash2 > >
331 test_cuckoo<map_t>();
336 void CuckooMapHdrTest::Cuckoo_refinable_list()
338 CPPUNIT_MESSAGE( "equal");
340 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
341 cc::cuckoo::make_traits<
342 co::equal_to< std::equal_to<int> >
343 ,co::hash< std::tuple< hash1, hash2 > >
344 ,co::mutex_policy< cc::cuckoo::refinable<> >
348 test_cuckoo<map_t>();
351 CPPUNIT_MESSAGE( "equal, store hash");
353 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
354 cc::cuckoo::make_traits<
355 co::mutex_policy< cc::cuckoo::refinable<> >
356 ,co::equal_to< std::equal_to< int > >
357 ,cc::cuckoo::store_hash< true >
358 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
359 ,co::hash< std::tuple< hash1, hash2 > >
363 test_cuckoo<map_t>();
366 CPPUNIT_MESSAGE( "cmp");
368 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
369 cc::cuckoo::make_traits<
370 co::compare< CuckooMapHdrTest::cmp >
371 ,cc::cuckoo::store_hash< false >
372 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
373 ,co::hash< std::tuple< hash1, hash2 > >
374 ,co::mutex_policy< cc::cuckoo::refinable<> >
378 test_cuckoo<map_t>();
381 CPPUNIT_MESSAGE( "cmp, store hash");
383 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
384 cc::cuckoo::make_traits<
385 co::mutex_policy< cc::cuckoo::refinable<> >
386 ,co::compare< CuckooMapHdrTest::cmp >
387 ,cc::cuckoo::store_hash< true >
388 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
389 ,co::hash< std::tuple< hash1, hash2 > >
393 test_cuckoo<map_t>();
396 CPPUNIT_MESSAGE( "less");
398 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
399 cc::cuckoo::make_traits<
400 co::less< std::less<int> >
401 ,co::hash< std::tuple< hash1, hash2 > >
402 ,co::mutex_policy< cc::cuckoo::refinable<> >
403 ,cc::cuckoo::store_hash< false >
404 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
408 test_cuckoo<map_t>();
411 CPPUNIT_MESSAGE( "less, store hash");
413 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
414 cc::cuckoo::make_traits<
415 co::mutex_policy< cc::cuckoo::refinable<> >
416 ,co::less< std::less<int> >
417 ,cc::cuckoo::store_hash< true >
418 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
419 ,co::hash< std::tuple< hash1, hash2 > >
423 test_cuckoo<map_t>();
426 CPPUNIT_MESSAGE( "less+cmp");
428 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
429 cc::cuckoo::make_traits<
430 co::less< std::less<int> >
431 ,co::compare< CuckooMapHdrTest::cmp >
432 ,co::hash< std::tuple< hash1, hash2 > >
433 ,co::mutex_policy< cc::cuckoo::refinable<> >
434 ,cc::cuckoo::store_hash< false >
435 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
439 test_cuckoo<map_t>();
442 CPPUNIT_MESSAGE( "less+cmp, store hash");
444 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
445 cc::cuckoo::make_traits<
446 co::mutex_policy< cc::cuckoo::refinable<> >
447 ,co::less< std::less<int> >
448 ,co::hash< std::tuple< hash1, hash2 > >
449 ,co::compare< CuckooMapHdrTest::cmp >
450 ,cc::cuckoo::store_hash< true >
451 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
455 test_cuckoo<map_t>();
458 CPPUNIT_MESSAGE( "less+cmp+equal");
460 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
461 cc::cuckoo::make_traits<
462 co::less< std::less<int> >
463 ,co::compare< CuckooMapHdrTest::cmp >
464 ,co::equal_to< std::equal_to<int> >
465 ,co::hash< std::tuple< hash1, hash2 > >
466 ,co::mutex_policy< cc::cuckoo::refinable<> >
467 ,cc::cuckoo::store_hash< false >
468 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
472 test_cuckoo<map_t>();
475 CPPUNIT_MESSAGE( "less+cmp+equal, store hash");
477 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
478 cc::cuckoo::make_traits<
479 co::mutex_policy< cc::cuckoo::refinable<> >
480 ,co::less< std::less<int> >
481 ,co::compare< CuckooMapHdrTest::cmp >
482 ,co::equal_to< std::equal_to< int > >
483 ,cc::cuckoo::store_hash< true >
484 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
485 ,co::hash< std::tuple< hash1, hash2 > >
489 test_cuckoo<map_t>();
495 void CuckooMapHdrTest::Cuckoo_refinable_vector()
497 CPPUNIT_MESSAGE( "equal");
499 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
500 cc::cuckoo::make_traits<
501 co::equal_to< std::equal_to<int> >
502 ,co::hash< std::tuple< hash1, hash2 > >
503 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
504 ,co::mutex_policy< cc::cuckoo::refinable<> >
508 test_cuckoo<map_t>();
511 CPPUNIT_MESSAGE( "equal, store hash");
513 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
514 cc::cuckoo::make_traits<
515 co::mutex_policy< cc::cuckoo::refinable<> >
516 ,co::equal_to< std::equal_to< int > >
517 ,cc::cuckoo::store_hash< true >
518 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
519 ,co::hash< std::tuple< hash1, hash2 > >
523 test_cuckoo<map_t>();
526 CPPUNIT_MESSAGE( "cmp");
528 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
529 cc::cuckoo::make_traits<
530 co::compare< CuckooMapHdrTest::cmp >
531 ,cc::cuckoo::store_hash< false >
532 ,co::mutex_policy< cc::cuckoo::refinable<> >
533 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
534 ,co::hash< std::tuple< hash1, hash2 > >
538 test_cuckoo<map_t>();
541 CPPUNIT_MESSAGE( "cmp, store hash");
543 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
544 cc::cuckoo::make_traits<
545 co::mutex_policy< cc::cuckoo::refinable<> >
546 ,co::compare< CuckooMapHdrTest::cmp >
547 ,cc::cuckoo::store_hash< true >
548 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
549 ,co::hash< std::tuple< hash1, hash2 > >
553 test_cuckoo<map_t>();
556 CPPUNIT_MESSAGE( "less");
558 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
559 cc::cuckoo::make_traits<
560 co::less< std::less<int> >
561 ,co::hash< std::tuple< hash1, hash2 > >
562 ,cc::cuckoo::store_hash< false >
563 ,co::mutex_policy< cc::cuckoo::refinable<> >
564 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
568 test_cuckoo<map_t>();
571 CPPUNIT_MESSAGE( "less, store hash");
573 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
574 cc::cuckoo::make_traits<
575 co::mutex_policy< cc::cuckoo::refinable<> >
576 ,co::less< std::less<int> >
577 ,cc::cuckoo::store_hash< true >
578 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
579 ,co::hash< std::tuple< hash1, hash2 > >
583 test_cuckoo<map_t>();
586 CPPUNIT_MESSAGE( "less+cmp");
588 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
589 cc::cuckoo::make_traits<
590 co::less< std::less<int> >
591 ,co::compare< CuckooMapHdrTest::cmp >
592 ,co::hash< std::tuple< hash1, hash2 > >
593 ,co::mutex_policy< cc::cuckoo::refinable<> >
594 ,cc::cuckoo::store_hash< false >
595 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
599 test_cuckoo<map_t>();
602 CPPUNIT_MESSAGE( "less+cmp, store hash");
604 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
605 cc::cuckoo::make_traits<
606 co::mutex_policy< cc::cuckoo::refinable<> >
607 ,co::less< std::less<int> >
608 ,co::hash< std::tuple< hash1, hash2 > >
609 ,co::compare< CuckooMapHdrTest::cmp >
610 ,cc::cuckoo::store_hash< true >
611 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
615 test_cuckoo<map_t>();
618 CPPUNIT_MESSAGE( "less+cmp+equal");
620 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
621 cc::cuckoo::make_traits<
622 co::less< std::less<int> >
623 ,co::compare< CuckooMapHdrTest::cmp >
624 ,co::equal_to< std::equal_to<int> >
625 ,co::hash< std::tuple< hash1, hash2 > >
626 ,co::mutex_policy< cc::cuckoo::refinable<> >
627 ,cc::cuckoo::store_hash< false >
628 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
632 test_cuckoo<map_t>();
635 CPPUNIT_MESSAGE( "less+cmp+equal, store hash");
637 typedef cc::CuckooMap< CuckooMapHdrTest::key_type, CuckooMapHdrTest::value_type,
638 cc::cuckoo::make_traits<
639 co::mutex_policy< cc::cuckoo::refinable<> >
640 ,co::less< std::less<int> >
641 ,co::compare< CuckooMapHdrTest::cmp >
642 ,co::equal_to< std::equal_to< int > >
643 ,cc::cuckoo::store_hash< true >
644 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
645 ,co::hash< std::tuple< hash1, hash2 > >
649 test_cuckoo<map_t>();
655 CPPUNIT_TEST_SUITE_REGISTRATION(map::CuckooMapHdrTest);