1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
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_multimap
15 // void swap(unordered_multimap& __u);
17 #include <unordered_map>
23 #include "test_macros.h"
24 #include "../../test_compare.h"
25 #include "../../test_hash.h"
26 #include "test_allocator.h"
28 #include "min_allocator.h"
33 typedef test_hash
<std::hash
<int> > Hash
;
34 typedef test_compare
<std::equal_to
<int> > Compare
;
35 typedef test_allocator
<std::pair
<const int, std::string
> > Alloc
;
36 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
37 C
c1(0, Hash(1), Compare(1), Alloc(1, 1));
38 C
c2(0, Hash(2), Compare(2), Alloc(1, 2));
39 c2
.max_load_factor(2);
42 LIBCPP_ASSERT(c1
.bucket_count() == 0);
43 assert(c1
.size() == 0);
44 assert(c1
.hash_function() == Hash(2));
45 assert(c1
.key_eq() == Compare(2));
46 assert(c1
.get_allocator().get_id() == 1);
47 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
48 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
49 assert(c1
.max_load_factor() == 2);
51 LIBCPP_ASSERT(c2
.bucket_count() == 0);
52 assert(c2
.size() == 0);
53 assert(c2
.hash_function() == Hash(1));
54 assert(c2
.key_eq() == Compare(1));
55 assert(c2
.get_allocator().get_id() == 2);
56 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
57 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
58 assert(c2
.max_load_factor() == 1);
61 typedef test_hash
<std::hash
<int> > Hash
;
62 typedef test_compare
<std::equal_to
<int> > Compare
;
63 typedef test_allocator
<std::pair
<const int, std::string
> > Alloc
;
64 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
65 typedef std::pair
<int, std::string
> P
;
77 C
c1(0, Hash(1), Compare(1), Alloc(1, 1));
78 C
c2(std::begin(a2
), std::end(a2
), 0, Hash(2), Compare(2), Alloc(1, 2));
79 c2
.max_load_factor(2);
82 assert(c1
.bucket_count() >= 8);
83 assert(c1
.size() == 8);
84 assert(c1
.find(10)->second
== "ten");
85 assert(c1
.find(20)->second
== "twenty");
86 assert(c1
.find(30)->second
== "thirty");
87 assert(c1
.find(40)->second
== "forty");
88 assert(c1
.find(50)->second
== "fifty");
89 assert(c1
.find(60)->second
== "sixty");
90 assert(c1
.find(70)->second
== "seventy");
91 assert(c1
.find(80)->second
== "eighty");
92 assert(c1
.hash_function() == Hash(2));
93 assert(c1
.key_eq() == Compare(2));
94 assert(c1
.get_allocator().get_id() == 1);
95 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
96 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
97 assert(c1
.max_load_factor() == 2);
99 LIBCPP_ASSERT(c2
.bucket_count() == 0);
100 assert(c2
.size() == 0);
101 assert(c2
.hash_function() == Hash(1));
102 assert(c2
.key_eq() == Compare(1));
103 assert(c2
.get_allocator().get_id() == 2);
104 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
105 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
106 assert(c2
.max_load_factor() == 1);
109 typedef test_hash
<std::hash
<int> > Hash
;
110 typedef test_compare
<std::equal_to
<int> > Compare
;
111 typedef test_allocator
<std::pair
<const int, std::string
> > Alloc
;
112 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
113 typedef std::pair
<int, std::string
> P
;
123 C
c1(std::begin(a1
), std::end(a1
), 0, Hash(1), Compare(1), Alloc(1, 1));
124 C
c2(0, Hash(2), Compare(2), Alloc(1, 2));
125 c2
.max_load_factor(2);
128 LIBCPP_ASSERT(c1
.bucket_count() == 0);
129 assert(c1
.size() == 0);
130 assert(c1
.hash_function() == Hash(2));
131 assert(c1
.key_eq() == Compare(2));
132 assert(c1
.get_allocator().get_id() == 1);
133 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
134 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
135 assert(c1
.max_load_factor() == 2);
137 assert(c2
.bucket_count() >= 6);
138 assert(c2
.size() == 6);
140 std::set
<std::string
> s
;
143 assert(s
.find(c2
.find(1)->second
) != s
.end());
144 s
.erase(s
.find(c2
.find(1)->second
));
145 assert(s
.find(next(c2
.find(1))->second
) != s
.end());
148 std::set
<std::string
> s
;
151 assert(s
.find(c2
.find(2)->second
) != s
.end());
152 s
.erase(s
.find(c2
.find(2)->second
));
153 assert(s
.find(next(c2
.find(2))->second
) != s
.end());
155 assert(c2
.find(3)->second
== "three");
156 assert(c2
.find(4)->second
== "four");
157 assert(c2
.hash_function() == Hash(1));
158 assert(c2
.key_eq() == Compare(1));
159 assert(c2
.get_allocator().get_id() == 2);
160 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
161 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
162 assert(c2
.max_load_factor() == 1);
165 typedef test_hash
<std::hash
<int> > Hash
;
166 typedef test_compare
<std::equal_to
<int> > Compare
;
167 typedef test_allocator
<std::pair
<const int, std::string
> > Alloc
;
168 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
169 typedef std::pair
<int, std::string
> P
;
190 C
c1(std::begin(a1
), std::end(a1
), 0, Hash(1), Compare(1), Alloc(1, 1));
191 C
c2(std::begin(a2
), std::end(a2
), 0, Hash(2), Compare(2), Alloc(1, 2));
192 c2
.max_load_factor(2);
195 assert(c1
.bucket_count() >= 8);
196 assert(c1
.size() == 8);
197 assert(c1
.find(10)->second
== "ten");
198 assert(c1
.find(20)->second
== "twenty");
199 assert(c1
.find(30)->second
== "thirty");
200 assert(c1
.find(40)->second
== "forty");
201 assert(c1
.find(50)->second
== "fifty");
202 assert(c1
.find(60)->second
== "sixty");
203 assert(c1
.find(70)->second
== "seventy");
204 assert(c1
.find(80)->second
== "eighty");
205 assert(c1
.hash_function() == Hash(2));
206 assert(c1
.key_eq() == Compare(2));
207 assert(c1
.get_allocator().get_id() == 1);
208 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
209 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
210 assert(c1
.max_load_factor() == 2);
212 assert(c2
.bucket_count() >= 6);
213 assert(c2
.size() == 6);
215 std::set
<std::string
> s
;
218 assert(s
.find(c2
.find(1)->second
) != s
.end());
219 s
.erase(s
.find(c2
.find(1)->second
));
220 assert(s
.find(next(c2
.find(1))->second
) != s
.end());
223 std::set
<std::string
> s
;
226 assert(s
.find(c2
.find(2)->second
) != s
.end());
227 s
.erase(s
.find(c2
.find(2)->second
));
228 assert(s
.find(next(c2
.find(2))->second
) != s
.end());
230 assert(c2
.find(3)->second
== "three");
231 assert(c2
.find(4)->second
== "four");
232 assert(c2
.hash_function() == Hash(1));
233 assert(c2
.key_eq() == Compare(1));
234 assert(c2
.get_allocator().get_id() == 2);
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);
241 typedef test_hash
<std::hash
<int> > Hash
;
242 typedef test_compare
<std::equal_to
<int> > Compare
;
243 typedef other_allocator
<std::pair
<const int, std::string
> > Alloc
;
244 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
245 C
c1(0, Hash(1), Compare(1), Alloc(1));
246 C
c2(0, Hash(2), Compare(2), Alloc(2));
247 c2
.max_load_factor(2);
250 LIBCPP_ASSERT(c1
.bucket_count() == 0);
251 assert(c1
.size() == 0);
252 assert(c1
.hash_function() == Hash(2));
253 assert(c1
.key_eq() == Compare(2));
254 assert(c1
.get_allocator() == Alloc(2));
255 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
256 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
257 assert(c1
.max_load_factor() == 2);
259 LIBCPP_ASSERT(c2
.bucket_count() == 0);
260 assert(c2
.size() == 0);
261 assert(c2
.hash_function() == Hash(1));
262 assert(c2
.key_eq() == Compare(1));
263 assert(c2
.get_allocator() == Alloc(1));
264 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
265 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
266 assert(c2
.max_load_factor() == 1);
269 typedef test_hash
<std::hash
<int> > Hash
;
270 typedef test_compare
<std::equal_to
<int> > Compare
;
271 typedef other_allocator
<std::pair
<const int, std::string
> > Alloc
;
272 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
273 typedef std::pair
<int, std::string
> P
;
285 C
c1(0, Hash(1), Compare(1), Alloc(1));
286 C
c2(std::begin(a2
), std::end(a2
), 0, Hash(2), Compare(2), Alloc(2));
287 c2
.max_load_factor(2);
290 assert(c1
.bucket_count() >= 8);
291 assert(c1
.size() == 8);
292 assert(c1
.find(10)->second
== "ten");
293 assert(c1
.find(20)->second
== "twenty");
294 assert(c1
.find(30)->second
== "thirty");
295 assert(c1
.find(40)->second
== "forty");
296 assert(c1
.find(50)->second
== "fifty");
297 assert(c1
.find(60)->second
== "sixty");
298 assert(c1
.find(70)->second
== "seventy");
299 assert(c1
.find(80)->second
== "eighty");
300 assert(c1
.hash_function() == Hash(2));
301 assert(c1
.key_eq() == Compare(2));
302 assert(c1
.get_allocator() == Alloc(2));
303 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
304 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
305 assert(c1
.max_load_factor() == 2);
307 LIBCPP_ASSERT(c2
.bucket_count() == 0);
308 assert(c2
.size() == 0);
309 assert(c2
.hash_function() == Hash(1));
310 assert(c2
.key_eq() == Compare(1));
311 assert(c2
.get_allocator() == Alloc(1));
312 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
313 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
314 assert(c2
.max_load_factor() == 1);
317 typedef test_hash
<std::hash
<int> > Hash
;
318 typedef test_compare
<std::equal_to
<int> > Compare
;
319 typedef other_allocator
<std::pair
<const int, std::string
> > Alloc
;
320 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
321 typedef std::pair
<int, std::string
> P
;
331 C
c1(std::begin(a1
), std::end(a1
), 0, Hash(1), Compare(1), Alloc(1));
332 C
c2(0, Hash(2), Compare(2), Alloc(2));
333 c2
.max_load_factor(2);
336 LIBCPP_ASSERT(c1
.bucket_count() == 0);
337 assert(c1
.size() == 0);
338 assert(c1
.hash_function() == Hash(2));
339 assert(c1
.key_eq() == Compare(2));
340 assert(c1
.get_allocator() == Alloc(2));
341 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
342 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
343 assert(c1
.max_load_factor() == 2);
345 assert(c2
.bucket_count() >= 6);
346 assert(c2
.size() == 6);
348 std::set
<std::string
> s
;
351 assert(s
.find(c2
.find(1)->second
) != s
.end());
352 s
.erase(s
.find(c2
.find(1)->second
));
353 assert(s
.find(next(c2
.find(1))->second
) != s
.end());
356 std::set
<std::string
> s
;
359 assert(s
.find(c2
.find(2)->second
) != s
.end());
360 s
.erase(s
.find(c2
.find(2)->second
));
361 assert(s
.find(next(c2
.find(2))->second
) != s
.end());
363 assert(c2
.find(3)->second
== "three");
364 assert(c2
.find(4)->second
== "four");
365 assert(c2
.hash_function() == Hash(1));
366 assert(c2
.key_eq() == Compare(1));
367 assert(c2
.get_allocator() == Alloc(1));
368 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
369 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
370 assert(c2
.max_load_factor() == 1);
373 typedef test_hash
<std::hash
<int> > Hash
;
374 typedef test_compare
<std::equal_to
<int> > Compare
;
375 typedef other_allocator
<std::pair
<const int, std::string
> > Alloc
;
376 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
377 typedef std::pair
<int, std::string
> P
;
398 C
c1(std::begin(a1
), std::end(a1
), 0, Hash(1), Compare(1), Alloc(1));
399 C
c2(std::begin(a2
), std::end(a2
), 0, Hash(2), Compare(2), Alloc(2));
400 c2
.max_load_factor(2);
403 assert(c1
.bucket_count() >= 8);
404 assert(c1
.size() == 8);
405 assert(c1
.find(10)->second
== "ten");
406 assert(c1
.find(20)->second
== "twenty");
407 assert(c1
.find(30)->second
== "thirty");
408 assert(c1
.find(40)->second
== "forty");
409 assert(c1
.find(50)->second
== "fifty");
410 assert(c1
.find(60)->second
== "sixty");
411 assert(c1
.find(70)->second
== "seventy");
412 assert(c1
.find(80)->second
== "eighty");
413 assert(c1
.hash_function() == Hash(2));
414 assert(c1
.key_eq() == Compare(2));
415 assert(c1
.get_allocator() == Alloc(2));
416 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
417 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
418 assert(c1
.max_load_factor() == 2);
420 assert(c2
.bucket_count() >= 6);
421 assert(c2
.size() == 6);
423 std::set
<std::string
> s
;
426 assert(s
.find(c2
.find(1)->second
) != s
.end());
427 s
.erase(s
.find(c2
.find(1)->second
));
428 assert(s
.find(next(c2
.find(1))->second
) != s
.end());
431 std::set
<std::string
> s
;
434 assert(s
.find(c2
.find(2)->second
) != s
.end());
435 s
.erase(s
.find(c2
.find(2)->second
));
436 assert(s
.find(next(c2
.find(2))->second
) != s
.end());
438 assert(c2
.find(3)->second
== "three");
439 assert(c2
.find(4)->second
== "four");
440 assert(c2
.hash_function() == Hash(1));
441 assert(c2
.key_eq() == Compare(1));
442 assert(c2
.get_allocator() == Alloc(1));
443 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
444 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
445 assert(c2
.max_load_factor() == 1);
447 #if TEST_STD_VER >= 11
449 typedef test_hash
<std::hash
<int> > Hash
;
450 typedef test_compare
<std::equal_to
<int> > Compare
;
451 typedef min_allocator
<std::pair
<const int, std::string
> > Alloc
;
452 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
453 C
c1(0, Hash(1), Compare(1), Alloc());
454 C
c2(0, Hash(2), Compare(2), Alloc());
455 c2
.max_load_factor(2);
458 LIBCPP_ASSERT(c1
.bucket_count() == 0);
459 assert(c1
.size() == 0);
460 assert(c1
.hash_function() == Hash(2));
461 assert(c1
.key_eq() == Compare(2));
462 assert(c1
.get_allocator() == Alloc());
463 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
464 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
465 assert(c1
.max_load_factor() == 2);
467 LIBCPP_ASSERT(c2
.bucket_count() == 0);
468 assert(c2
.size() == 0);
469 assert(c2
.hash_function() == Hash(1));
470 assert(c2
.key_eq() == Compare(1));
471 assert(c2
.get_allocator() == Alloc());
472 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
473 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
474 assert(c2
.max_load_factor() == 1);
477 typedef test_hash
<std::hash
<int> > Hash
;
478 typedef test_compare
<std::equal_to
<int> > Compare
;
479 typedef min_allocator
<std::pair
<const int, std::string
> > Alloc
;
480 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
481 typedef std::pair
<int, std::string
> P
;
493 C
c1(0, Hash(1), Compare(1), Alloc());
494 C
c2(std::begin(a2
), std::end(a2
), 0, Hash(2), Compare(2), Alloc());
495 c2
.max_load_factor(2);
498 assert(c1
.bucket_count() >= 8);
499 assert(c1
.size() == 8);
500 assert(c1
.find(10)->second
== "ten");
501 assert(c1
.find(20)->second
== "twenty");
502 assert(c1
.find(30)->second
== "thirty");
503 assert(c1
.find(40)->second
== "forty");
504 assert(c1
.find(50)->second
== "fifty");
505 assert(c1
.find(60)->second
== "sixty");
506 assert(c1
.find(70)->second
== "seventy");
507 assert(c1
.find(80)->second
== "eighty");
508 assert(c1
.hash_function() == Hash(2));
509 assert(c1
.key_eq() == Compare(2));
510 assert(c1
.get_allocator() == Alloc());
511 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
512 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
513 assert(c1
.max_load_factor() == 2);
515 LIBCPP_ASSERT(c2
.bucket_count() == 0);
516 assert(c2
.size() == 0);
517 assert(c2
.hash_function() == Hash(1));
518 assert(c2
.key_eq() == Compare(1));
519 assert(c2
.get_allocator() == Alloc());
520 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
521 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
522 assert(c2
.max_load_factor() == 1);
525 typedef test_hash
<std::hash
<int> > Hash
;
526 typedef test_compare
<std::equal_to
<int> > Compare
;
527 typedef min_allocator
<std::pair
<const int, std::string
> > Alloc
;
528 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
529 typedef std::pair
<int, std::string
> P
;
539 C
c1(std::begin(a1
), std::end(a1
), 0, Hash(1), Compare(1), Alloc());
540 C
c2(0, Hash(2), Compare(2), Alloc());
541 c2
.max_load_factor(2);
544 LIBCPP_ASSERT(c1
.bucket_count() == 0);
545 assert(c1
.size() == 0);
546 assert(c1
.hash_function() == Hash(2));
547 assert(c1
.key_eq() == Compare(2));
548 assert(c1
.get_allocator() == Alloc());
549 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
550 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
551 assert(c1
.max_load_factor() == 2);
553 assert(c2
.bucket_count() >= 6);
554 assert(c2
.size() == 6);
556 std::set
<std::string
> s
;
559 assert(s
.find(c2
.find(1)->second
) != s
.end());
560 s
.erase(s
.find(c2
.find(1)->second
));
561 assert(s
.find(next(c2
.find(1))->second
) != s
.end());
564 std::set
<std::string
> s
;
567 assert(s
.find(c2
.find(2)->second
) != s
.end());
568 s
.erase(s
.find(c2
.find(2)->second
));
569 assert(s
.find(next(c2
.find(2))->second
) != s
.end());
571 assert(c2
.find(3)->second
== "three");
572 assert(c2
.find(4)->second
== "four");
573 assert(c2
.hash_function() == Hash(1));
574 assert(c2
.key_eq() == Compare(1));
575 assert(c2
.get_allocator() == Alloc());
576 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
577 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
578 assert(c2
.max_load_factor() == 1);
581 typedef test_hash
<std::hash
<int> > Hash
;
582 typedef test_compare
<std::equal_to
<int> > Compare
;
583 typedef min_allocator
<std::pair
<const int, std::string
> > Alloc
;
584 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
585 typedef std::pair
<int, std::string
> P
;
606 C
c1(std::begin(a1
), std::end(a1
), 0, Hash(1), Compare(1), Alloc());
607 C
c2(std::begin(a2
), std::end(a2
), 0, Hash(2), Compare(2), Alloc());
608 c2
.max_load_factor(2);
611 assert(c1
.bucket_count() >= 8);
612 assert(c1
.size() == 8);
613 assert(c1
.find(10)->second
== "ten");
614 assert(c1
.find(20)->second
== "twenty");
615 assert(c1
.find(30)->second
== "thirty");
616 assert(c1
.find(40)->second
== "forty");
617 assert(c1
.find(50)->second
== "fifty");
618 assert(c1
.find(60)->second
== "sixty");
619 assert(c1
.find(70)->second
== "seventy");
620 assert(c1
.find(80)->second
== "eighty");
621 assert(c1
.hash_function() == Hash(2));
622 assert(c1
.key_eq() == Compare(2));
623 assert(c1
.get_allocator() == Alloc());
624 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
625 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
626 assert(c1
.max_load_factor() == 2);
628 assert(c2
.bucket_count() >= 6);
629 assert(c2
.size() == 6);
631 std::set
<std::string
> s
;
634 assert(s
.find(c2
.find(1)->second
) != s
.end());
635 s
.erase(s
.find(c2
.find(1)->second
));
636 assert(s
.find(next(c2
.find(1))->second
) != s
.end());
639 std::set
<std::string
> s
;
642 assert(s
.find(c2
.find(2)->second
) != s
.end());
643 s
.erase(s
.find(c2
.find(2)->second
));
644 assert(s
.find(next(c2
.find(2))->second
) != s
.end());
646 assert(c2
.find(3)->second
== "three");
647 assert(c2
.find(4)->second
== "four");
648 assert(c2
.hash_function() == Hash(1));
649 assert(c2
.key_eq() == Compare(1));
650 assert(c2
.get_allocator() == Alloc());
651 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
652 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
653 assert(c2
.max_load_factor() == 1);