summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/containers/associative/map
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std/containers/associative/map')
-rw-r--r--libcxx/test/std/containers/associative/map/map.access/max_size.pass.cpp38
1 files changed, 27 insertions, 11 deletions
diff --git a/libcxx/test/std/containers/associative/map/map.access/max_size.pass.cpp b/libcxx/test/std/containers/associative/map/map.access/max_size.pass.cpp
index c67d8b1f674..82a817a1f4a 100644
--- a/libcxx/test/std/containers/associative/map/map.access/max_size.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.access/max_size.pass.cpp
@@ -13,23 +13,39 @@
// size_type max_size() const;
-#include <map>
#include <cassert>
+#include <limits>
+#include <map>
+#include <type_traits>
-#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
int main()
{
- {
- typedef std::map<int, double> M;
- M m;
- assert(m.max_size() != 0);
+ typedef std::pair<const int, int> KV;
+ {
+ typedef limited_allocator<KV, 10> A;
+ typedef std::map<int, int, std::less<int>, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<KV, (size_t)-1> A;
+ typedef std::map<int, int, std::less<int>, A> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
}
-#if TEST_STD_VER >= 11
{
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- M m;
- assert(m.max_size() != 0);
+ typedef std::map<char, int> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
}
-#endif
}
OpenPOWER on IntegriCloud