summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2013-07-23 22:01:58 +0000
committerHoward Hinnant <hhinnant@apple.com>2013-07-23 22:01:58 +0000
commitb24c802489d71605f8a293a9979fb8bbc1f52214 (patch)
treec3f61a6704ead322cf075552eff6c3aa4f1fbeab /libcxx/test
parentfc6b7a0e8a42370525852e47089b920ebd59cc32 (diff)
downloadbcm5719-llvm-b24c802489d71605f8a293a9979fb8bbc1f52214.tar.gz
bcm5719-llvm-b24c802489d71605f8a293a9979fb8bbc1f52214.zip
Debug mode for unordered_set. I believe this to be fairly complete for
unordered_set, however it is not complete yet for unordered_multiset, unordered_map or unordered_multimap. There has been a lot of work done for these other three containers, however that work was done just to keep all of the tests passing. You can try this out with -D_LIBCPP_DEBUG2. You will have to link to a libc++.dylib that has been compiled with src/debug.cpp. So far, vector (but not vector<bool>), list, and unordered_set are treated. I hope to get the other three unordered containers up fairly quickly now that unordered_set is done. The flag _LIBCPP_DEBUG2 will eventually be changed to _LIBCPP_DEBUG, but not today. This is my second effort at getting debug mode going for libc++, and I'm not quite yet ready to throw all of the work under the first attempt away. The basic design is that all of the debug information is kept in a central database, instead of in the containers. This has been done as an attempt to have debug mode and non-debug mode be ABI compatible with each other. There are some circumstances where if you construct a container in an environment without debug mode and pass it into debug mode, the checking will get confused and let you know with a readable error message. Passing containers the other way: from debug mode out to a non-debugging mode container should be 100% safe (at least that is the goal). llvm-svn: 186991
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/containers/sequences/list/list.cons/move.pass.cpp9
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp4
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp4
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp4
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp4
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp4
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp4
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp4
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp4
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp4
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp4
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp12
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp16
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp4
-rw-r--r--libcxx/test/containers/unord/unord.multiset/emplace_hint.pass.cpp4
-rw-r--r--libcxx/test/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp12
-rw-r--r--libcxx/test/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp16
-rw-r--r--libcxx/test/containers/unord/unord.set/db_iterators_1.pass.cpp54
-rw-r--r--libcxx/test/containers/unord/unord.set/db_iterators_7.pass.cpp58
-rw-r--r--libcxx/test/containers/unord/unord.set/db_iterators_8.pass.cpp54
-rw-r--r--libcxx/test/containers/unord/unord.set/db_local_iterators_1.pass.cpp43
-rw-r--r--libcxx/test/containers/unord/unord.set/db_local_iterators_7.pass.cpp57
-rw-r--r--libcxx/test/containers/unord/unord.set/db_local_iterators_8.pass.cpp54
-rw-r--r--libcxx/test/containers/unord/unord.set/emplace_hint.pass.cpp14
-rw-r--r--libcxx/test/containers/unord/unord.set/erase_iter_db1.pass.cpp38
-rw-r--r--libcxx/test/containers/unord/unord.set/erase_iter_db2.pass.cpp41
-rw-r--r--libcxx/test/containers/unord/unord.set/erase_iter_iter_db1.pass.cpp40
-rw-r--r--libcxx/test/containers/unord/unord.set/erase_iter_iter_db2.pass.cpp40
-rw-r--r--libcxx/test/containers/unord/unord.set/erase_iter_iter_db3.pass.cpp40
-rw-r--r--libcxx/test/containers/unord/unord.set/erase_iter_iter_db4.pass.cpp39
-rw-r--r--libcxx/test/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp17
-rw-r--r--libcxx/test/containers/unord/unord.set/insert_hint_rvalue.pass.cpp16
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp12
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp11
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.swap/db_swap_1.pass.cpp43
35 files changed, 732 insertions, 52 deletions
diff --git a/libcxx/test/containers/sequences/list/list.cons/move.pass.cpp b/libcxx/test/containers/sequences/list/list.cons/move.pass.cpp
index 3754202589a..2811a3e7997 100644
--- a/libcxx/test/containers/sequences/list/list.cons/move.pass.cpp
+++ b/libcxx/test/containers/sequences/list/list.cons/move.pass.cpp
@@ -61,5 +61,14 @@ int main()
assert(l2.get_allocator() == lo.get_allocator());
}
#endif
+#if _LIBCPP_DEBUG2 >= 1
+ {
+ std::list<int> l1 = {1, 2, 3};
+ std::list<int>::iterator i = l1.begin();
+ std::list<int> l2 = std::move(l1);
+ assert(*l2.erase(i) == 2);
+ assert(l2.size() == 2);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp
index 7f426fdb497..ebf8e1374ae 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp
@@ -49,12 +49,12 @@ int main()
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
{
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
index e605b66e4ab..5d2e4c4ac24 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
@@ -46,12 +46,12 @@ int main()
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
}
{
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp
index 758a7868871..27174b3288f 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp
@@ -48,12 +48,12 @@ int main()
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
}
{
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp
index 952c478b1ba..3a97097a155 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp
@@ -45,12 +45,12 @@ int main()
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
{
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
index 3786f18f579..579b6d5505e 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
@@ -48,13 +48,13 @@ int main()
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp
index cbf7a0da98c..cc8bb72198a 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp
@@ -49,12 +49,12 @@ int main()
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(std::is_nothrow_default_constructible<C>::value, "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
{
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
index 2833f7e8a04..f6c8551b8e1 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
@@ -46,12 +46,12 @@ int main()
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
}
{
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp
index d53c5cdb81c..ee69b33ae92 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp
@@ -48,12 +48,12 @@ int main()
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
}
{
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp
index b6e7c4de344..7eb5f320148 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp
@@ -45,12 +45,12 @@ int main()
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
{
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
index bad1ee28f22..0c3aff61467 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
@@ -36,7 +36,7 @@ int main()
assert(r->first == 3);
assert(r->second == Emplaceable());
- r = c.emplace_hint(e, std::pair<const int, Emplaceable>(3, Emplaceable(5, 6)));
+ r = c.emplace_hint(c.end(), std::pair<const int, Emplaceable>(3, Emplaceable(5, 6)));
assert(c.size() == 2);
assert(r->first == 3);
assert(r->second == Emplaceable(5, 6));
@@ -68,7 +68,7 @@ int main()
assert(r->first == 3);
assert(r->second == Emplaceable());
- r = c.emplace_hint(e, std::pair<const int, Emplaceable>(3, Emplaceable(5, 6)));
+ r = c.emplace_hint(c.end(), std::pair<const int, Emplaceable>(3, Emplaceable(5, 6)));
assert(c.size() == 2);
assert(r->first == 3);
assert(r->second == Emplaceable(5, 6));
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp
index 9e3f1280be3..e5d5b536227 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp
@@ -33,17 +33,17 @@ int main()
assert(r->first == 3.5);
assert(r->second == 3);
- r = c.insert(e, P(3.5, 4));
+ r = c.insert(c.end(), P(3.5, 4));
assert(c.size() == 2);
assert(r->first == 3.5);
assert(r->second == 4);
- r = c.insert(e, P(4.5, 4));
+ r = c.insert(c.end(), P(4.5, 4));
assert(c.size() == 3);
assert(r->first == 4.5);
assert(r->second == 4);
- r = c.insert(e, P(5.5, 4));
+ r = c.insert(c.end(), P(5.5, 4));
assert(c.size() == 4);
assert(r->first == 5.5);
assert(r->second == 4);
@@ -61,17 +61,17 @@ int main()
assert(r->first == 3.5);
assert(r->second == 3);
- r = c.insert(e, P(3.5, 4));
+ r = c.insert(c.end(), P(3.5, 4));
assert(c.size() == 2);
assert(r->first == 3.5);
assert(r->second == 4);
- r = c.insert(e, P(4.5, 4));
+ r = c.insert(c.end(), P(4.5, 4));
assert(c.size() == 3);
assert(r->first == 4.5);
assert(r->second == 4);
- r = c.insert(e, P(5.5, 4));
+ r = c.insert(c.end(), P(5.5, 4));
assert(c.size() == 4);
assert(r->first == 5.5);
assert(r->second == 4);
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
index c8dd38d56ad..7be2811e1c2 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
@@ -41,12 +41,12 @@ int main()
assert(r->first == 3.5);
assert(r->second == 4);
- r = c.insert(e, P(4.5, 4));
+ r = c.insert(c.end(), P(4.5, 4));
assert(c.size() == 3);
assert(r->first == 4.5);
assert(r->second == 4);
- r = c.insert(e, P(5.5, 4));
+ r = c.insert(c.end(), P(5.5, 4));
assert(c.size() == 4);
assert(r->first == 5.5);
assert(r->second == 4);
@@ -68,12 +68,12 @@ int main()
assert(r->first == 3);
assert(r->second == 4);
- r = c.insert(e, P(4, 4));
+ r = c.insert(c.end(), P(4, 4));
assert(c.size() == 3);
assert(r->first == 4);
assert(r->second == 4);
- r = c.insert(e, P(5, 4));
+ r = c.insert(c.end(), P(5, 4));
assert(c.size() == 4);
assert(r->first == 5);
assert(r->second == 4);
@@ -97,12 +97,12 @@ int main()
assert(r->first == 3.5);
assert(r->second == 4);
- r = c.insert(e, P(4.5, 4));
+ r = c.insert(c.end(), P(4.5, 4));
assert(c.size() == 3);
assert(r->first == 4.5);
assert(r->second == 4);
- r = c.insert(e, P(5.5, 4));
+ r = c.insert(c.end(), P(5.5, 4));
assert(c.size() == 4);
assert(r->first == 5.5);
assert(r->second == 4);
@@ -125,12 +125,12 @@ int main()
assert(r->first == 3);
assert(r->second == 4);
- r = c.insert(e, P(4, 4));
+ r = c.insert(c.end(), P(4, 4));
assert(c.size() == 3);
assert(r->first == 4);
assert(r->second == 4);
- r = c.insert(e, P(5, 4));
+ r = c.insert(c.end(), P(5, 4));
assert(c.size() == 4);
assert(r->first == 5);
assert(r->second == 4);
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
index 2560919b197..227a700fe18 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
@@ -48,13 +48,13 @@ int main()
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
+ std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
diff --git a/libcxx/test/containers/unord/unord.multiset/emplace_hint.pass.cpp b/libcxx/test/containers/unord/unord.multiset/emplace_hint.pass.cpp
index 25a3b7591cd..aff6ba7ccaf 100644
--- a/libcxx/test/containers/unord/unord.multiset/emplace_hint.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/emplace_hint.pass.cpp
@@ -34,7 +34,7 @@ int main()
assert(c.size() == 1);
assert(*r == Emplaceable());
- r = c.emplace_hint(e, Emplaceable(5, 6));
+ r = c.emplace_hint(c.end(), Emplaceable(5, 6));
assert(c.size() == 2);
assert(*r == Emplaceable(5, 6));
@@ -53,7 +53,7 @@ int main()
assert(c.size() == 1);
assert(*r == Emplaceable());
- r = c.emplace_hint(e, Emplaceable(5, 6));
+ r = c.emplace_hint(c.end(), Emplaceable(5, 6));
assert(c.size() == 2);
assert(*r == Emplaceable(5, 6));
diff --git a/libcxx/test/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp b/libcxx/test/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp
index 02b8375f7fe..b15a5f09163 100644
--- a/libcxx/test/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp
@@ -32,15 +32,15 @@ int main()
assert(c.size() == 1);
assert(*r == 3.5);
- r = c.insert(e, P(3.5));
+ r = c.insert(c.end(), P(3.5));
assert(c.size() == 2);
assert(*r == 3.5);
- r = c.insert(e, P(4.5));
+ r = c.insert(c.end(), P(4.5));
assert(c.size() == 3);
assert(*r == 4.5);
- r = c.insert(e, P(5.5));
+ r = c.insert(c.end(), P(5.5));
assert(c.size() == 4);
assert(*r == 5.5);
}
@@ -56,15 +56,15 @@ int main()
assert(c.size() == 1);
assert(*r == 3.5);
- r = c.insert(e, P(3.5));
+ r = c.insert(c.end(), P(3.5));
assert(c.size() == 2);
assert(*r == 3.5);
- r = c.insert(e, P(4.5));
+ r = c.insert(c.end(), P(4.5));
assert(c.size() == 3);
assert(*r == 4.5);
- r = c.insert(e, P(5.5));
+ r = c.insert(c.end(), P(5.5));
assert(c.size() == 4);
assert(*r == 5.5);
}
diff --git a/libcxx/test/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp b/libcxx/test/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp
index 590baa05782..019bd077abb 100644
--- a/libcxx/test/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp
@@ -37,11 +37,11 @@ int main()
assert(c.size() == 2);
assert(*r == 3.5);
- r = c.insert(e, P(4.5));
+ r = c.insert(c.end(), P(4.5));
assert(c.size() == 3);
assert(*r == 4.5);
- r = c.insert(e, P(5.5));
+ r = c.insert(c.end(), P(5.5));
assert(c.size() == 4);
assert(*r == 5.5);
}
@@ -60,11 +60,11 @@ int main()
assert(c.size() == 2);
assert(*r == 3);
- r = c.insert(e, P(4));
+ r = c.insert(c.end(), P(4));
assert(c.size() == 3);
assert(*r == 4);
- r = c.insert(e, P(5));
+ r = c.insert(c.end(), P(5));
assert(c.size() == 4);
assert(*r == 5);
}
@@ -85,11 +85,11 @@ int main()
assert(c.size() == 2);
assert(*r == 3.5);
- r = c.insert(e, P(4.5));
+ r = c.insert(c.end(), P(4.5));
assert(c.size() == 3);
assert(*r == 4.5);
- r = c.insert(e, P(5.5));
+ r = c.insert(c.end(), P(5.5));
assert(c.size() == 4);
assert(*r == 5.5);
}
@@ -109,11 +109,11 @@ int main()
assert(c.size() == 2);
assert(*r == 3);
- r = c.insert(e, P(4));
+ r = c.insert(c.end(), P(4));
assert(c.size() == 3);
assert(*r == 4);
- r = c.insert(e, P(5));
+ r = c.insert(c.end(), P(5));
assert(c.size() == 4);
assert(*r == 5);
}
diff --git a/libcxx/test/containers/unord/unord.set/db_iterators_1.pass.cpp b/libcxx/test/containers/unord/unord.set/db_iterators_1.pass.cpp
new file mode 100644
index 00000000000..2835c010830
--- /dev/null
+++ b/libcxx/test/containers/unord/unord.set/db_iterators_1.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Compare iterators from different containers with == or !=.
+
+#if _LIBCPP_DEBUG2 >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <unordered_set>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "../../min_allocator.h"
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::unordered_set<T> C;
+ C c1;
+ C c2;
+ bool b = c1.begin() != c2.begin();
+ assert(false);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::unordered_set<T, min_allocator<T>> C;
+ C c1;
+ C c2;
+ bool b = c1.begin() != c2.begin();
+ assert(false);
+ }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/libcxx/test/containers/unord/unord.set/db_iterators_7.pass.cpp b/libcxx/test/containers/unord/unord.set/db_iterators_7.pass.cpp
new file mode 100644
index 00000000000..978ee088399
--- /dev/null
+++ b/libcxx/test/containers/unord/unord.set/db_iterators_7.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Increment iterator past end.
+
+#if _LIBCPP_DEBUG2 >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <unordered_set>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "../../min_allocator.h"
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::unordered_set<T> C;
+ C c(1);
+ C::iterator i = c.begin();
+ ++i;
+ assert(i == c.end());
+ ++i;
+ assert(false);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::unordered_set<T, min_allocator<T>> C;
+ C c(1);
+ C::iterator i = c.begin();
+ ++i;
+ assert(i == c.end());
+ ++i;
+ assert(false);
+ }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/libcxx/test/containers/unord/unord.set/db_iterators_8.pass.cpp b/libcxx/test/containers/unord/unord.set/db_iterators_8.pass.cpp
new file mode 100644
index 00000000000..26411871fe2
--- /dev/null
+++ b/libcxx/test/containers/unord/unord.set/db_iterators_8.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Dereference non-dereferenceable iterator.
+
+#if _LIBCPP_DEBUG2 >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <unordered_set>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "../../min_allocator.h"
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::unordered_set<T> C;
+ C c(1);
+ C::iterator i = c.end();
+ T j = *i;
+ assert(false);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::unordered_set<T, min_allocator<T>> C;
+ C c(1);
+ C::iterator i = c.end();
+ T j = *i;
+ assert(false);
+ }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/libcxx/test/containers/unord/unord.set/db_local_iterators_1.pass.cpp b/libcxx/test/containers/unord/unord.set/db_local_iterators_1.pass.cpp
new file mode 100644
index 00000000000..f432471eae6
--- /dev/null
+++ b/libcxx/test/containers/unord/unord.set/db_local_iterators_1.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Compare local_iterators from different containers with == or !=.
+
+#if _LIBCPP_DEBUG2 >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <unordered_set>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::unordered_set<T> C;
+ C c1;
+ c1.insert(1);
+ C c2;
+ c2.insert(1);
+ C::local_iterator i = c1.begin(c1.bucket(1));
+ C::local_iterator j = c2.begin(c2.bucket(1));
+ assert(i != j);
+ assert(false);
+ }
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/libcxx/test/containers/unord/unord.set/db_local_iterators_7.pass.cpp b/libcxx/test/containers/unord/unord.set/db_local_iterators_7.pass.cpp
new file mode 100644
index 00000000000..87fdf1b2d7b
--- /dev/null
+++ b/libcxx/test/containers/unord/unord.set/db_local_iterators_7.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Increment local_iterator past end.
+
+#if _LIBCPP_DEBUG2 >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <unordered_set>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "../../min_allocator.h"
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::unordered_set<T> C;
+ C c(1);
+ C::local_iterator i = c.begin(0);
+ ++i;
+ ++i;
+ assert(false);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::unordered_set<T, min_allocator<T>> C;
+ C c(1);
+ C::local_iterator i = c.begin(0);
+ ++i;
+ ++i;
+ assert(false);
+ }
+#endif
+
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/libcxx/test/containers/unord/unord.set/db_local_iterators_8.pass.cpp b/libcxx/test/containers/unord/unord.set/db_local_iterators_8.pass.cpp
new file mode 100644
index 00000000000..33d7be053bf
--- /dev/null
+++ b/libcxx/test/containers/unord/unord.set/db_local_iterators_8.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Dereference non-dereferenceable iterator.
+
+#if _LIBCPP_DEBUG2 >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <unordered_set>
+#include <cassert>
+#include <iterator>
+#include <exception>
+#include <cstdlib>
+
+#include "../../min_allocator.h"
+
+int main()
+{
+ {
+ typedef int T;
+ typedef std::unordered_set<T> C;
+ C c(1);
+ C::local_iterator i = c.end(0);
+ T j = *i;
+ assert(false);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int T;
+ typedef std::unordered_set<T, min_allocator<T>> C;
+ C c(1);
+ C::local_iterator i = c.end(0);
+ T j = *i;
+ assert(false);
+ }
+#endif
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/libcxx/test/containers/unord/unord.set/emplace_hint.pass.cpp b/libcxx/test/containers/unord/unord.set/emplace_hint.pass.cpp
index de00ebeea0f..b988669c962 100644
--- a/libcxx/test/containers/unord/unord.set/emplace_hint.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/emplace_hint.pass.cpp
@@ -16,6 +16,10 @@
// template <class... Args>
// iterator emplace_hint(const_iterator p, Args&&... args);
+#if _LIBCPP_DEBUG2 >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
#include <unordered_set>
#include <cassert>
@@ -62,5 +66,15 @@ int main()
assert(*r == Emplaceable(5, 6));
}
#endif
+#if _LIBCPP_DEBUG2 >= 1
+ {
+ typedef std::unordered_set<Emplaceable> C;
+ typedef C::iterator R;
+ C c1;
+ C c2;
+ R r = c1.emplace_hint(c2.begin(), 5, 6);
+ assert(false);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.set/erase_iter_db1.pass.cpp b/libcxx/test/containers/unord/unord.set/erase_iter_db1.pass.cpp
new file mode 100644
index 00000000000..4cecf26df50
--- /dev/null
+++ b/libcxx/test/containers/unord/unord.set/erase_iter_db1.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Call erase(const_iterator position) with end()
+
+#if _LIBCPP_DEBUG2 >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <unordered_set>
+#include <cassert>
+
+int main()
+{
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_set<int> l1(a1, a1+3);
+ std::unordered_set<int>::const_iterator i = l1.end();
+ l1.erase(i);
+ assert(false);
+ }
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/libcxx/test/containers/unord/unord.set/erase_iter_db2.pass.cpp b/libcxx/test/containers/unord/unord.set/erase_iter_db2.pass.cpp
new file mode 100644
index 00000000000..0f6a102ecb5
--- /dev/null
+++ b/libcxx/test/containers/unord/unord.set/erase_iter_db2.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Call erase(const_iterator position) with iterator from another container
+
+#if _LIBCPP_DEBUG2 >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <unordered_set>
+#include <cassert>
+#include <cstdlib>
+#include <exception>
+
+int main()
+{
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_set<int> l1(a1, a1+3);
+ std::unordered_set<int> l2(a1, a1+3);
+ std::unordered_set<int>::const_iterator i = l2.begin();
+ l1.erase(i);
+ assert(false);
+ }
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/libcxx/test/containers/unord/unord.set/erase_iter_iter_db1.pass.cpp b/libcxx/test/containers/unord/unord.set/erase_iter_iter_db1.pass.cpp
new file mode 100644
index 00000000000..ce0eb0bbc45
--- /dev/null
+++ b/libcxx/test/containers/unord/unord.set/erase_iter_iter_db1.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Call erase(const_iterator first, const_iterator last); with first iterator from another container
+
+#if _LIBCPP_DEBUG2 >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <unordered_set>
+#include <cassert>
+#include <exception>
+#include <cstdlib>
+
+int main()
+{
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_set<int> l1(a1, a1+3);
+ std::unordered_set<int> l2(a1, a1+3);
+ std::unordered_set<int>::iterator i = l1.erase(l2.cbegin(), next(l1.cbegin()));
+ assert(false);
+ }
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/libcxx/test/containers/unord/unord.set/erase_iter_iter_db2.pass.cpp b/libcxx/test/containers/unord/unord.set/erase_iter_iter_db2.pass.cpp
new file mode 100644
index 00000000000..6b06bb4194c
--- /dev/null
+++ b/libcxx/test/containers/unord/unord.set/erase_iter_iter_db2.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Call erase(const_iterator first, const_iterator last); with second iterator from another container
+
+#if _LIBCPP_DEBUG2 >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <unordered_set>
+#include <cassert>
+#include <exception>
+#include <cstdlib>
+
+int main()
+{
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_set<int> l1(a1, a1+3);
+ std::unordered_set<int> l2(a1, a1+3);
+ std::unordered_set<int>::iterator i = l1.erase(l1.cbegin(), next(l2.cbegin()));
+ assert(false);
+ }
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/libcxx/test/containers/unord/unord.set/erase_iter_iter_db3.pass.cpp b/libcxx/test/containers/unord/unord.set/erase_iter_iter_db3.pass.cpp
new file mode 100644
index 00000000000..33902f10003
--- /dev/null
+++ b/libcxx/test/containers/unord/unord.set/erase_iter_iter_db3.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Call erase(const_iterator first, const_iterator last); with both iterators from another container
+
+#if _LIBCPP_DEBUG2 >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <unordered_set>
+#include <cassert>
+#include <exception>
+#include <cstdlib>
+
+int main()
+{
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_set<int> l1(a1, a1+3);
+ std::unordered_set<int> l2(a1, a1+3);
+ std::unordered_set<int>::iterator i = l1.erase(l2.cbegin(), next(l2.cbegin()));
+ assert(false);
+ }
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/libcxx/test/containers/unord/unord.set/erase_iter_iter_db4.pass.cpp b/libcxx/test/containers/unord/unord.set/erase_iter_iter_db4.pass.cpp
new file mode 100644
index 00000000000..79fc846c044
--- /dev/null
+++ b/libcxx/test/containers/unord/unord.set/erase_iter_iter_db4.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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>
+
+// Call erase(const_iterator first, const_iterator last); with a bad range
+
+#if _LIBCPP_DEBUG2 >= 1
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <unordered_set>
+#include <cassert>
+#include <exception>
+#include <cstdlib>
+
+int main()
+{
+ {
+ int a1[] = {1, 2, 3};
+ std::unordered_set<int> l1(a1, a1+3);
+ std::unordered_set<int>::iterator i = l1.erase(next(l1.cbegin()), l1.cbegin());
+ assert(false);
+ }
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/libcxx/test/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp b/libcxx/test/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp
index cbc212aacad..46c32fa2e92 100644
--- a/libcxx/test/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp
@@ -15,6 +15,10 @@
// iterator insert(const_iterator p, const value_type& x);
+#if _LIBCPP_DEBUG2 >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
#include <unordered_set>
#include <cassert>
@@ -69,4 +73,17 @@ int main()
assert(*r == 5.5);
}
#endif
+#if _LIBCPP_DEBUG2 >= 1
+ {
+ typedef std::unordered_set<double> C;
+ typedef C::iterator R;
+ typedef C::value_type P;
+ C c;
+ C c2;
+ C::const_iterator e = c2.end();
+ P v(3.5);
+ R r = c.insert(e, v);
+ assert(false);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/insert_hint_rvalue.pass.cpp b/libcxx/test/containers/unord/unord.set/insert_hint_rvalue.pass.cpp
index 8d7e5ba7a03..e5ba2c0a489 100644
--- a/libcxx/test/containers/unord/unord.set/insert_hint_rvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/insert_hint_rvalue.pass.cpp
@@ -15,6 +15,10 @@
// iterator insert(const_iterator p, value_type&& x);
+#if _LIBCPP_DEBUG2 >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
#include <unordered_set>
#include <cassert>
@@ -118,5 +122,17 @@ int main()
assert(*r == 5);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if _LIBCPP_DEBUG2 >= 1
+ {
+ typedef std::unordered_set<double> C;
+ typedef C::iterator R;
+ typedef C::value_type P;
+ C c;
+ C c2;
+ C::const_iterator e = c2.end();
+ R r = c.insert(e, P(3.5));
+ assert(false);
+ }
+#endif
#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
index 8dab47b861d..02e1b976720 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
@@ -209,5 +209,17 @@ int main()
assert(c.max_load_factor() == 1);
}
#endif
+#if _LIBCPP_DEBUG2 >= 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/libcxx/test/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
index 5c75a3e8aca..4967679e89f 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
@@ -179,5 +179,16 @@ int main()
assert(c0.empty());
}
#endif
+#if _LIBCPP_DEBUG2 >= 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/libcxx/test/containers/unord/unord.set/unord.set.swap/db_swap_1.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.swap/db_swap_1.pass.cpp
new file mode 100644
index 00000000000..829fc95be87
--- /dev/null
+++ b/libcxx/test/containers/unord/unord.set/unord.set.swap/db_swap_1.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// void swap(unordered_set& x, unordered_set& y);
+
+#if _LIBCPP_DEBUG2 >= 1
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <unordered_set>
+#include <cassert>
+
+int main()
+{
+#if _LIBCPP_DEBUG2 >= 1
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ int a2[] = {0, 2, 4, 5, 6, 8, 11};
+ std::unordered_set<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ std::unordered_set<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
+ std::unordered_set<int>::iterator i1 = c1.begin();
+ std::unordered_set<int>::iterator i2 = c2.begin();
+ swap(c1, c2);
+ c1.erase(i2);
+ c2.erase(i1);
+ std::unordered_set<int>::iterator j = i1;
+ c1.erase(i1);
+ assert(false);
+ }
+#endif
+}
OpenPOWER on IntegriCloud