[AMDGPU] Implement IR variant of isFMAFasterThanFMulAndFAdd (#121465)
[llvm-project.git] / libcxx / test / std / containers / associative / set / set.special / non_member_swap.pass.cpp
blob2c54ecbf4cee3a9c54eb1137d591ed4e736d0b0a
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 set
13 // void swap(set& m);
15 #include <set>
16 #include <cassert>
17 #include "test_macros.h"
18 #include "test_allocator.h"
19 #include "../../../test_compare.h"
21 int main(int, char**)
23 typedef int V;
25 typedef std::set<int> M;
27 M m1;
28 M m2;
29 M m1_save = m1;
30 M m2_save = m2;
31 swap(m1, m2);
32 assert(m1 == m2_save);
33 assert(m2 == m1_save);
36 V ar2[] =
43 10,
44 11,
47 M m1;
48 M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
49 M m1_save = m1;
50 M m2_save = m2;
51 swap(m1, m2);
52 assert(m1 == m2_save);
53 assert(m2 == m1_save);
56 V ar1[] =
63 M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
64 M m2;
65 M m1_save = m1;
66 M m2_save = m2;
67 swap(m1, m2);
68 assert(m1 == m2_save);
69 assert(m2 == m1_save);
72 V ar1[] =
79 V ar2[] =
86 10,
87 11,
90 M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
91 M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
92 M m1_save = m1;
93 M m2_save = m2;
94 swap(m1, m2);
95 assert(m1 == m2_save);
96 assert(m2 == m1_save);
100 typedef test_allocator<V> A;
101 typedef test_less<int> C;
102 typedef std::set<int, C, A> M;
103 V ar1[] =
110 V ar2[] =
121 M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
122 M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
123 M m1_save = m1;
124 M m2_save = m2;
125 swap(m1, m2);
126 assert(m1 == m2_save);
127 assert(m2 == m1_save);
128 assert(m1.key_comp() == C(2));
129 assert(m1.get_allocator().get_id() == 1);
130 assert(m2.key_comp() == C(1));
131 assert(m2.get_allocator().get_id() == 2);
134 typedef other_allocator<V> A;
135 typedef test_less<int> C;
136 typedef std::set<int, C, A> M;
137 V ar1[] =
144 V ar2[] =
155 M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
156 M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
157 M m1_save = m1;
158 M m2_save = m2;
159 swap(m1, m2);
160 assert(m1 == m2_save);
161 assert(m2 == m1_save);
162 assert(m1.key_comp() == C(2));
163 assert(m1.get_allocator() == A(2));
164 assert(m2.key_comp() == C(1));
165 assert(m2.get_allocator() == A(1));
168 return 0;