[libcxx] r286984 - [libcxx] [test] D26627: Fix ordering assumptions in unordered container tests.
Stephan T. Lavavej via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 15 09:00:38 PST 2016
Author: stl_msft
Date: Tue Nov 15 11:00:38 2016
New Revision: 286984
URL: http://llvm.org/viewvc/llvm-project?rev=286984&view=rev
Log:
[libcxx] [test] D26627: Fix ordering assumptions in unordered container tests.
Modified:
libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
Modified: libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp?rev=286984&r1=286983&r2=286984&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp Tue Nov 15 11:00:38 2016
@@ -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
Modified: libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp?rev=286984&r1=286983&r2=286984&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp Tue Nov 15 11:00:38 2016
@@ -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());
Modified: libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp?rev=286984&r1=286983&r2=286984&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp Tue Nov 15 11:00:38 2016
@@ -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());
More information about the cfe-commits
mailing list