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_set>
11 
12 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
13 //           class Alloc = allocator<Value>>
14 // class unordered_multiset
15 
16 // unordered_multiset(size_type n, const hasher& hf, const key_equal& eql);
17 
18 #include <unordered_set>
19 #include <cassert>
20 
21 #include "../../../NotConstructible.h"
22 #include "../../../test_compare.h"
23 #include "../../../test_hash.h"
24 #include "../../../test_allocator.h"
25 #include "../../../min_allocator.h"
26 
27 int main()
28 {
29     {
30         typedef std::unordered_multiset<NotConstructible,
31                                    test_hash<std::hash<NotConstructible> >,
32                                    test_compare<std::equal_to<NotConstructible> >,
33                                    test_allocator<NotConstructible>
34                                    > C;
35         C c(7,
36             test_hash<std::hash<NotConstructible> >(8),
37             test_compare<std::equal_to<NotConstructible> >(9)
38            );
39         assert(c.bucket_count() == 7);
40         assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
41         assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
42         assert(c.get_allocator() == (test_allocator<NotConstructible>()));
43         assert(c.size() == 0);
44         assert(c.empty());
45         assert(std::distance(c.begin(), c.end()) == 0);
46         assert(c.load_factor() == 0);
47         assert(c.max_load_factor() == 1);
48     }
49 #if __cplusplus >= 201103L
50     {
51         typedef std::unordered_multiset<NotConstructible,
52                                    test_hash<std::hash<NotConstructible> >,
53                                    test_compare<std::equal_to<NotConstructible> >,
54                                    min_allocator<NotConstructible>
55                                    > C;
56         C c(7,
57             test_hash<std::hash<NotConstructible> >(8),
58             test_compare<std::equal_to<NotConstructible> >(9)
59            );
60         assert(c.bucket_count() == 7);
61         assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
62         assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
63         assert(c.get_allocator() == (min_allocator<NotConstructible>()));
64         assert(c.size() == 0);
65         assert(c.empty());
66         assert(std::distance(c.begin(), c.end()) == 0);
67         assert(c.load_factor() == 0);
68         assert(c.max_load_factor() == 1);
69     }
70 #endif
71 }
72