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