[mlir][acc] Introduce MappableType interface (#122146)
[llvm-project.git] / libcxx / test / std / containers / associative / multiset / max_size.pass.cpp
blob09faf8f9b97e6a9d60ef5d0f8dfcd99149c180d3
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <set>
11 // class multiset
13 // size_type max_size() const;
15 #include <cassert>
16 #include <limits>
17 #include <set>
18 #include <type_traits>
20 #include "test_allocator.h"
21 #include "test_macros.h"
23 int main(int, char**)
26 typedef limited_allocator<int, 10> A;
27 typedef std::multiset<int, std::less<int>, A> C;
28 C c;
29 assert(c.max_size() <= 10);
30 LIBCPP_ASSERT(c.max_size() == 10);
33 typedef limited_allocator<int, (std::size_t)-1> A;
34 typedef std::multiset<int, std::less<int>, A> C;
35 const C::size_type max_dist =
36 static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
37 C c;
38 assert(c.max_size() <= max_dist);
39 LIBCPP_ASSERT(c.max_size() == max_dist);
42 typedef std::multiset<char> C;
43 const C::size_type max_dist =
44 static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
45 C c;
46 assert(c.max_size() <= max_dist);
47 assert(c.max_size() <= alloc_max_size(c.get_allocator()));
50 return 0;