[AMDGPU] Implement IR variant of isFMAFasterThanFMulAndFAdd (#121465)
[llvm-project.git] / libcxx / test / std / containers / associative / multiset / multiset.cons / move.pass.cpp
blob63898747180ae74087476da9f57a90f024db0e25
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 // UNSUPPORTED: c++03
11 // <set>
13 // class multiset
15 // multiset(multiset&& s);
17 #include <set>
18 #include <cassert>
20 #include "test_macros.h"
21 #include "../../../test_compare.h"
22 #include "test_allocator.h"
23 #include "min_allocator.h"
25 int main(int, char**)
28 typedef int V;
29 typedef test_less<int> C;
30 typedef test_allocator<V> A;
31 std::multiset<int, C, A> mo(C(5), A(7));
32 std::multiset<int, C, A> m = std::move(mo);
33 assert(m.get_allocator() == A(7));
34 assert(m.key_comp() == C(5));
35 assert(m.size() == 0);
36 assert(std::distance(m.begin(), m.end()) == 0);
38 assert(mo.get_allocator() == A(7));
39 assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
40 assert(mo.key_comp() == C(5));
41 assert(mo.size() == 0);
42 assert(std::distance(mo.begin(), mo.end()) == 0);
45 typedef int V;
46 V ar[] =
58 typedef test_less<int> C;
59 typedef test_allocator<V> A;
60 std::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
61 std::multiset<int, C, A> m = std::move(mo);
62 assert(m.get_allocator() == A(7));
63 assert(m.key_comp() == C(5));
64 assert(m.size() == 9);
65 assert(std::distance(m.begin(), m.end()) == 9);
66 assert(*std::next(m.begin(), 0) == 1);
67 assert(*std::next(m.begin(), 1) == 1);
68 assert(*std::next(m.begin(), 2) == 1);
69 assert(*std::next(m.begin(), 3) == 2);
70 assert(*std::next(m.begin(), 4) == 2);
71 assert(*std::next(m.begin(), 5) == 2);
72 assert(*std::next(m.begin(), 6) == 3);
73 assert(*std::next(m.begin(), 7) == 3);
74 assert(*std::next(m.begin(), 8) == 3);
76 assert(mo.get_allocator() == A(7));
77 assert(mo.get_allocator().get_id() == test_alloc_base::moved_value);
78 assert(mo.key_comp() == C(5));
79 assert(mo.size() == 0);
80 assert(std::distance(mo.begin(), mo.end()) == 0);
83 typedef int V;
84 V ar[] =
96 typedef test_less<int> C;
97 typedef min_allocator<V> A;
98 std::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
99 std::multiset<int, C, A> m = std::move(mo);
100 assert(m.get_allocator() == A());
101 assert(m.key_comp() == C(5));
102 assert(m.size() == 9);
103 assert(std::distance(m.begin(), m.end()) == 9);
104 assert(*std::next(m.begin(), 0) == 1);
105 assert(*std::next(m.begin(), 1) == 1);
106 assert(*std::next(m.begin(), 2) == 1);
107 assert(*std::next(m.begin(), 3) == 2);
108 assert(*std::next(m.begin(), 4) == 2);
109 assert(*std::next(m.begin(), 5) == 2);
110 assert(*std::next(m.begin(), 6) == 3);
111 assert(*std::next(m.begin(), 7) == 3);
112 assert(*std::next(m.begin(), 8) == 3);
114 assert(mo.get_allocator() == A());
115 assert(mo.key_comp() == C(5));
116 assert(mo.size() == 0);
117 assert(std::distance(mo.begin(), mo.end()) == 0);
120 return 0;