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 "map/hdr_map.h"
32 #include <cds/container/lazy_list_nogc.h>
33 #include <cds/container/split_list_map_nogc.h>
38 struct nogc_cmp_traits: public cc::split_list::traits
40 typedef cc::lazy_list_tag ordered_list;
41 typedef HashMapHdrTest::hash_int hash;
42 typedef HashMapHdrTest::simple_item_counter item_counter;
43 typedef cc::opt::v::relaxed_ordering memory_model;
44 enum { dynamic_bucket_table = false };
46 struct ordered_list_traits: public cc::lazy_list::traits
48 typedef HashMapHdrTest::cmp compare;
52 struct nogc_less_traits: public cc::split_list::traits
54 typedef cc::lazy_list_tag ordered_list;
55 typedef HashMapHdrTest::hash_int hash;
56 typedef HashMapHdrTest::simple_item_counter item_counter;
57 typedef cc::opt::v::sequential_consistent memory_model;
58 enum { dynamic_bucket_table = false };
60 struct ordered_list_traits: public cc::lazy_list::traits
62 typedef HashMapHdrTest::less less;
66 struct nogc_cmpmix_traits: public cc::split_list::traits
68 typedef cc::lazy_list_tag ordered_list;
69 typedef HashMapHdrTest::hash_int hash;
70 typedef HashMapHdrTest::simple_item_counter item_counter;
72 struct ordered_list_traits: public cc::lazy_list::traits
74 typedef HashMapHdrTest::cmp compare;
75 typedef std::less<HashMapHdrTest::key_type> less;
79 struct nogc_cmpmix_stat_traits : public nogc_cmpmix_traits
81 typedef cc::split_list::stat<> stat;
85 void HashMapHdrTest::Split_Lazy_nogc_cmp()
87 // traits-based version
88 typedef cc::SplitListMap< cds::gc::nogc, key_type, value_type, nogc_cmp_traits > map_type;
89 test_int_nogc< map_type >();
91 // option-based version
92 typedef cc::SplitListMap< cds::gc::nogc,
95 cc::split_list::make_traits<
96 cc::split_list::ordered_list<cc::lazy_list_tag>
97 ,cc::opt::hash< hash_int >
98 ,cc::opt::item_counter< simple_item_counter >
99 ,cc::opt::memory_model< cc::opt::v::relaxed_ordering >
100 ,cc::split_list::dynamic_bucket_table< true >
101 ,cc::split_list::ordered_list_traits<
102 cc::lazy_list::make_traits<
103 cc::opt::compare< cmp >
108 test_int_nogc< opt_map >();
111 void HashMapHdrTest::Split_Lazy_nogc_less()
113 // traits-based version
114 typedef cc::SplitListMap< cds::gc::nogc, key_type, value_type, nogc_less_traits > map_type;
115 test_int_nogc< map_type >();
117 // option-based version
118 typedef cc::SplitListMap< cds::gc::nogc,
121 cc::split_list::make_traits<
122 cc::split_list::ordered_list<cc::lazy_list_tag>
123 ,cc::opt::hash< hash_int >
124 ,cc::opt::item_counter< simple_item_counter >
125 ,cc::opt::memory_model< cc::opt::v::relaxed_ordering >
126 ,cc::split_list::dynamic_bucket_table< true >
127 ,cc::split_list::ordered_list_traits<
128 cc::lazy_list::make_traits<
129 cc::opt::less< less >
134 test_int_nogc< opt_map >();
137 void HashMapHdrTest::Split_Lazy_nogc_cmpmix()
139 // traits-based version
140 typedef cc::SplitListMap< cds::gc::nogc, key_type, value_type, nogc_cmpmix_traits > map_type;
141 test_int_nogc< map_type >();
143 // option-based version
144 typedef cc::SplitListMap< cds::gc::nogc,
147 cc::split_list::make_traits<
148 cc::split_list::ordered_list<cc::lazy_list_tag>
149 ,cc::opt::hash< hash_int >
150 ,cc::opt::item_counter< simple_item_counter >
151 ,cc::split_list::ordered_list_traits<
152 cc::lazy_list::make_traits<
153 cc::opt::less< std::less<key_type> >
154 ,cc::opt::compare< cmp >
159 test_int_nogc< opt_map >();
162 void HashMapHdrTest::Split_Lazy_nogc_cmpmix_stat()
164 // traits-based version
165 typedef cc::SplitListMap< cds::gc::nogc, key_type, value_type, nogc_cmpmix_stat_traits > map_type;
166 test_int_nogc< map_type >();
168 // option-based version
169 typedef cc::SplitListMap< cds::gc::nogc,
172 cc::split_list::make_traits<
173 cc::split_list::ordered_list<cc::lazy_list_tag>
174 ,cc::opt::hash< hash_int >
175 ,cc::opt::item_counter< simple_item_counter >
176 ,cds::opt::stat< cc::split_list::stat<> >
177 ,cc::split_list::ordered_list_traits<
178 cc::lazy_list::make_traits<
179 cc::opt::less< std::less<key_type> >
180 ,cc::opt::compare< cmp >
185 test_int_nogc< opt_map >();