diff options
Diffstat (limited to 'test/std/containers/associative/multiset/max_size.pass.cpp')
-rw-r--r-- | test/std/containers/associative/multiset/max_size.pass.cpp | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/test/std/containers/associative/multiset/max_size.pass.cpp b/test/std/containers/associative/multiset/max_size.pass.cpp index 79492c9b1c40..8ca34ba82739 100644 --- a/test/std/containers/associative/multiset/max_size.pass.cpp +++ b/test/std/containers/associative/multiset/max_size.pass.cpp @@ -13,23 +13,38 @@ // size_type max_size() const; -#include <set> #include <cassert> +#include <limits> +#include <set> +#include <type_traits> -#include "min_allocator.h" +#include "test_allocator.h" +#include "test_macros.h" int main() { { - typedef std::multiset<int> M; - M m; - assert(m.max_size() != 0); + typedef limited_allocator<int, 10> A; + typedef std::multiset<int, std::less<int>, A> C; + C c; + assert(c.max_size() <= 10); + LIBCPP_ASSERT(c.max_size() == 10); + } + { + typedef limited_allocator<int, (size_t)-1> A; + typedef std::multiset<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::multiset<int, std::less<int>, min_allocator<int>> M; - M m; - assert(m.max_size() != 0); + typedef std::multiset<char> 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 } |