[mlir][acc] Introduce MappableType interface (#122146)
[llvm-project.git] / libcxx / test / std / containers / associative / multiset / insert_cv.pass.cpp
blobb8a36ec38537759f2f25b14342e3de6a456ae9d6
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 // iterator insert(const value_type& v);
15 #include <set>
16 #include <cassert>
18 #include "test_macros.h"
19 #include "min_allocator.h"
21 template<class Container>
22 void do_insert_cv_test()
24 typedef Container M;
25 typedef typename M::iterator R;
26 typedef typename M::value_type VT;
27 M m;
28 const VT v1(2);
29 R r = m.insert(v1);
30 assert(r == m.begin());
31 assert(m.size() == 1);
32 assert(*r == 2);
34 const VT v2(1);
35 r = m.insert(v2);
36 assert(r == m.begin());
37 assert(m.size() == 2);
38 assert(*r == 1);
40 const VT v3(3);
41 r = m.insert(v3);
42 assert(r == std::prev(m.end()));
43 assert(m.size() == 3);
44 assert(*r == 3);
46 r = m.insert(v3);
47 assert(r == std::prev(m.end()));
48 assert(m.size() == 4);
49 assert(*r == 3);
52 int main(int, char**)
54 do_insert_cv_test<std::multiset<int> >();
55 #if TEST_STD_VER >= 11
57 typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
58 do_insert_cv_test<M>();
60 #endif
62 return 0;