aboutsummaryrefslogtreecommitdiff
path: root/test/std/containers/unord/unord.set/unord.set.cnstr
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/containers/unord/unord.set/unord.set.cnstr')
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp109
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp184
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp97
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp225
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp147
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp107
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp74
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp70
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp67
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp163
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp97
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp100
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp102
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp104
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp194
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp156
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp69
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp66
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp168
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp101
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp104
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp106
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp109
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size.fail.cpp45
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp65
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp69
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp71
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp73
28 files changed, 3042 insertions, 0 deletions
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
new file mode 100644
index 000000000000..30905aeb9fe2
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
@@ -0,0 +1,109 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// explicit unordered_set(const allocator_type& __a);
+
+#include <unordered_set>
+#include <cassert>
+
+#include "../../../NotConstructible.h"
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ test_allocator<NotConstructible>
+ > C;
+ C c(test_allocator<NotConstructible>(10));
+ assert(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == test_allocator<NotConstructible>(10));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(min_allocator<NotConstructible>{});
+ assert(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == min_allocator<NotConstructible>());
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef NotConstructible T;
+ typedef test_hash<std::hash<T>> HF;
+ typedef test_compare<std::equal_to<T>> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_set<T, HF, Comp, A> C;
+
+ A a(43);
+ C c(3, a);
+ assert(c.bucket_count() == 3);
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp ());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef NotConstructible T;
+ typedef test_hash<std::hash<T>> HF;
+ typedef test_compare<std::equal_to<T>> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_set<T, HF, Comp, A> C;
+
+ HF hf(42);
+ A a(43);
+ C c(4, hf, a);
+ assert(c.bucket_count() == 4);
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp ());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
new file mode 100644
index 000000000000..6925e3045412
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
@@ -0,0 +1,184 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set& operator=(const unordered_set& u);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A(10)
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A(4)
+ );
+ c = c0;
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A(4));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_set<int> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ C *p = &c;
+ c = *p;
+ assert(c.size() == 4);
+ assert(std::is_permutation(c.begin(), c.end(), a));
+ }
+ {
+ typedef other_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A(10)
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A(4)
+ );
+ c = c0;
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A()
+ );
+ c = c0;
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
new file mode 100644
index 000000000000..69d19a4dac2e
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set& operator=(initializer_list<value_type> il);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ C c = {
+ P(4),
+ P(1),
+ P(2)
+ };
+ c = {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ C c = {
+ P(4),
+ P(1),
+ P(2)
+ };
+ c = {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
new file mode 100644
index 000000000000..e8712b7431c4
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
@@ -0,0 +1,225 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set& operator=(unordered_set&& u);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A(10)
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A(4)
+ );
+ c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A(4));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A(10)
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A(10)
+ );
+ c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef other_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A(10)
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A(4)
+ );
+ c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A()
+ );
+ c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+#if _LIBCPP_DEBUG >= 1
+ {
+ std::unordered_set<int> s1 = {1, 2, 3};
+ std::unordered_set<int>::iterator i = s1.begin();
+ int k = *i;
+ std::unordered_set<int> s2;
+ s2 = std::move(s1);
+ assert(*i == k);
+ s2.erase(i);
+ assert(s2.size() == 2);
+ }
+#endif
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
new file mode 100644
index 000000000000..ee05acd6be90
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
@@ -0,0 +1,147 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set(const unordered_set& u);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ test_allocator<int>(10)
+ );
+ C c = c0;
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ other_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ other_allocator<int>(10)
+ );
+ C c = c0;
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == other_allocator<int>(-2));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ C c = c0;
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
new file mode 100644
index 000000000000..8e1ecd8167f2
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
@@ -0,0 +1,107 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set(const unordered_set& u, const allocator_type& a);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ test_allocator<int>(10)
+ );
+ C c(c0, test_allocator<int>(5));
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == test_allocator<int>(5));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ C c(c0, min_allocator<int>());
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
new file mode 100644
index 000000000000..6efa9ed8d1de
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set();
+
+#include <unordered_set>
+#include <cassert>
+
+#include "../../../NotConstructible.h"
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ test_allocator<NotConstructible>
+ > C;
+ C c;
+ assert(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c;
+ assert(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ std::unordered_set<int> c = {};
+ assert(c.bucket_count() == 0);
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp
new file mode 100644
index 000000000000..f419c31c4796
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// unordered_set()
+// noexcept(
+// is_nothrow_default_constructible<allocator_type>::value &&
+// is_nothrow_default_constructible<key_compare>::value &&
+// is_nothrow_copy_constructible<key_compare>::value);
+
+// This tests a conforming extension
+
+#include <unordered_set>
+#include <cassert>
+
+#include "MoveOnly.h"
+#include "test_allocator.h"
+#include "../../../test_hash.h"
+
+template <class T>
+struct some_comp
+{
+ typedef T value_type;
+ some_comp();
+ some_comp(const some_comp&);
+};
+
+template <class T>
+struct some_hash
+{
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::unordered_set<MoveOnly> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_default_constructible<C>::value, "");
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp
new file mode 100644
index 000000000000..1e196b2e119e
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// ~unordered_set() // implied noexcept;
+
+#include <unordered_set>
+#include <cassert>
+
+#include "MoveOnly.h"
+#include "test_allocator.h"
+
+#if __has_feature(cxx_noexcept)
+
+template <class T>
+struct some_comp
+{
+ typedef T value_type;
+ ~some_comp() noexcept(false);
+};
+
+template <class T>
+struct some_hash
+{
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+ ~some_hash() noexcept(false);
+};
+
+#endif
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::unordered_set<MoveOnly> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_destructible<C>::value, "");
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
new file mode 100644
index 000000000000..2c31d575b635
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
@@ -0,0 +1,163 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set(initializer_list<value_type> il);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ C c = {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c = {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef int T;
+ typedef test_hash<std::hash<T>> HF;
+ typedef test_compare<std::equal_to<T>> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_set<T, HF, Comp, A> C;
+
+ A a(42);
+ C c({
+ T(1),
+ T(2),
+ T(3),
+ T(4),
+ T(1),
+ T(2)
+ }, 12, a);
+
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef int T;
+ typedef test_hash<std::hash<T>> HF;
+ typedef test_compare<std::equal_to<T>> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_set<T, HF, Comp, A> C;
+
+ A a(42);
+ HF hf(43);
+ C c({
+ T(1),
+ T(2),
+ T(3),
+ T(4),
+ T(1),
+ T(2)
+ }, 12, hf, a);
+
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+#endif
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
new file mode 100644
index 000000000000..36dab799c789
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set(initializer_list<value_type> il, size_type n);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
new file mode 100644
index 000000000000..81af2b41bae2
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
@@ -0,0 +1,100 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set(initializer_list<value_type> il, size_type n,
+// const hasher& hf);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7,
+ test_hash<std::hash<int> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7,
+ test_hash<std::hash<int> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
new file mode 100644
index 000000000000..f35dd1afa876
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
@@ -0,0 +1,102 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set(initializer_list<value_type> il, size_type n,
+// const hasher& hf, const key_equal& eql);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
new file mode 100644
index 000000000000..34ff62ea77b5
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set(initializer_list<value_type> il, size_type n,
+// const hasher& hf, const key_equal& eql, const allocator_type& a);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ test_allocator<int>(10)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
new file mode 100644
index 000000000000..6bda4afc99cf
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
@@ -0,0 +1,194 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set(unordered_set&& u);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ test_allocator<int>(10)
+ );
+ C c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ test_allocator<int>(10)
+ );
+ C c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ C c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ C c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+#endif
+#if _LIBCPP_DEBUG >= 1
+ {
+ std::unordered_set<int> s1 = {1, 2, 3};
+ std::unordered_set<int>::iterator i = s1.begin();
+ int k = *i;
+ std::unordered_set<int> s2 = std::move(s1);
+ assert(*i == k);
+ s2.erase(i);
+ assert(s2.size() == 2);
+ }
+#endif
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
new file mode 100644
index 000000000000..229e79925f23
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
@@ -0,0 +1,156 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set(unordered_set&& u, const allocator_type& a);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef int P;
+ typedef test_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A(10)
+ );
+ C c(std::move(c0), A(12));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A(12));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+ {
+ typedef int P;
+ typedef test_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A(10)
+ );
+ C c(std::move(c0), A(10));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A(10));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int P;
+ typedef min_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(std::move(c0), A());
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+#endif
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp
new file mode 100644
index 000000000000..02af34d8f885
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// unordered_set& operator=(unordered_set&& c)
+// noexcept(
+// allocator_type::propagate_on_container_move_assignment::value &&
+// is_nothrow_move_assignable<allocator_type>::value &&
+// is_nothrow_move_assignable<key_compare>::value);
+
+// This tests a conforming extension
+
+#include <unordered_set>
+#include <cassert>
+
+#include "MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_comp
+{
+ typedef T value_type;
+ some_comp& operator=(const some_comp&);
+};
+
+template <class T>
+struct some_hash
+{
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+ some_hash& operator=(const some_hash&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::unordered_set<MoveOnly> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp
new file mode 100644
index 000000000000..b2d89ba5c33b
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// unordered_set(unordered_set&&)
+// noexcept(is_nothrow_move_constructible<allocator_type>::value &&
+// is_nothrow_move_constructible<key_compare>::value);
+
+// This tests a conforming extension
+
+#include <unordered_set>
+#include <cassert>
+
+#include "MoveOnly.h"
+#include "test_allocator.h"
+
+template <class T>
+struct some_comp
+{
+ typedef T value_type;
+ some_comp(const some_comp&);
+};
+
+template <class T>
+struct some_hash
+{
+ typedef T value_type;
+ some_hash();
+ some_hash(const some_hash&);
+};
+
+int main()
+{
+#if __has_feature(cxx_noexcept)
+ {
+ typedef std::unordered_set<MoveOnly> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ some_comp<MoveOnly>> C;
+ static_assert(!std::is_nothrow_move_constructible<C>::value, "");
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
new file mode 100644
index 000000000000..40f3f4f4d7f9
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
@@ -0,0 +1,168 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// template <class InputIterator>
+// unordered_set(InputIterator first, InputIterator last);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "test_iterators.h"
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef int T;
+ typedef test_hash<std::hash<T>> HF;
+ typedef test_compare<std::equal_to<T>> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_set<T, HF, Comp, A> C;
+ T arr[] =
+ {
+ T(1),
+ T(2),
+ T(3),
+ T(4),
+ T(1),
+ T(2)
+ };
+ A a(42);
+ C c(input_iterator<T*>(arr), input_iterator<T*>(arr + sizeof(arr)/sizeof(arr[0])), 12, a);
+ assert(c.bucket_count() >= 12);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == HF());
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef int T;
+ typedef test_hash<std::hash<T>> HF;
+ typedef test_compare<std::equal_to<T>> Comp;
+ typedef test_allocator<T> A;
+ typedef std::unordered_set<T, HF, Comp, A> C;
+ T arr[] =
+ {
+ T(1),
+ T(2),
+ T(3),
+ T(4),
+ T(1),
+ T(2)
+ };
+ HF hf(43);
+ A a(42);
+ C c(input_iterator<T*>(arr), input_iterator<T*>(arr + sizeof(arr)/sizeof(arr[0])), 16, hf, a);
+ assert(c.bucket_count() >= 16);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == hf);
+ assert(!(c.hash_function() == HF()));
+ assert(c.key_eq() == Comp());
+ assert(c.get_allocator() == a);
+ assert(!(c.get_allocator() == A()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+
+#endif
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp
new file mode 100644
index 000000000000..179f73d7e184
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// template <class InputIterator>
+// unordered_set(InputIterator first, InputIterator last, size_type n);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "test_iterators.h"
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp
new file mode 100644
index 000000000000..60350de962c7
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// template <class InputIterator>
+// unordered_set(InputIterator first, InputIterator last, size_type n,
+// const hasher& hf);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "test_iterators.h"
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp
new file mode 100644
index 000000000000..70e82d034647
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp
@@ -0,0 +1,106 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// template <class InputIterator>
+// unordered_set(InputIterator first, InputIterator last, size_type n,
+// const hasher& hf, const key_equal& eql);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "test_iterators.h"
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == test_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp
new file mode 100644
index 000000000000..a6fb2e667ae1
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp
@@ -0,0 +1,109 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// template <class InputIterator>
+// unordered_set(InputIterator first, InputIterator last, size_type n,
+// const hasher& hf, const key_equal& eql,
+// const allocator_type& a);
+
+#include <unordered_set>
+#include <cassert>
+#include <cfloat>
+
+#include "test_iterators.h"
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ test_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ test_allocator<int>(10)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == test_allocator<int>(10));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size.fail.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size.fail.cpp
new file mode 100644
index 000000000000..389c54c58cde
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size.fail.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// explicit unordered_set(size_type n);
+
+#include <unordered_set>
+#include <cassert>
+
+#include "../../../NotConstructible.h"
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ test_allocator<NotConstructible>
+ > C;
+ C c = 7;
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
new file mode 100644
index 000000000000..8f6228ad8ec4
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// explicit unordered_set(size_type n);
+
+#include <unordered_set>
+#include <cassert>
+
+#include "../../../NotConstructible.h"
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ test_allocator<NotConstructible>
+ > C;
+ C c(7);
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(7);
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
new file mode 100644
index 000000000000..4c2c18edd1ce
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set(size_type n, const hasher& hf);
+
+#include <unordered_set>
+#include <cassert>
+
+#include "../../../NotConstructible.h"
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ test_allocator<NotConstructible>
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
new file mode 100644
index 000000000000..e9368782ad9a
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set(size_type n, const hasher& hf, const key_equal& eql);
+
+#include <unordered_set>
+#include <cassert>
+
+#include "../../../NotConstructible.h"
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ test_allocator<NotConstructible>
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8),
+ test_compare<std::equal_to<NotConstructible> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
+ assert(c.get_allocator() == (test_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8),
+ test_compare<std::equal_to<NotConstructible> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
new file mode 100644
index 000000000000..96233e187af5
--- /dev/null
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
+// class Alloc = allocator<Value>>
+// class unordered_set
+
+// unordered_set(size_type n, const hasher& hf, const key_equal& eql, const allocator_type& a);
+
+#include <unordered_set>
+#include <cassert>
+
+#include "../../../NotConstructible.h"
+#include "../../../test_compare.h"
+#include "../../../test_hash.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ test_allocator<NotConstructible>
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8),
+ test_compare<std::equal_to<NotConstructible> >(9),
+ test_allocator<NotConstructible>(10)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
+ assert(c.get_allocator() == (test_allocator<NotConstructible>(10)));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8),
+ test_compare<std::equal_to<NotConstructible> >(9),
+ min_allocator<NotConstructible>()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
+}