aboutsummaryrefslogtreecommitdiff
path: root/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp')
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp53
1 files changed, 17 insertions, 36 deletions
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
index 58d1424d8b1e..df69b52878d3 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <unordered_map>
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
@@ -20,7 +22,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -28,38 +32,28 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >,
test_allocator<std::pair<const int, std::string> >
> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
+
C c0(7,
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9),
test_allocator<std::pair<const int, std::string> >(10)
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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<std::pair<const int, std::string> >(10)));
assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
@@ -88,7 +82,7 @@ int main()
test_allocator<std::pair<const int, std::string> >(10)
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
typedef std::pair<C::const_iterator, C::const_iterator> Eq;
Eq eq = c.equal_range(1);
@@ -118,8 +112,8 @@ int main()
i = eq.first;
assert(i->first == 4);
assert(i->second == "four");
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -128,38 +122,27 @@ int main()
assert(c0.empty());
}
-#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >,
min_allocator<std::pair<const int, std::string> >
> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
C c0(7,
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9),
min_allocator<std::pair<const int, std::string> >()
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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<std::pair<const int, std::string> >()));
assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
@@ -188,7 +171,7 @@ int main()
min_allocator<std::pair<const int, std::string> >()
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
typedef std::pair<C::const_iterator, C::const_iterator> Eq;
Eq eq = c.equal_range(1);
@@ -218,8 +201,8 @@ int main()
i = eq.first;
assert(i->first == 4);
assert(i->second == "four");
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
assert(c.hash_function() == test_hash<std::hash<int> >(8));
@@ -228,7 +211,6 @@ int main()
assert(c0.empty());
}
-#endif
#if _LIBCPP_DEBUG >= 1
{
std::unordered_multimap<int, int> s1 = {{1, 1}, {2, 2}, {3, 3}};
@@ -240,5 +222,4 @@ int main()
assert(s2.size() == 2);
}
#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}