[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / containers / associative / multimap / multimap.modifiers / insert_cv.pass.cpp
blobf34016303fbe615dd5982f625d3f6fbd52e7ac4c
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 // <map>
11 // class multimap
13 // iterator insert(const value_type& v);
15 #include <map>
16 #include <cassert>
18 #include "test_macros.h"
19 #include "min_allocator.h"
21 template <class Container>
22 void do_insert_test() {
23 typedef Container M;
24 typedef typename M::iterator R;
25 typedef typename M::value_type VT;
26 M m;
27 const VT v1(2, 2.5);
28 R r = m.insert(v1);
29 assert(r == m.begin());
30 assert(m.size() == 1);
31 assert(r->first == 2);
32 assert(r->second == 2.5);
34 const VT v2(1, 1.5);
35 r = m.insert(v2);
36 assert(r == m.begin());
37 assert(m.size() == 2);
38 assert(r->first == 1);
39 assert(r->second == 1.5);
41 const VT v3(3, 3.5);
42 r = m.insert(v3);
43 assert(r == std::prev(m.end()));
44 assert(m.size() == 3);
45 assert(r->first == 3);
46 assert(r->second == 3.5);
48 const VT v4(3, 3.5);
49 r = m.insert(v4);
50 assert(r == std::prev(m.end()));
51 assert(m.size() == 4);
52 assert(r->first == 3);
53 assert(r->second == 3.5);
56 int main(int, char**)
59 typedef std::multimap<int, double> Container;
60 do_insert_test<Container>();
62 #if TEST_STD_VER >= 11
64 typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> Container;
65 do_insert_test<Container>();
67 #endif
69 return 0;