[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / containers / unord / unord.map / swap_member.pass.cpp
blob955aa31a88ae3ab37a8f819b4eb604a4ed50372b
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <unordered_map>
11 // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
12 // class Alloc = allocator<pair<const Key, T>>>
13 // class unordered_map
15 // void swap(unordered_map& __u);
17 #include <unordered_map>
18 #include <string>
19 #include <cassert>
20 #include <cstddef>
21 #include <iterator>
23 #include "../../test_compare.h"
24 #include "../../test_hash.h"
25 #include "test_macros.h"
26 #include "test_allocator.h"
27 #include "min_allocator.h"
29 int main(int, char**)
32 typedef test_hash<int> Hash;
33 typedef test_equal_to<int> Compare;
34 typedef test_allocator<std::pair<const int, std::string> > Alloc;
35 typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
36 C c1(0, Hash(1), Compare(1), Alloc(1, 1));
37 C c2(0, Hash(2), Compare(2), Alloc(1, 2));
38 c2.max_load_factor(2);
39 c1.swap(c2);
41 LIBCPP_ASSERT(c1.bucket_count() == 0);
42 assert(c1.size() == 0);
43 assert(c1.hash_function() == Hash(2));
44 assert(c1.key_eq() == Compare(2));
45 assert(c1.get_allocator().get_id() == 1);
46 assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
47 assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
48 assert(c1.max_load_factor() == 2);
50 LIBCPP_ASSERT(c2.bucket_count() == 0);
51 assert(c2.size() == 0);
52 assert(c2.hash_function() == Hash(1));
53 assert(c2.key_eq() == Compare(1));
54 assert(c2.get_allocator().get_id() == 2);
55 assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
56 assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
57 assert(c2.max_load_factor() == 1);
60 typedef test_hash<int> Hash;
61 typedef test_equal_to<int> Compare;
62 typedef test_allocator<std::pair<const int, std::string> > Alloc;
63 typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
64 typedef std::pair<int, std::string> P;
65 P a2[] =
67 P(10, "ten"),
68 P(20, "twenty"),
69 P(30, "thirty"),
70 P(40, "forty"),
71 P(50, "fifty"),
72 P(60, "sixty"),
73 P(70, "seventy"),
74 P(80, "eighty"),
76 C c1(0, Hash(1), Compare(1), Alloc(1, 1));
77 C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
78 c2.max_load_factor(2);
79 c1.swap(c2);
81 assert(c1.bucket_count() >= 8);
82 assert(c1.size() == 8);
83 assert(c1.at(10) == "ten");
84 assert(c1.at(20) == "twenty");
85 assert(c1.at(30) == "thirty");
86 assert(c1.at(40) == "forty");
87 assert(c1.at(50) == "fifty");
88 assert(c1.at(60) == "sixty");
89 assert(c1.at(70) == "seventy");
90 assert(c1.at(80) == "eighty");
91 assert(c1.hash_function() == Hash(2));
92 assert(c1.key_eq() == Compare(2));
93 assert(c1.get_allocator().get_id() == 1);
94 assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
95 assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
96 assert(c1.max_load_factor() == 2);
98 LIBCPP_ASSERT(c2.bucket_count() == 0);
99 assert(c2.size() == 0);
100 assert(c2.hash_function() == Hash(1));
101 assert(c2.key_eq() == Compare(1));
102 assert(c2.get_allocator().get_id() == 2);
103 assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
104 assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
105 assert(c2.max_load_factor() == 1);
108 typedef test_hash<int> Hash;
109 typedef test_equal_to<int> Compare;
110 typedef test_allocator<std::pair<const int, std::string> > Alloc;
111 typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
112 typedef std::pair<int, std::string> P;
113 P a1[] =
115 P(1, "one"),
116 P(2, "two"),
117 P(3, "three"),
118 P(4, "four"),
119 P(1, "four"),
120 P(2, "four"),
122 C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
123 C c2(0, Hash(2), Compare(2), Alloc(1, 2));
124 c2.max_load_factor(2);
125 c1.swap(c2);
127 LIBCPP_ASSERT(c1.bucket_count() == 0);
128 assert(c1.size() == 0);
129 assert(c1.hash_function() == Hash(2));
130 assert(c1.key_eq() == Compare(2));
131 assert(c1.get_allocator().get_id() == 1);
132 assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
133 assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
134 assert(c1.max_load_factor() == 2);
136 assert(c2.bucket_count() >= 4);
137 assert(c2.size() == 4);
138 assert(c2.at(1) == "one");
139 assert(c2.at(2) == "two");
140 assert(c2.at(3) == "three");
141 assert(c2.at(4) == "four");
142 assert(c2.hash_function() == Hash(1));
143 assert(c2.key_eq() == Compare(1));
144 assert(c2.get_allocator().get_id() == 2);
145 assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
146 assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
147 assert(c2.max_load_factor() == 1);
150 typedef test_hash<int> Hash;
151 typedef test_equal_to<int> Compare;
152 typedef test_allocator<std::pair<const int, std::string> > Alloc;
153 typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
154 typedef std::pair<int, std::string> P;
155 P a1[] =
157 P(1, "one"),
158 P(2, "two"),
159 P(3, "three"),
160 P(4, "four"),
161 P(1, "four"),
162 P(2, "four"),
164 P a2[] =
166 P(10, "ten"),
167 P(20, "twenty"),
168 P(30, "thirty"),
169 P(40, "forty"),
170 P(50, "fifty"),
171 P(60, "sixty"),
172 P(70, "seventy"),
173 P(80, "eighty"),
175 C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
176 C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
177 c2.max_load_factor(2);
178 c1.swap(c2);
180 assert(c1.bucket_count() >= 8);
181 assert(c1.size() == 8);
182 assert(c1.at(10) == "ten");
183 assert(c1.at(20) == "twenty");
184 assert(c1.at(30) == "thirty");
185 assert(c1.at(40) == "forty");
186 assert(c1.at(50) == "fifty");
187 assert(c1.at(60) == "sixty");
188 assert(c1.at(70) == "seventy");
189 assert(c1.at(80) == "eighty");
190 assert(c1.hash_function() == Hash(2));
191 assert(c1.key_eq() == Compare(2));
192 assert(c1.get_allocator().get_id() == 1);
193 assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
194 assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
195 assert(c1.max_load_factor() == 2);
197 assert(c2.bucket_count() >= 4);
198 assert(c2.size() == 4);
199 assert(c2.at(1) == "one");
200 assert(c2.at(2) == "two");
201 assert(c2.at(3) == "three");
202 assert(c2.at(4) == "four");
203 assert(c2.hash_function() == Hash(1));
204 assert(c2.key_eq() == Compare(1));
205 assert(c2.get_allocator().get_id() == 2);
206 assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
207 assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
208 assert(c2.max_load_factor() == 1);
212 typedef test_hash<int> Hash;
213 typedef test_equal_to<int> Compare;
214 typedef other_allocator<std::pair<const int, std::string> > Alloc;
215 typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
216 C c1(0, Hash(1), Compare(1), Alloc(1));
217 C c2(0, Hash(2), Compare(2), Alloc(2));
218 c2.max_load_factor(2);
219 c1.swap(c2);
221 LIBCPP_ASSERT(c1.bucket_count() == 0);
222 assert(c1.size() == 0);
223 assert(c1.hash_function() == Hash(2));
224 assert(c1.key_eq() == Compare(2));
225 assert(c1.get_allocator() == Alloc(2));
226 assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
227 assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
228 assert(c1.max_load_factor() == 2);
230 LIBCPP_ASSERT(c2.bucket_count() == 0);
231 assert(c2.size() == 0);
232 assert(c2.hash_function() == Hash(1));
233 assert(c2.key_eq() == Compare(1));
234 assert(c2.get_allocator() == Alloc(1));
235 assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
236 assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
237 assert(c2.max_load_factor() == 1);
240 typedef test_hash<int> Hash;
241 typedef test_equal_to<int> Compare;
242 typedef other_allocator<std::pair<const int, std::string> > Alloc;
243 typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
244 typedef std::pair<int, std::string> P;
245 P a2[] =
247 P(10, "ten"),
248 P(20, "twenty"),
249 P(30, "thirty"),
250 P(40, "forty"),
251 P(50, "fifty"),
252 P(60, "sixty"),
253 P(70, "seventy"),
254 P(80, "eighty"),
256 C c1(0, Hash(1), Compare(1), Alloc(1));
257 C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
258 c2.max_load_factor(2);
259 c1.swap(c2);
261 assert(c1.bucket_count() >= 8);
262 assert(c1.size() == 8);
263 assert(c1.at(10) == "ten");
264 assert(c1.at(20) == "twenty");
265 assert(c1.at(30) == "thirty");
266 assert(c1.at(40) == "forty");
267 assert(c1.at(50) == "fifty");
268 assert(c1.at(60) == "sixty");
269 assert(c1.at(70) == "seventy");
270 assert(c1.at(80) == "eighty");
271 assert(c1.hash_function() == Hash(2));
272 assert(c1.key_eq() == Compare(2));
273 assert(c1.get_allocator() == Alloc(2));
274 assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
275 assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
276 assert(c1.max_load_factor() == 2);
278 LIBCPP_ASSERT(c2.bucket_count() == 0);
279 assert(c2.size() == 0);
280 assert(c2.hash_function() == Hash(1));
281 assert(c2.key_eq() == Compare(1));
282 assert(c2.get_allocator() == Alloc(1));
283 assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
284 assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
285 assert(c2.max_load_factor() == 1);
288 typedef test_hash<int> Hash;
289 typedef test_equal_to<int> Compare;
290 typedef other_allocator<std::pair<const int, std::string> > Alloc;
291 typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
292 typedef std::pair<int, std::string> P;
293 P a1[] =
295 P(1, "one"),
296 P(2, "two"),
297 P(3, "three"),
298 P(4, "four"),
299 P(1, "four"),
300 P(2, "four"),
302 C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
303 C c2(0, Hash(2), Compare(2), Alloc(2));
304 c2.max_load_factor(2);
305 c1.swap(c2);
307 LIBCPP_ASSERT(c1.bucket_count() == 0);
308 assert(c1.size() == 0);
309 assert(c1.hash_function() == Hash(2));
310 assert(c1.key_eq() == Compare(2));
311 assert(c1.get_allocator() == Alloc(2));
312 assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
313 assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
314 assert(c1.max_load_factor() == 2);
316 assert(c2.bucket_count() >= 4);
317 assert(c2.size() == 4);
318 assert(c2.at(1) == "one");
319 assert(c2.at(2) == "two");
320 assert(c2.at(3) == "three");
321 assert(c2.at(4) == "four");
322 assert(c2.hash_function() == Hash(1));
323 assert(c2.key_eq() == Compare(1));
324 assert(c2.get_allocator() == Alloc(1));
325 assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
326 assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
327 assert(c2.max_load_factor() == 1);
330 typedef test_hash<int> Hash;
331 typedef test_equal_to<int> Compare;
332 typedef other_allocator<std::pair<const int, std::string> > Alloc;
333 typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
334 typedef std::pair<int, std::string> P;
335 P a1[] =
337 P(1, "one"),
338 P(2, "two"),
339 P(3, "three"),
340 P(4, "four"),
341 P(1, "four"),
342 P(2, "four"),
344 P a2[] =
346 P(10, "ten"),
347 P(20, "twenty"),
348 P(30, "thirty"),
349 P(40, "forty"),
350 P(50, "fifty"),
351 P(60, "sixty"),
352 P(70, "seventy"),
353 P(80, "eighty"),
355 C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
356 C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
357 c2.max_load_factor(2);
358 c1.swap(c2);
360 assert(c1.bucket_count() >= 8);
361 assert(c1.size() == 8);
362 assert(c1.at(10) == "ten");
363 assert(c1.at(20) == "twenty");
364 assert(c1.at(30) == "thirty");
365 assert(c1.at(40) == "forty");
366 assert(c1.at(50) == "fifty");
367 assert(c1.at(60) == "sixty");
368 assert(c1.at(70) == "seventy");
369 assert(c1.at(80) == "eighty");
370 assert(c1.hash_function() == Hash(2));
371 assert(c1.key_eq() == Compare(2));
372 assert(c1.get_allocator() == Alloc(2));
373 assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
374 assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
375 assert(c1.max_load_factor() == 2);
377 assert(c2.bucket_count() >= 4);
378 assert(c2.size() == 4);
379 assert(c2.at(1) == "one");
380 assert(c2.at(2) == "two");
381 assert(c2.at(3) == "three");
382 assert(c2.at(4) == "four");
383 assert(c2.hash_function() == Hash(1));
384 assert(c2.key_eq() == Compare(1));
385 assert(c2.get_allocator() == Alloc(1));
386 assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
387 assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
388 assert(c2.max_load_factor() == 1);
390 #if TEST_STD_VER >= 11
392 typedef test_hash<int> Hash;
393 typedef test_equal_to<int> Compare;
394 typedef min_allocator<std::pair<const int, std::string> > Alloc;
395 typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
396 C c1(0, Hash(1), Compare(1), Alloc());
397 C c2(0, Hash(2), Compare(2), Alloc());
398 c2.max_load_factor(2);
399 c1.swap(c2);
401 LIBCPP_ASSERT(c1.bucket_count() == 0);
402 assert(c1.size() == 0);
403 assert(c1.hash_function() == Hash(2));
404 assert(c1.key_eq() == Compare(2));
405 assert(c1.get_allocator() == Alloc());
406 assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
407 assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
408 assert(c1.max_load_factor() == 2);
410 LIBCPP_ASSERT(c2.bucket_count() == 0);
411 assert(c2.size() == 0);
412 assert(c2.hash_function() == Hash(1));
413 assert(c2.key_eq() == Compare(1));
414 assert(c2.get_allocator() == Alloc());
415 assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
416 assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
417 assert(c2.max_load_factor() == 1);
420 typedef test_hash<int> Hash;
421 typedef test_equal_to<int> Compare;
422 typedef min_allocator<std::pair<const int, std::string> > Alloc;
423 typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
424 typedef std::pair<int, std::string> P;
425 P a2[] =
427 P(10, "ten"),
428 P(20, "twenty"),
429 P(30, "thirty"),
430 P(40, "forty"),
431 P(50, "fifty"),
432 P(60, "sixty"),
433 P(70, "seventy"),
434 P(80, "eighty"),
436 C c1(0, Hash(1), Compare(1), Alloc());
437 C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
438 c2.max_load_factor(2);
439 c1.swap(c2);
441 assert(c1.bucket_count() >= 8);
442 assert(c1.size() == 8);
443 assert(c1.at(10) == "ten");
444 assert(c1.at(20) == "twenty");
445 assert(c1.at(30) == "thirty");
446 assert(c1.at(40) == "forty");
447 assert(c1.at(50) == "fifty");
448 assert(c1.at(60) == "sixty");
449 assert(c1.at(70) == "seventy");
450 assert(c1.at(80) == "eighty");
451 assert(c1.hash_function() == Hash(2));
452 assert(c1.key_eq() == Compare(2));
453 assert(c1.get_allocator() == Alloc());
454 assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
455 assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
456 assert(c1.max_load_factor() == 2);
458 LIBCPP_ASSERT(c2.bucket_count() == 0);
459 assert(c2.size() == 0);
460 assert(c2.hash_function() == Hash(1));
461 assert(c2.key_eq() == Compare(1));
462 assert(c2.get_allocator() == Alloc());
463 assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
464 assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
465 assert(c2.max_load_factor() == 1);
468 typedef test_hash<int> Hash;
469 typedef test_equal_to<int> Compare;
470 typedef min_allocator<std::pair<const int, std::string> > Alloc;
471 typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
472 typedef std::pair<int, std::string> P;
473 P a1[] =
475 P(1, "one"),
476 P(2, "two"),
477 P(3, "three"),
478 P(4, "four"),
479 P(1, "four"),
480 P(2, "four"),
482 C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
483 C c2(0, Hash(2), Compare(2), Alloc());
484 c2.max_load_factor(2);
485 c1.swap(c2);
487 LIBCPP_ASSERT(c1.bucket_count() == 0);
488 assert(c1.size() == 0);
489 assert(c1.hash_function() == Hash(2));
490 assert(c1.key_eq() == Compare(2));
491 assert(c1.get_allocator() == Alloc());
492 assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
493 assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
494 assert(c1.max_load_factor() == 2);
496 assert(c2.bucket_count() >= 4);
497 assert(c2.size() == 4);
498 assert(c2.at(1) == "one");
499 assert(c2.at(2) == "two");
500 assert(c2.at(3) == "three");
501 assert(c2.at(4) == "four");
502 assert(c2.hash_function() == Hash(1));
503 assert(c2.key_eq() == Compare(1));
504 assert(c2.get_allocator() == Alloc());
505 assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
506 assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
507 assert(c2.max_load_factor() == 1);
510 typedef test_hash<int> Hash;
511 typedef test_equal_to<int> Compare;
512 typedef min_allocator<std::pair<const int, std::string> > Alloc;
513 typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
514 typedef std::pair<int, std::string> P;
515 P a1[] =
517 P(1, "one"),
518 P(2, "two"),
519 P(3, "three"),
520 P(4, "four"),
521 P(1, "four"),
522 P(2, "four"),
524 P a2[] =
526 P(10, "ten"),
527 P(20, "twenty"),
528 P(30, "thirty"),
529 P(40, "forty"),
530 P(50, "fifty"),
531 P(60, "sixty"),
532 P(70, "seventy"),
533 P(80, "eighty"),
535 C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
536 C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
537 c2.max_load_factor(2);
538 c1.swap(c2);
540 assert(c1.bucket_count() >= 8);
541 assert(c1.size() == 8);
542 assert(c1.at(10) == "ten");
543 assert(c1.at(20) == "twenty");
544 assert(c1.at(30) == "thirty");
545 assert(c1.at(40) == "forty");
546 assert(c1.at(50) == "fifty");
547 assert(c1.at(60) == "sixty");
548 assert(c1.at(70) == "seventy");
549 assert(c1.at(80) == "eighty");
550 assert(c1.hash_function() == Hash(2));
551 assert(c1.key_eq() == Compare(2));
552 assert(c1.get_allocator() == Alloc());
553 assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
554 assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
555 assert(c1.max_load_factor() == 2);
557 assert(c2.bucket_count() >= 4);
558 assert(c2.size() == 4);
559 assert(c2.at(1) == "one");
560 assert(c2.at(2) == "two");
561 assert(c2.at(3) == "three");
562 assert(c2.at(4) == "four");
563 assert(c2.hash_function() == Hash(1));
564 assert(c2.key_eq() == Compare(1));
565 assert(c2.get_allocator() == Alloc());
566 assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
567 assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
568 assert(c2.max_load_factor() == 1);
570 #endif
572 return 0;