1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <unordered_map>
11 
12 // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
13 //           class Alloc = allocator<pair<const Key, T>>>
14 // class unordered_multimap
15 
16 // void swap(unordered_multimap& __u);
17 
18 #include <unordered_map>
19 #include <string>
20 #include <cassert>
21 
22 #include "../../../test_compare.h"
23 #include "../../../test_hash.h"
24 #include "test_allocator.h"
25 #include "min_allocator.h"
26 
main()27 int main()
28 {
29     {
30         typedef test_hash<std::hash<int> > Hash;
31         typedef test_compare<std::equal_to<int> > Compare;
32         typedef test_allocator<std::pair<const int, std::string> > Alloc;
33         typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
34         typedef std::pair<int, std::string> P;
35         C c1(0, Hash(1), Compare(1), Alloc(1));
36         C c2(0, Hash(2), Compare(2), Alloc(2));
37         c2.max_load_factor(2);
38         swap(c1, c2);
39 
40         assert(c1.bucket_count() == 0);
41         assert(c1.size() == 0);
42         assert(c1.hash_function() == Hash(2));
43         assert(c1.key_eq() == Compare(2));
44         assert(c1.get_allocator() == Alloc(1));
45         assert(std::distance(c1.begin(), c1.end()) == c1.size());
46         assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
47         assert(c1.max_load_factor() == 2);
48 
49         assert(c2.bucket_count() == 0);
50         assert(c2.size() == 0);
51         assert(c2.hash_function() == Hash(1));
52         assert(c2.key_eq() == Compare(1));
53         assert(c2.get_allocator() == Alloc(2));
54         assert(std::distance(c2.begin(), c2.end()) == c2.size());
55         assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
56         assert(c2.max_load_factor() == 1);
57     }
58     {
59         typedef test_hash<std::hash<int> > Hash;
60         typedef test_compare<std::equal_to<int> > Compare;
61         typedef test_allocator<std::pair<const int, std::string> > Alloc;
62         typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
63         typedef std::pair<int, std::string> P;
64         P a2[] =
65         {
66             P(10, "ten"),
67             P(20, "twenty"),
68             P(30, "thirty"),
69             P(40, "forty"),
70             P(50, "fifty"),
71             P(60, "sixty"),
72             P(70, "seventy"),
73             P(80, "eighty"),
74         };
75         C c1(0, Hash(1), Compare(1), Alloc(1));
76         C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
77         c2.max_load_factor(2);
78         swap(c1, c2);
79 
80         assert(c1.bucket_count() >= 11);
81         assert(c1.size() == 8);
82         assert(c1.find(10)->second == "ten");
83         assert(c1.find(20)->second == "twenty");
84         assert(c1.find(30)->second == "thirty");
85         assert(c1.find(40)->second == "forty");
86         assert(c1.find(50)->second == "fifty");
87         assert(c1.find(60)->second == "sixty");
88         assert(c1.find(70)->second == "seventy");
89         assert(c1.find(80)->second == "eighty");
90         assert(c1.hash_function() == Hash(2));
91         assert(c1.key_eq() == Compare(2));
92         assert(c1.get_allocator() == Alloc(1));
93         assert(std::distance(c1.begin(), c1.end()) == c1.size());
94         assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
95         assert(c1.max_load_factor() == 2);
96 
97         assert(c2.bucket_count() == 0);
98         assert(c2.size() == 0);
99         assert(c2.hash_function() == Hash(1));
100         assert(c2.key_eq() == Compare(1));
101         assert(c2.get_allocator() == Alloc(2));
102         assert(std::distance(c2.begin(), c2.end()) == c2.size());
103         assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
104         assert(c2.max_load_factor() == 1);
105     }
106     {
107         typedef test_hash<std::hash<int> > Hash;
108         typedef test_compare<std::equal_to<int> > Compare;
109         typedef test_allocator<std::pair<const int, std::string> > Alloc;
110         typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
111         typedef std::pair<int, std::string> P;
112         P a1[] =
113         {
114             P(1, "one"),
115             P(2, "two"),
116             P(3, "three"),
117             P(4, "four"),
118             P(1, "four"),
119             P(2, "four"),
120         };
121         C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
122         C c2(0, Hash(2), Compare(2), Alloc(2));
123         c2.max_load_factor(2);
124         swap(c1, c2);
125 
126         assert(c1.bucket_count() == 0);
127         assert(c1.size() == 0);
128         assert(c1.hash_function() == Hash(2));
129         assert(c1.key_eq() == Compare(2));
130         assert(c1.get_allocator() == Alloc(1));
131         assert(std::distance(c1.begin(), c1.end()) == c1.size());
132         assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
133         assert(c1.max_load_factor() == 2);
134 
135         assert(c2.bucket_count() >= 7);
136         assert(c2.size() == 6);
137         assert(c2.find(1)->second == "one");
138         assert(next(c2.find(1))->second == "four");
139         assert(c2.find(2)->second == "two");
140         assert(next(c2.find(2))->second == "four");
141         assert(c2.find(3)->second == "three");
142         assert(c2.find(4)->second == "four");
143         assert(c2.hash_function() == Hash(1));
144         assert(c2.key_eq() == Compare(1));
145         assert(c2.get_allocator() == Alloc(2));
146         assert(std::distance(c2.begin(), c2.end()) == c2.size());
147         assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
148         assert(c2.max_load_factor() == 1);
149     }
150     {
151         typedef test_hash<std::hash<int> > Hash;
152         typedef test_compare<std::equal_to<int> > Compare;
153         typedef test_allocator<std::pair<const int, std::string> > Alloc;
154         typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
155         typedef std::pair<int, std::string> P;
156         P a1[] =
157         {
158             P(1, "one"),
159             P(2, "two"),
160             P(3, "three"),
161             P(4, "four"),
162             P(1, "four"),
163             P(2, "four"),
164         };
165         P a2[] =
166         {
167             P(10, "ten"),
168             P(20, "twenty"),
169             P(30, "thirty"),
170             P(40, "forty"),
171             P(50, "fifty"),
172             P(60, "sixty"),
173             P(70, "seventy"),
174             P(80, "eighty"),
175         };
176         C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
177         C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
178         c2.max_load_factor(2);
179         swap(c1, c2);
180 
181         assert(c1.bucket_count() >= 11);
182         assert(c1.size() == 8);
183         assert(c1.find(10)->second == "ten");
184         assert(c1.find(20)->second == "twenty");
185         assert(c1.find(30)->second == "thirty");
186         assert(c1.find(40)->second == "forty");
187         assert(c1.find(50)->second == "fifty");
188         assert(c1.find(60)->second == "sixty");
189         assert(c1.find(70)->second == "seventy");
190         assert(c1.find(80)->second == "eighty");
191         assert(c1.hash_function() == Hash(2));
192         assert(c1.key_eq() == Compare(2));
193         assert(c1.get_allocator() == Alloc(1));
194         assert(std::distance(c1.begin(), c1.end()) == c1.size());
195         assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
196         assert(c1.max_load_factor() == 2);
197 
198         assert(c2.bucket_count() >= 7);
199         assert(c2.size() == 6);
200         assert(c2.find(1)->second == "one");
201         assert(next(c2.find(1))->second == "four");
202         assert(c2.find(2)->second == "two");
203         assert(next(c2.find(2))->second == "four");
204         assert(c2.find(3)->second == "three");
205         assert(c2.find(4)->second == "four");
206         assert(c2.hash_function() == Hash(1));
207         assert(c2.key_eq() == Compare(1));
208         assert(c2.get_allocator() == Alloc(2));
209         assert(std::distance(c2.begin(), c2.end()) == c2.size());
210         assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
211         assert(c2.max_load_factor() == 1);
212     }
213 
214     {
215         typedef test_hash<std::hash<int> > Hash;
216         typedef test_compare<std::equal_to<int> > Compare;
217         typedef other_allocator<std::pair<const int, std::string> > Alloc;
218         typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
219         typedef std::pair<int, std::string> P;
220         C c1(0, Hash(1), Compare(1), Alloc(1));
221         C c2(0, Hash(2), Compare(2), Alloc(2));
222         c2.max_load_factor(2);
223         swap(c1, c2);
224 
225         assert(c1.bucket_count() == 0);
226         assert(c1.size() == 0);
227         assert(c1.hash_function() == Hash(2));
228         assert(c1.key_eq() == Compare(2));
229         assert(c1.get_allocator() == Alloc(2));
230         assert(std::distance(c1.begin(), c1.end()) == c1.size());
231         assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
232         assert(c1.max_load_factor() == 2);
233 
234         assert(c2.bucket_count() == 0);
235         assert(c2.size() == 0);
236         assert(c2.hash_function() == Hash(1));
237         assert(c2.key_eq() == Compare(1));
238         assert(c2.get_allocator() == Alloc(1));
239         assert(std::distance(c2.begin(), c2.end()) == c2.size());
240         assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
241         assert(c2.max_load_factor() == 1);
242     }
243     {
244         typedef test_hash<std::hash<int> > Hash;
245         typedef test_compare<std::equal_to<int> > Compare;
246         typedef other_allocator<std::pair<const int, std::string> > Alloc;
247         typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
248         typedef std::pair<int, std::string> P;
249         P a2[] =
250         {
251             P(10, "ten"),
252             P(20, "twenty"),
253             P(30, "thirty"),
254             P(40, "forty"),
255             P(50, "fifty"),
256             P(60, "sixty"),
257             P(70, "seventy"),
258             P(80, "eighty"),
259         };
260         C c1(0, Hash(1), Compare(1), Alloc(1));
261         C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
262         c2.max_load_factor(2);
263         swap(c1, c2);
264 
265         assert(c1.bucket_count() >= 11);
266         assert(c1.size() == 8);
267         assert(c1.find(10)->second == "ten");
268         assert(c1.find(20)->second == "twenty");
269         assert(c1.find(30)->second == "thirty");
270         assert(c1.find(40)->second == "forty");
271         assert(c1.find(50)->second == "fifty");
272         assert(c1.find(60)->second == "sixty");
273         assert(c1.find(70)->second == "seventy");
274         assert(c1.find(80)->second == "eighty");
275         assert(c1.hash_function() == Hash(2));
276         assert(c1.key_eq() == Compare(2));
277         assert(c1.get_allocator() == Alloc(2));
278         assert(std::distance(c1.begin(), c1.end()) == c1.size());
279         assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
280         assert(c1.max_load_factor() == 2);
281 
282         assert(c2.bucket_count() == 0);
283         assert(c2.size() == 0);
284         assert(c2.hash_function() == Hash(1));
285         assert(c2.key_eq() == Compare(1));
286         assert(c2.get_allocator() == Alloc(1));
287         assert(std::distance(c2.begin(), c2.end()) == c2.size());
288         assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
289         assert(c2.max_load_factor() == 1);
290     }
291     {
292         typedef test_hash<std::hash<int> > Hash;
293         typedef test_compare<std::equal_to<int> > Compare;
294         typedef other_allocator<std::pair<const int, std::string> > Alloc;
295         typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
296         typedef std::pair<int, std::string> P;
297         P a1[] =
298         {
299             P(1, "one"),
300             P(2, "two"),
301             P(3, "three"),
302             P(4, "four"),
303             P(1, "four"),
304             P(2, "four"),
305         };
306         C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
307         C c2(0, Hash(2), Compare(2), Alloc(2));
308         c2.max_load_factor(2);
309         swap(c1, c2);
310 
311         assert(c1.bucket_count() == 0);
312         assert(c1.size() == 0);
313         assert(c1.hash_function() == Hash(2));
314         assert(c1.key_eq() == Compare(2));
315         assert(c1.get_allocator() == Alloc(2));
316         assert(std::distance(c1.begin(), c1.end()) == c1.size());
317         assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
318         assert(c1.max_load_factor() == 2);
319 
320         assert(c2.bucket_count() >= 7);
321         assert(c2.size() == 6);
322         assert(c2.find(1)->second == "one");
323         assert(next(c2.find(1))->second == "four");
324         assert(c2.find(2)->second == "two");
325         assert(next(c2.find(2))->second == "four");
326         assert(c2.find(3)->second == "three");
327         assert(c2.find(4)->second == "four");
328         assert(c2.hash_function() == Hash(1));
329         assert(c2.key_eq() == Compare(1));
330         assert(c2.get_allocator() == Alloc(1));
331         assert(std::distance(c2.begin(), c2.end()) == c2.size());
332         assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
333         assert(c2.max_load_factor() == 1);
334     }
335     {
336         typedef test_hash<std::hash<int> > Hash;
337         typedef test_compare<std::equal_to<int> > Compare;
338         typedef other_allocator<std::pair<const int, std::string> > Alloc;
339         typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
340         typedef std::pair<int, std::string> P;
341         P a1[] =
342         {
343             P(1, "one"),
344             P(2, "two"),
345             P(3, "three"),
346             P(4, "four"),
347             P(1, "four"),
348             P(2, "four"),
349         };
350         P a2[] =
351         {
352             P(10, "ten"),
353             P(20, "twenty"),
354             P(30, "thirty"),
355             P(40, "forty"),
356             P(50, "fifty"),
357             P(60, "sixty"),
358             P(70, "seventy"),
359             P(80, "eighty"),
360         };
361         C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
362         C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
363         c2.max_load_factor(2);
364         swap(c1, c2);
365 
366         assert(c1.bucket_count() >= 11);
367         assert(c1.size() == 8);
368         assert(c1.find(10)->second == "ten");
369         assert(c1.find(20)->second == "twenty");
370         assert(c1.find(30)->second == "thirty");
371         assert(c1.find(40)->second == "forty");
372         assert(c1.find(50)->second == "fifty");
373         assert(c1.find(60)->second == "sixty");
374         assert(c1.find(70)->second == "seventy");
375         assert(c1.find(80)->second == "eighty");
376         assert(c1.hash_function() == Hash(2));
377         assert(c1.key_eq() == Compare(2));
378         assert(c1.get_allocator() == Alloc(2));
379         assert(std::distance(c1.begin(), c1.end()) == c1.size());
380         assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
381         assert(c1.max_load_factor() == 2);
382 
383         assert(c2.bucket_count() >= 7);
384         assert(c2.size() == 6);
385         assert(c2.find(1)->second == "one");
386         assert(next(c2.find(1))->second == "four");
387         assert(c2.find(2)->second == "two");
388         assert(next(c2.find(2))->second == "four");
389         assert(c2.find(3)->second == "three");
390         assert(c2.find(4)->second == "four");
391         assert(c2.hash_function() == Hash(1));
392         assert(c2.key_eq() == Compare(1));
393         assert(c2.get_allocator() == Alloc(1));
394         assert(std::distance(c2.begin(), c2.end()) == c2.size());
395         assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
396         assert(c2.max_load_factor() == 1);
397     }
398 #if __cplusplus >= 201103L
399     {
400         typedef test_hash<std::hash<int> > Hash;
401         typedef test_compare<std::equal_to<int> > Compare;
402         typedef min_allocator<std::pair<const int, std::string> > Alloc;
403         typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
404         typedef std::pair<int, std::string> P;
405         C c1(0, Hash(1), Compare(1), Alloc());
406         C c2(0, Hash(2), Compare(2), Alloc());
407         c2.max_load_factor(2);
408         swap(c1, c2);
409 
410         assert(c1.bucket_count() == 0);
411         assert(c1.size() == 0);
412         assert(c1.hash_function() == Hash(2));
413         assert(c1.key_eq() == Compare(2));
414         assert(c1.get_allocator() == Alloc());
415         assert(std::distance(c1.begin(), c1.end()) == c1.size());
416         assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
417         assert(c1.max_load_factor() == 2);
418 
419         assert(c2.bucket_count() == 0);
420         assert(c2.size() == 0);
421         assert(c2.hash_function() == Hash(1));
422         assert(c2.key_eq() == Compare(1));
423         assert(c2.get_allocator() == Alloc());
424         assert(std::distance(c2.begin(), c2.end()) == c2.size());
425         assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
426         assert(c2.max_load_factor() == 1);
427     }
428     {
429         typedef test_hash<std::hash<int> > Hash;
430         typedef test_compare<std::equal_to<int> > Compare;
431         typedef min_allocator<std::pair<const int, std::string> > Alloc;
432         typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
433         typedef std::pair<int, std::string> P;
434         P a2[] =
435         {
436             P(10, "ten"),
437             P(20, "twenty"),
438             P(30, "thirty"),
439             P(40, "forty"),
440             P(50, "fifty"),
441             P(60, "sixty"),
442             P(70, "seventy"),
443             P(80, "eighty"),
444         };
445         C c1(0, Hash(1), Compare(1), Alloc());
446         C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
447         c2.max_load_factor(2);
448         swap(c1, c2);
449 
450         assert(c1.bucket_count() >= 11);
451         assert(c1.size() == 8);
452         assert(c1.find(10)->second == "ten");
453         assert(c1.find(20)->second == "twenty");
454         assert(c1.find(30)->second == "thirty");
455         assert(c1.find(40)->second == "forty");
456         assert(c1.find(50)->second == "fifty");
457         assert(c1.find(60)->second == "sixty");
458         assert(c1.find(70)->second == "seventy");
459         assert(c1.find(80)->second == "eighty");
460         assert(c1.hash_function() == Hash(2));
461         assert(c1.key_eq() == Compare(2));
462         assert(c1.get_allocator() == Alloc());
463         assert(std::distance(c1.begin(), c1.end()) == c1.size());
464         assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
465         assert(c1.max_load_factor() == 2);
466 
467         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(std::distance(c2.begin(), c2.end()) == c2.size());
473         assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
474         assert(c2.max_load_factor() == 1);
475     }
476     {
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;
482         P a1[] =
483         {
484             P(1, "one"),
485             P(2, "two"),
486             P(3, "three"),
487             P(4, "four"),
488             P(1, "four"),
489             P(2, "four"),
490         };
491         C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
492         C c2(0, Hash(2), Compare(2), Alloc());
493         c2.max_load_factor(2);
494         swap(c1, c2);
495 
496         assert(c1.bucket_count() == 0);
497         assert(c1.size() == 0);
498         assert(c1.hash_function() == Hash(2));
499         assert(c1.key_eq() == Compare(2));
500         assert(c1.get_allocator() == Alloc());
501         assert(std::distance(c1.begin(), c1.end()) == c1.size());
502         assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
503         assert(c1.max_load_factor() == 2);
504 
505         assert(c2.bucket_count() >= 7);
506         assert(c2.size() == 6);
507         assert(c2.find(1)->second == "one");
508         assert(next(c2.find(1))->second == "four");
509         assert(c2.find(2)->second == "two");
510         assert(next(c2.find(2))->second == "four");
511         assert(c2.find(3)->second == "three");
512         assert(c2.find(4)->second == "four");
513         assert(c2.hash_function() == Hash(1));
514         assert(c2.key_eq() == Compare(1));
515         assert(c2.get_allocator() == Alloc());
516         assert(std::distance(c2.begin(), c2.end()) == c2.size());
517         assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
518         assert(c2.max_load_factor() == 1);
519     }
520     {
521         typedef test_hash<std::hash<int> > Hash;
522         typedef test_compare<std::equal_to<int> > Compare;
523         typedef min_allocator<std::pair<const int, std::string> > Alloc;
524         typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
525         typedef std::pair<int, std::string> P;
526         P a1[] =
527         {
528             P(1, "one"),
529             P(2, "two"),
530             P(3, "three"),
531             P(4, "four"),
532             P(1, "four"),
533             P(2, "four"),
534         };
535         P a2[] =
536         {
537             P(10, "ten"),
538             P(20, "twenty"),
539             P(30, "thirty"),
540             P(40, "forty"),
541             P(50, "fifty"),
542             P(60, "sixty"),
543             P(70, "seventy"),
544             P(80, "eighty"),
545         };
546         C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
547         C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
548         c2.max_load_factor(2);
549         swap(c1, c2);
550 
551         assert(c1.bucket_count() >= 11);
552         assert(c1.size() == 8);
553         assert(c1.find(10)->second == "ten");
554         assert(c1.find(20)->second == "twenty");
555         assert(c1.find(30)->second == "thirty");
556         assert(c1.find(40)->second == "forty");
557         assert(c1.find(50)->second == "fifty");
558         assert(c1.find(60)->second == "sixty");
559         assert(c1.find(70)->second == "seventy");
560         assert(c1.find(80)->second == "eighty");
561         assert(c1.hash_function() == Hash(2));
562         assert(c1.key_eq() == Compare(2));
563         assert(c1.get_allocator() == Alloc());
564         assert(std::distance(c1.begin(), c1.end()) == c1.size());
565         assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
566         assert(c1.max_load_factor() == 2);
567 
568         assert(c2.bucket_count() >= 7);
569         assert(c2.size() == 6);
570         assert(c2.find(1)->second == "one");
571         assert(next(c2.find(1))->second == "four");
572         assert(c2.find(2)->second == "two");
573         assert(next(c2.find(2))->second == "four");
574         assert(c2.find(3)->second == "three");
575         assert(c2.find(4)->second == "four");
576         assert(c2.hash_function() == Hash(1));
577         assert(c2.key_eq() == Compare(1));
578         assert(c2.get_allocator() == Alloc());
579         assert(std::distance(c2.begin(), c2.end()) == c2.size());
580         assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
581         assert(c2.max_load_factor() == 1);
582     }
583 #endif
584 }
585