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 // unordered_multimap();
17 #include <unordered_map>
20 #include "test_macros.h"
21 #include "../../../NotConstructible.h"
22 #include "../../../test_compare.h"
23 #include "../../../test_hash.h"
24 #include "test_allocator.h"
25 #include "min_allocator.h"
30 typedef std::unordered_multimap
<NotConstructible
, NotConstructible
,
31 test_hash
<NotConstructible
>,
32 test_equal_to
<NotConstructible
>,
33 test_allocator
<std::pair
<const NotConstructible
,
37 LIBCPP_ASSERT(c
.bucket_count() == 0);
38 assert(c
.hash_function() == test_hash
<NotConstructible
>());
39 assert(c
.key_eq() == test_equal_to
<NotConstructible
>());
40 assert(c
.get_allocator() ==
41 (test_allocator
<std::pair
<const NotConstructible
, NotConstructible
> >()));
42 assert(c
.size() == 0);
44 assert(std::distance(c
.begin(), c
.end()) == 0);
45 assert(c
.load_factor() == 0);
46 assert(c
.max_load_factor() == 1);
48 #if TEST_STD_VER >= 11
50 typedef std::unordered_multimap
<NotConstructible
, NotConstructible
,
51 test_hash
<NotConstructible
>,
52 test_equal_to
<NotConstructible
>,
53 min_allocator
<std::pair
<const NotConstructible
,
57 LIBCPP_ASSERT(c
.bucket_count() == 0);
58 assert(c
.hash_function() == test_hash
<NotConstructible
>());
59 assert(c
.key_eq() == test_equal_to
<NotConstructible
>());
60 assert(c
.get_allocator() ==
61 (min_allocator
<std::pair
<const NotConstructible
, NotConstructible
> >()));
62 assert(c
.size() == 0);
64 assert(std::distance(c
.begin(), c
.end()) == 0);
65 assert(c
.load_factor() == 0);
66 assert(c
.max_load_factor() == 1);
69 typedef explicit_allocator
<std::pair
<const NotConstructible
, NotConstructible
>> A
;
70 typedef std::unordered_multimap
<NotConstructible
, NotConstructible
,
71 test_hash
<NotConstructible
>,
72 test_equal_to
<NotConstructible
>,
77 LIBCPP_ASSERT(c
.bucket_count() == 0);
78 assert(c
.hash_function() == test_hash
<NotConstructible
>());
79 assert(c
.key_eq() == test_equal_to
<NotConstructible
>());
80 assert(c
.get_allocator() == A());
81 assert(c
.size() == 0);
83 assert(std::distance(c
.begin(), c
.end()) == 0);
84 assert(c
.load_factor() == 0);
85 assert(c
.max_load_factor() == 1);
90 LIBCPP_ASSERT(c
.bucket_count() == 0);
91 assert(c
.hash_function() == test_hash
<NotConstructible
>());
92 assert(c
.key_eq() == test_equal_to
<NotConstructible
>());
93 assert(c
.get_allocator() == a
);
94 assert(c
.size() == 0);
96 assert(std::distance(c
.begin(), c
.end()) == 0);
97 assert(c
.load_factor() == 0);
98 assert(c
.max_load_factor() == 1);
102 std::unordered_multimap
<int, int> c
= {};
103 LIBCPP_ASSERT(c
.bucket_count() == 0);
104 assert(c
.size() == 0);
106 assert(std::distance(c
.begin(), c
.end()) == 0);
107 assert(c
.load_factor() == 0);
108 assert(c
.max_load_factor() == 1);