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 "set/hdr_cuckoo_set.h"
32 #include <cds/container/cuckoo_set.h>
36 void CuckooSetHdrTest::Cuckoo_Striped_list_unord()
38 struct set_traits : public cc::cuckoo::traits {
39 typedef equal<item> equal_to;
40 typedef co::hash_tuple< hash1, hash2 > hash;
43 typedef cc::CuckooSet< item, set_traits > set_t;
45 test_int<set_t, equal< item > >();
48 void CuckooSetHdrTest::Cuckoo_Striped_list_unord_storehash()
50 typedef cc::CuckooSet< item,
51 cc::cuckoo::make_traits<
52 co::mutex_policy< cc::cuckoo::striping<> >
53 ,co::equal_to< equal< item > >
54 ,cc::cuckoo::store_hash< true >
55 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
56 ,co::hash< std::tuple< hash1, hash2 > >
60 test_int<set_t, equal< item > >();
63 void CuckooSetHdrTest::Cuckoo_Striped_list_cmp()
65 typedef cc::CuckooSet< item,
66 cc::cuckoo::make_traits<
67 co::compare< cmp< item > >
68 ,cc::cuckoo::store_hash< false >
69 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
70 ,co::hash< std::tuple< hash1, hash2 > >
74 test_int<set_t, less< item > >();
77 void CuckooSetHdrTest::Cuckoo_Striped_list_cmp_storehash()
79 typedef cc::CuckooSet< item,
80 cc::cuckoo::make_traits<
81 co::mutex_policy< cc::cuckoo::striping<> >
82 ,co::compare< cmp< item > >
83 ,cc::cuckoo::store_hash< true >
84 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
85 ,co::hash< std::tuple< hash1, hash2 > >
89 test_int<set_t, less< item > >();
92 void CuckooSetHdrTest::Cuckoo_Striped_list_less()
94 typedef cc::CuckooSet< item,
95 cc::cuckoo::make_traits<
96 co::less< less< item > >
97 ,co::hash< std::tuple< hash1, hash2 > >
98 ,co::mutex_policy< cc::cuckoo::striping<> >
99 ,cc::cuckoo::store_hash< false >
100 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
104 test_int<set_t, less< item > >();
107 void CuckooSetHdrTest::Cuckoo_Striped_list_less_storehash()
109 typedef cc::CuckooSet< item,
110 cc::cuckoo::make_traits<
111 co::mutex_policy< cc::cuckoo::striping<> >
112 ,co::less< less< item > >
113 ,cc::cuckoo::store_hash< true >
114 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
115 ,co::hash< std::tuple< hash1, hash2 > >
119 test_int<set_t, less< item > >();
122 void CuckooSetHdrTest::Cuckoo_Striped_list_less_cmp()
124 typedef cc::CuckooSet< item,
125 cc::cuckoo::make_traits<
126 co::less< less< item > >
127 ,co::compare< cmp< item > >
128 ,co::hash< std::tuple< hash1, hash2 > >
129 ,co::mutex_policy< cc::cuckoo::striping<> >
130 ,cc::cuckoo::store_hash< false >
131 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
135 test_int<set_t, less< item > >();
138 void CuckooSetHdrTest::Cuckoo_Striped_list_less_cmp_storehash()
140 typedef cc::CuckooSet< item,
141 cc::cuckoo::make_traits<
142 co::mutex_policy< cc::cuckoo::striping<> >
143 ,co::less< less< item > >
144 ,co::hash< std::tuple< hash1, hash2 > >
145 ,co::compare< cmp< item > >
146 ,cc::cuckoo::store_hash< true >
147 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
151 test_int<set_t, less<item> >();
154 void CuckooSetHdrTest::Cuckoo_Striped_list_less_cmp_eq()
156 typedef cc::CuckooSet< item,
157 cc::cuckoo::make_traits<
158 co::less< less< item > >
159 ,co::compare< cmp< item > >
160 ,co::equal_to< equal< item > >
161 ,co::hash< std::tuple< hash1, hash2 > >
162 ,co::mutex_policy< cc::cuckoo::striping<> >
163 ,cc::cuckoo::store_hash< false >
164 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
168 test_int<set_t, less<item> >();
171 void CuckooSetHdrTest::Cuckoo_Striped_list_less_cmp_eq_storehash()
173 typedef cc::CuckooSet< item,
174 cc::cuckoo::make_traits<
175 co::mutex_policy< cc::cuckoo::striping<> >
176 ,co::less< less< item > >
177 ,co::compare< cmp< item > >
178 ,co::equal_to< equal< item > >
179 ,cc::cuckoo::store_hash< true >
180 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
181 ,co::hash< std::tuple< hash1, hash2 > >
185 test_int<set_t, less<item> >();
190 void CuckooSetHdrTest::Cuckoo_Striped_vector_unord()
192 typedef cc::CuckooSet< item,
193 cc::cuckoo::make_traits<
194 co::equal_to< equal< item > >
195 ,co::hash< std::tuple< hash1, hash2 > >
196 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
200 test_int<set_t, equal< item > >();
203 void CuckooSetHdrTest::Cuckoo_Striped_vector_unord_storehash()
205 typedef cc::CuckooSet< item,
206 cc::cuckoo::make_traits<
207 co::mutex_policy< cc::cuckoo::striping<> >
208 ,co::equal_to< equal< item > >
209 ,cc::cuckoo::store_hash< true >
210 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
211 ,co::hash< std::tuple< hash1, hash2 > >
215 test_int<set_t, equal< item > >();
218 void CuckooSetHdrTest::Cuckoo_Striped_vector_cmp()
220 typedef cc::CuckooSet< item,
221 cc::cuckoo::make_traits<
222 co::compare< cmp< item > >
223 ,cc::cuckoo::store_hash< false >
224 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
225 ,co::hash< std::tuple< hash1, hash2 > >
229 test_int<set_t, less< item > >();
232 void CuckooSetHdrTest::Cuckoo_Striped_vector_cmp_storehash()
234 typedef cc::CuckooSet< item,
235 cc::cuckoo::make_traits<
236 co::mutex_policy< cc::cuckoo::striping<> >
237 ,co::compare< cmp< item > >
238 ,cc::cuckoo::store_hash< true >
239 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
240 ,co::hash< std::tuple< hash1, hash2 > >
244 test_int<set_t, less< item > >();
247 void CuckooSetHdrTest::Cuckoo_Striped_vector_less()
249 typedef cc::CuckooSet< item,
250 cc::cuckoo::make_traits<
251 co::less< less< item > >
252 ,co::hash< std::tuple< hash1, hash2 > >
253 ,co::mutex_policy< cc::cuckoo::striping<> >
254 ,cc::cuckoo::store_hash< false >
255 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
259 test_int<set_t, less< item > >();
262 void CuckooSetHdrTest::Cuckoo_Striped_vector_less_storehash()
264 typedef cc::CuckooSet< item,
265 cc::cuckoo::make_traits<
266 co::mutex_policy< cc::cuckoo::striping<> >
267 ,co::less< less< item > >
268 ,cc::cuckoo::store_hash< true >
269 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
270 ,co::hash< std::tuple< hash1, hash2 > >
274 test_int<set_t, less< item > >();
277 void CuckooSetHdrTest::Cuckoo_Striped_vector_less_cmp()
279 typedef cc::CuckooSet< item,
280 cc::cuckoo::make_traits<
281 co::less< less< item > >
282 ,co::compare< cmp< item > >
283 ,co::hash< std::tuple< hash1, hash2 > >
284 ,co::mutex_policy< cc::cuckoo::striping<> >
285 ,cc::cuckoo::store_hash< false >
286 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
290 test_int<set_t, less< item > >();
293 void CuckooSetHdrTest::Cuckoo_Striped_vector_less_cmp_storehash()
295 typedef cc::CuckooSet< item,
296 cc::cuckoo::make_traits<
297 co::mutex_policy< cc::cuckoo::striping<> >
298 ,co::less< less< item > >
299 ,co::hash< std::tuple< hash1, hash2 > >
300 ,co::compare< cmp< item > >
301 ,cc::cuckoo::store_hash< true >
302 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
306 test_int<set_t, less<item> >();
309 void CuckooSetHdrTest::Cuckoo_Striped_vector_less_cmp_eq()
311 typedef cc::CuckooSet< item,
312 cc::cuckoo::make_traits<
313 co::less< less< item > >
314 ,co::compare< cmp< item > >
315 ,co::equal_to< equal< item > >
316 ,co::hash< std::tuple< hash1, hash2 > >
317 ,co::mutex_policy< cc::cuckoo::striping<> >
318 ,cc::cuckoo::store_hash< false >
319 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
323 test_int<set_t, less<item> >();
326 void CuckooSetHdrTest::Cuckoo_Striped_vector_less_cmp_eq_storehash()
328 typedef cc::CuckooSet< item,
329 cc::cuckoo::make_traits<
330 co::mutex_policy< cc::cuckoo::striping<> >
331 ,co::less< less< item > >
332 ,co::compare< cmp< item > >
333 ,co::equal_to< equal< item > >
334 ,cc::cuckoo::store_hash< true >
335 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
336 ,co::hash< std::tuple< hash1, hash2 > >
340 test_int<set_t, less<item> >();
344 void CuckooSetHdrTest::Cuckoo_Refinable_list_unord()
346 typedef cc::CuckooSet< item,
347 cc::cuckoo::make_traits<
348 co::equal_to< equal< item > >
349 ,co::hash< std::tuple< hash1, hash2 > >
350 ,co::mutex_policy< cc::cuckoo::refinable<> >
354 test_int<set_t, equal< item > >();
357 void CuckooSetHdrTest::Cuckoo_Refinable_list_unord_storehash()
359 typedef cc::CuckooSet< item,
360 cc::cuckoo::make_traits<
361 co::mutex_policy< cc::cuckoo::refinable<> >
362 ,co::equal_to< equal< item > >
363 ,cc::cuckoo::store_hash< true >
364 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
365 ,co::hash< std::tuple< hash1, hash2 > >
369 test_int<set_t, equal< item > >();
372 void CuckooSetHdrTest::Cuckoo_Refinable_list_cmp()
374 typedef cc::CuckooSet< item,
375 cc::cuckoo::make_traits<
376 co::compare< cmp< item > >
377 ,cc::cuckoo::store_hash< false >
378 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
379 ,co::hash< std::tuple< hash1, hash2 > >
380 ,co::mutex_policy< cc::cuckoo::refinable<> >
384 test_int<set_t, less< item > >();
387 void CuckooSetHdrTest::Cuckoo_Refinable_list_cmp_storehash()
389 typedef cc::CuckooSet< item,
390 cc::cuckoo::make_traits<
391 co::mutex_policy< cc::cuckoo::refinable<> >
392 ,co::compare< cmp< item > >
393 ,cc::cuckoo::store_hash< true >
394 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
395 ,co::hash< std::tuple< hash1, hash2 > >
399 test_int<set_t, less< item > >();
402 void CuckooSetHdrTest::Cuckoo_Refinable_list_less()
404 typedef cc::CuckooSet< item,
405 cc::cuckoo::make_traits<
406 co::less< less< item > >
407 ,co::hash< std::tuple< hash1, hash2 > >
408 ,co::mutex_policy< cc::cuckoo::refinable<> >
409 ,cc::cuckoo::store_hash< false >
410 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
414 test_int<set_t, less< item > >();
417 void CuckooSetHdrTest::Cuckoo_Refinable_list_less_storehash()
419 typedef cc::CuckooSet< item,
420 cc::cuckoo::make_traits<
421 co::mutex_policy< cc::cuckoo::refinable<> >
422 ,co::less< less< item > >
423 ,cc::cuckoo::store_hash< true >
424 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
425 ,co::hash< std::tuple< hash1, hash2 > >
429 test_int<set_t, less< item > >();
432 void CuckooSetHdrTest::Cuckoo_Refinable_list_less_cmp()
434 typedef cc::CuckooSet< item,
435 cc::cuckoo::make_traits<
436 co::less< less< item > >
437 ,co::compare< cmp< item > >
438 ,co::hash< std::tuple< hash1, hash2 > >
439 ,co::mutex_policy< cc::cuckoo::refinable<> >
440 ,cc::cuckoo::store_hash< false >
441 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
445 test_int<set_t, less< item > >();
448 void CuckooSetHdrTest::Cuckoo_Refinable_list_less_cmp_storehash()
450 typedef cc::CuckooSet< item,
451 cc::cuckoo::make_traits<
452 co::mutex_policy< cc::cuckoo::refinable<> >
453 ,co::less< less< item > >
454 ,co::hash< std::tuple< hash1, hash2 > >
455 ,co::compare< cmp< item > >
456 ,cc::cuckoo::store_hash< true >
457 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
461 test_int<set_t, less<item> >();
464 void CuckooSetHdrTest::Cuckoo_Refinable_list_less_cmp_eq()
466 typedef cc::CuckooSet< item,
467 cc::cuckoo::make_traits<
468 co::less< less< item > >
469 ,co::compare< cmp< item > >
470 ,co::equal_to< equal< item > >
471 ,co::hash< std::tuple< hash1, hash2 > >
472 ,co::mutex_policy< cc::cuckoo::refinable<> >
473 ,cc::cuckoo::store_hash< false >
474 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
478 test_int<set_t, less<item> >();
481 void CuckooSetHdrTest::Cuckoo_Refinable_list_less_cmp_eq_storehash()
483 typedef cc::CuckooSet< item,
484 cc::cuckoo::make_traits<
485 co::mutex_policy< cc::cuckoo::refinable<> >
486 ,co::less< less< item > >
487 ,co::compare< cmp< item > >
488 ,co::equal_to< equal< item > >
489 ,cc::cuckoo::store_hash< true >
490 ,cc::cuckoo::probeset_type< cc::cuckoo::list >
491 ,co::hash< std::tuple< hash1, hash2 > >
495 test_int<set_t, less<item> >();
501 void CuckooSetHdrTest::Cuckoo_Refinable_vector_unord()
503 typedef cc::CuckooSet< item,
504 cc::cuckoo::make_traits<
505 co::equal_to< equal< item > >
506 ,co::hash< std::tuple< hash1, hash2 > >
507 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
508 ,co::mutex_policy< cc::cuckoo::refinable<> >
512 test_int<set_t, equal< item > >();
515 void CuckooSetHdrTest::Cuckoo_Refinable_vector_unord_storehash()
517 typedef cc::CuckooSet< item,
518 cc::cuckoo::make_traits<
519 co::mutex_policy< cc::cuckoo::refinable<> >
520 ,co::equal_to< equal< item > >
521 ,cc::cuckoo::store_hash< true >
522 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
523 ,co::hash< std::tuple< hash1, hash2 > >
527 test_int<set_t, equal< item > >();
530 void CuckooSetHdrTest::Cuckoo_Refinable_vector_cmp()
532 typedef cc::CuckooSet< item,
533 cc::cuckoo::make_traits<
534 co::compare< cmp< item > >
535 ,cc::cuckoo::store_hash< false >
536 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
537 ,co::hash< std::tuple< hash1, hash2 > >
538 ,co::mutex_policy< cc::cuckoo::refinable<> >
542 test_int<set_t, less< item > >();
545 void CuckooSetHdrTest::Cuckoo_Refinable_vector_cmp_storehash()
547 typedef cc::CuckooSet< item,
548 cc::cuckoo::make_traits<
549 co::mutex_policy< cc::cuckoo::refinable<> >
550 ,co::compare< cmp< item > >
551 ,cc::cuckoo::store_hash< true >
552 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
553 ,co::hash< std::tuple< hash1, hash2 > >
557 test_int<set_t, less< item > >();
560 void CuckooSetHdrTest::Cuckoo_Refinable_vector_less()
562 typedef cc::CuckooSet< item,
563 cc::cuckoo::make_traits<
564 co::less< less< item > >
565 ,co::hash< std::tuple< hash1, hash2 > >
566 ,co::mutex_policy< cc::cuckoo::refinable<> >
567 ,cc::cuckoo::store_hash< false >
568 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
572 test_int<set_t, less< item > >();
575 void CuckooSetHdrTest::Cuckoo_Refinable_vector_less_storehash()
577 typedef cc::CuckooSet< item,
578 cc::cuckoo::make_traits<
579 co::mutex_policy< cc::cuckoo::refinable<> >
580 ,co::less< less< item > >
581 ,cc::cuckoo::store_hash< true >
582 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
583 ,co::hash< std::tuple< hash1, hash2 > >
587 test_int<set_t, less< item > >();
590 void CuckooSetHdrTest::Cuckoo_Refinable_vector_less_cmp()
592 typedef cc::CuckooSet< item,
593 cc::cuckoo::make_traits<
594 co::less< less< item > >
595 ,co::compare< cmp< item > >
596 ,co::hash< std::tuple< hash1, hash2 > >
597 ,co::mutex_policy< cc::cuckoo::refinable<> >
598 ,cc::cuckoo::store_hash< false >
599 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
603 test_int<set_t, less< item > >();
606 void CuckooSetHdrTest::Cuckoo_Refinable_vector_less_cmp_storehash()
608 typedef cc::CuckooSet< item,
609 cc::cuckoo::make_traits<
610 co::mutex_policy< cc::cuckoo::refinable<> >
611 ,co::less< less< item > >
612 ,co::hash< std::tuple< hash1, hash2 > >
613 ,co::compare< cmp< item > >
614 ,cc::cuckoo::store_hash< true >
615 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
619 test_int<set_t, less<item> >();
622 void CuckooSetHdrTest::Cuckoo_Refinable_vector_less_cmp_eq()
624 typedef cc::CuckooSet< item,
625 cc::cuckoo::make_traits<
626 co::less< less< item > >
627 ,co::compare< cmp< item > >
628 ,co::equal_to< equal< item > >
629 ,co::hash< std::tuple< hash1, hash2 > >
630 ,co::mutex_policy< cc::cuckoo::refinable<> >
631 ,cc::cuckoo::store_hash< false >
632 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
636 test_int<set_t, less<item> >();
639 void CuckooSetHdrTest::Cuckoo_Refinable_vector_less_cmp_eq_storehash()
641 typedef cc::CuckooSet< item,
642 cc::cuckoo::make_traits<
643 co::mutex_policy< cc::cuckoo::refinable<> >
644 ,co::less< less< item > >
645 ,co::compare< cmp< item > >
646 ,co::equal_to< equal< item > >
647 ,cc::cuckoo::store_hash< true >
648 ,cc::cuckoo::probeset_type< cc::cuckoo::vector<4> >
649 ,co::hash< std::tuple< hash1, hash2 > >
653 test_int<set_t, less<item> >();
658 CPPUNIT_TEST_SUITE_REGISTRATION(set::CuckooSetHdrTest);