diff options
author | Stephan T. Lavavej <stl@exchange.microsoft.com> | 2016-11-15 17:00:38 +0000 |
---|---|---|
committer | Stephan T. Lavavej <stl@exchange.microsoft.com> | 2016-11-15 17:00:38 +0000 |
commit | 6d279e8e98f83dc1ed8769b1be2a846daef2e33d (patch) | |
tree | 609ef14ac4ba26db91bd0eba8464714941725349 | |
parent | 64bac8b5fe24e5b2de556c24551b474e68264c46 (diff) | |
download | bcm5719-llvm-6d279e8e98f83dc1ed8769b1be2a846daef2e33d.tar.gz bcm5719-llvm-6d279e8e98f83dc1ed8769b1be2a846daef2e33d.zip |
[libcxx] [test] D26627: Fix ordering assumptions in unordered container tests.
llvm-svn: 286984
3 files changed, 17 insertions, 32 deletions
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp index 8bccd4013a2..a8095135c1c 100644 --- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp @@ -25,6 +25,7 @@ #include "../../../Emplaceable.h" #include "min_allocator.h" +#include "test_macros.h" int main() { @@ -44,20 +45,20 @@ int main() assert(c.size() == 2); assert(r->first == 3); assert(r->second == Emplaceable(5, 6)); - assert(r == next(c.begin())); + LIBCPP_ASSERT(r == next(c.begin())); r = c.emplace_hint(r, std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple(6, 7)); assert(c.size() == 3); assert(r->first == 3); assert(r->second == Emplaceable(6, 7)); - assert(r == next(c.begin())); + LIBCPP_ASSERT(r == next(c.begin())); r = c.begin(); assert(r->first == 3); - assert(r->second == Emplaceable()); + LIBCPP_ASSERT(r->second == Emplaceable()); r = next(r, 2); assert(r->first == 3); - assert(r->second == Emplaceable(5, 6)); + LIBCPP_ASSERT(r->second == Emplaceable(5, 6)); } #if TEST_STD_VER >= 11 { @@ -76,20 +77,20 @@ int main() assert(c.size() == 2); assert(r->first == 3); assert(r->second == Emplaceable(5, 6)); - assert(r == next(c.begin())); + LIBCPP_ASSERT(r == next(c.begin())); r = c.emplace_hint(r, std::piecewise_construct, std::forward_as_tuple(3), std::forward_as_tuple(6, 7)); assert(c.size() == 3); assert(r->first == 3); assert(r->second == Emplaceable(6, 7)); - assert(r == next(c.begin())); + LIBCPP_ASSERT(r == next(c.begin())); r = c.begin(); assert(r->first == 3); - assert(r->second == Emplaceable()); + LIBCPP_ASSERT(r->second == Emplaceable()); r = next(r, 2); assert(r->first == 3); - assert(r->second == Emplaceable(5, 6)); + LIBCPP_ASSERT(r->second == Emplaceable(5, 6)); } #endif #if _LIBCPP_DEBUG >= 1 diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp index 35bbce2d61e..274c0397483 100644 --- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp @@ -204,18 +204,10 @@ int main() c = std::move(c0); LIBCPP_ASSERT(c.bucket_count() == 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(*i == 4); - ++i; - assert(*i == 3); - ++i; - assert(*i == 2); - ++i; - assert(*i == 2); - ++i; - assert(*i == 1); - ++i; - assert(*i == 1); + assert(c.count(1) == 2); + assert(c.count(2) == 2); + 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()); diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp index be7c22eb341..aad2d7d2e6e 100644 --- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp @@ -146,18 +146,10 @@ int main() C c(std::move(c0), A()); assert(c.bucket_count() >= 7); assert(c.size() == 6); - C::const_iterator i = c.cbegin(); - assert(*i == 4); - ++i; - assert(*i == 3); - ++i; - assert(*i == 2); - ++i; - assert(*i == 2); - ++i; - assert(*i == 1); - ++i; - assert(*i == 1); + assert(c.count(1) == 2); + assert(c.count(2) == 2); + 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()); |