Skip to content

Commit c1f3d77

Browse files
committed
ci
1 parent e6ed1e5 commit c1f3d77

25 files changed

+563
-541
lines changed

libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/alloc.pass.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <cassert>
1717
#include <flat_map>
1818
#include <functional>
19-
#include <memory_resource>
2019
#include <vector>
2120

2221
#include "test_macros.h"
@@ -68,19 +67,6 @@ int main(int, char**) {
6867
assert(m.keys().get_allocator().get_id() == 5);
6968
assert(m.values().get_allocator().get_id() == 5);
7069
}
71-
{
72-
// pmr
73-
using M = std::flat_map<int, short, std::less<int>, std::pmr::vector<int>, std::pmr::vector<short>>;
74-
std::pmr::monotonic_buffer_resource mr;
75-
std::pmr::polymorphic_allocator<int> pa = &mr;
76-
auto m1 = M(pa);
77-
assert(m1.empty());
78-
assert(m1.keys().get_allocator() == pa);
79-
assert(m1.values().get_allocator() == pa);
80-
auto m2 = M(&mr);
81-
assert(m2.empty());
82-
assert(m2.keys().get_allocator() == pa);
83-
assert(m2.values().get_allocator() == pa);
84-
}
70+
8571
return 0;
8672
}

libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/compare.pass.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <deque>
1818
#include <flat_map>
1919
#include <functional>
20-
#include <memory_resource>
2120
#include <type_traits>
2221
#include <vector>
2322

@@ -81,17 +80,6 @@ int main(int, char**) {
8180
assert(m.keys().get_allocator() == A1(5));
8281
assert(m.values().get_allocator() == A2(5));
8382
}
84-
{
85-
using M = std::flat_map<int, int, std::function<bool(int, int)>, std::pmr::vector<int>, std::pmr::vector<int>>;
86-
std::pmr::monotonic_buffer_resource mr;
87-
std::pmr::vector<M> vm(&mr);
88-
vm.emplace_back(std::greater<int>());
89-
assert(vm[0] == M{});
90-
assert(vm[0].key_comp()(2, 1) == true);
91-
assert(vm[0].value_comp()({2, 0}, {1, 0}) == true);
92-
assert(vm[0].keys().get_allocator().resource() == &mr);
93-
assert(vm[0].values().get_allocator().resource() == &mr);
94-
}
9583
{
9684
// If an allocator is given, it must be usable by both containers.
9785
using A = test_allocator<int>;
@@ -100,5 +88,6 @@ int main(int, char**) {
10088
static_assert(!std::is_constructible_v<M, std::less<>, std::allocator<int>>);
10189
static_assert(!std::is_constructible_v<M, std::less<>, A>);
10290
}
91+
10392
return 0;
10493
}

libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/containers.pass.cpp

Lines changed: 0 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <deque>
2424
#include <flat_map>
2525
#include <functional>
26-
#include <memory_resource>
2726
#include <vector>
2827

2928
#include "min_allocator.h"
@@ -180,127 +179,6 @@ int main(int, char**) {
180179
assert(m2.keys().get_allocator() == A(5));
181180
assert(m2.values().get_allocator() == A(5));
182181
}
183-
{
184-
// pmr
185-
using M = std::flat_map<int, int, std::less<int>, std::pmr::vector<int>, std::pmr::vector<int>>;
186-
std::pmr::monotonic_buffer_resource mr;
187-
std::pmr::vector<M> vm(&mr);
188-
std::pmr::vector<int> ks = {1, 1, 1, 2, 2, 3, 2, 3, 3};
189-
std::pmr::vector<int> vs = {1, 1, 1, 2, 2, 3, 2, 3, 3};
190-
assert(ks.get_allocator().resource() != &mr);
191-
assert(vs.get_allocator().resource() != &mr);
192-
vm.emplace_back(ks, vs);
193-
assert(ks.size() == 9); // ks' value is unchanged, since it was an lvalue above
194-
assert(vs.size() == 9); // vs' value is unchanged, since it was an lvalue above
195-
assert((vm[0] == M{{1, 1}, {2, 2}, {3, 3}}));
196-
assert(vm[0].keys().get_allocator().resource() == &mr);
197-
assert(vm[0].values().get_allocator().resource() == &mr);
198-
}
199-
{
200-
// pmr move
201-
using M = std::flat_map<int, int, std::less<int>, std::pmr::vector<int>, std::pmr::vector<int>>;
202-
std::pmr::monotonic_buffer_resource mr;
203-
std::pmr::vector<M> vm(&mr);
204-
std::pmr::vector<int> ks = {1, 1, 1, 2, 2, 3, 2, 3, 3};
205-
std::pmr::vector<int> vs = {1, 1, 1, 2, 2, 3, 2, 3, 3};
206-
assert(ks.get_allocator().resource() != &mr);
207-
assert(vs.get_allocator().resource() != &mr);
208-
vm.emplace_back(std::move(ks), std::move(vs));
209-
LIBCPP_ASSERT(ks.size() == 9); // ks' size is unchanged, since it uses a different allocator
210-
LIBCPP_ASSERT(vs.size() == 9); // vs' size is unchanged, since it uses a different allocator
211-
assert((vm[0] == M{{1, 1}, {2, 2}, {3, 3}}));
212-
assert(vm[0].keys().get_allocator().resource() == &mr);
213-
assert(vm[0].values().get_allocator().resource() == &mr);
214-
}
215182

216-
#if 0
217-
// Test all combinations of lvalue and rvalue containers (LWG 3802).
218-
{
219-
int input[] = {1,1,1,2,2,3,2,3,3};
220-
const P expected[] = {{1,1}, {2,2}, {3,3}};
221-
{
222-
using M = std::flat_map<int, MoveOnly, std::less<>, std::pmr::vector<int>, std::pmr::vector<MoveOnly>>;
223-
std::pmr::monotonic_buffer_resource mr;
224-
std::pmr::vector<M> vm(&mr);
225-
std::pmr::vector<int> ks(input, input + 9);
226-
std::pmr::vector<MoveOnly> vs(input, input + 9);
227-
vm.emplace_back(ks, std::move(vs)); // ill-formed before LWG 3802
228-
assert(ks.size() == 9); // ks' value is unchanged, since it was an lvalue above
229-
LIBCPP_ASSERT(vs.size() == 9); // vs' size is unchanged, since it uses a different allocator
230-
assert(std::ranges::equal(vm[0], expected, std::equal_to<>()));
231-
assert(vm[0].keys().get_allocator().resource() == &mr);
232-
assert(vm[0].values().get_allocator().resource() == &mr);
233-
}
234-
{
235-
using M = std::flat_map<MoveOnly, int, std::less<>, std::pmr::vector<MoveOnly>, std::pmr::vector<int>>;
236-
std::pmr::monotonic_buffer_resource mr;
237-
std::pmr::vector<M> vm(&mr);
238-
std::pmr::vector<MoveOnly> ks(input, input + 9);
239-
std::pmr::vector<int> vs(input, input + 9);
240-
vm.emplace_back(std::move(ks), vs); // ill-formed before LWG 3802
241-
LIBCPP_ASSERT(ks.size() == 9); // ks' size is unchanged, since it uses a different allocator
242-
assert(vs.size() == 9); // vs' value is unchanged, since it was an lvalue above
243-
assert(std::ranges::equal(vm[0], expected, std::equal_to<>()));
244-
assert(vm[0].keys().get_allocator().resource() == &mr);
245-
assert(vm[0].values().get_allocator().resource() == &mr);
246-
}
247-
{
248-
using M = std::flat_map<MoveOnly, MoveOnly, std::less<>, std::pmr::vector<MoveOnly>, std::pmr::vector<MoveOnly>>;
249-
std::pmr::monotonic_buffer_resource mr;
250-
std::pmr::vector<M> vm(&mr);
251-
std::pmr::vector<MoveOnly> ks(input, input + 9);
252-
std::pmr::vector<MoveOnly> vs(input, input + 9);
253-
vm.emplace_back(std::move(ks), std::move(vs)); // ill-formed before LWG 3802
254-
LIBCPP_ASSERT(ks.size() == 9); // ks' size is unchanged, since it uses a different allocator
255-
LIBCPP_ASSERT(vs.size() == 9); // vs' size is unchanged, since it uses a different allocator
256-
assert(std::ranges::equal(vm[0], expected, std::equal_to<>()));
257-
assert(vm[0].keys().get_allocator().resource() == &mr);
258-
assert(vm[0].values().get_allocator().resource() == &mr);
259-
}
260-
}
261-
{
262-
int input[] = {1,2,3};
263-
const P expected[] = {{1,1}, {2,2}, {3,3}};
264-
{
265-
using M = std::flat_map<int, MoveOnly, std::less<>, std::pmr::vector<int>, std::pmr::vector<MoveOnly>>;
266-
std::pmr::monotonic_buffer_resource mr;
267-
std::pmr::vector<M> vm(&mr);
268-
std::pmr::vector<int> ks(input, input + 3);
269-
std::pmr::vector<MoveOnly> vs(input, input + 3);
270-
vm.emplace_back(std::sorted_unique, ks, std::move(vs)); // ill-formed before LWG 3802
271-
assert(ks.size() == 3); // ks' value is unchanged, since it was an lvalue above
272-
LIBCPP_ASSERT(vs.size() == 3); // vs' size is unchanged, since it uses a different allocator
273-
assert(std::ranges::equal(vm[0], expected, std::equal_to<>()));
274-
assert(vm[0].keys().get_allocator().resource() == &mr);
275-
assert(vm[0].values().get_allocator().resource() == &mr);
276-
}
277-
{
278-
using M = std::flat_map<MoveOnly, int, std::less<>, std::pmr::vector<MoveOnly>, std::pmr::vector<int>>;
279-
std::pmr::monotonic_buffer_resource mr;
280-
std::pmr::vector<M> vm(&mr);
281-
std::pmr::vector<MoveOnly> ks(input, input + 3);
282-
std::pmr::vector<int> vs(input, input + 3);
283-
vm.emplace_back(std::sorted_unique, std::move(ks), vs); // ill-formed before LWG 3802
284-
LIBCPP_ASSERT(ks.size() == 3); // ks' size is unchanged, since it uses a different allocator
285-
assert(vs.size() == 3); // vs' value is unchanged, since it was an lvalue above
286-
assert(std::ranges::equal(vm[0], expected, std::equal_to<>()));
287-
assert(vm[0].keys().get_allocator().resource() == &mr);
288-
assert(vm[0].values().get_allocator().resource() == &mr);
289-
}
290-
{
291-
using M = std::flat_map<MoveOnly, MoveOnly, std::less<>, std::pmr::vector<MoveOnly>, std::pmr::vector<MoveOnly>>;
292-
std::pmr::monotonic_buffer_resource mr;
293-
std::pmr::vector<M> vm(&mr);
294-
std::pmr::vector<MoveOnly> ks(input, input + 3);
295-
std::pmr::vector<MoveOnly> vs(input, input + 3);
296-
vm.emplace_back(std::sorted_unique, std::move(ks), std::move(vs)); // ill-formed before LWG 3802
297-
LIBCPP_ASSERT(ks.size() == 3); // ks' size is unchanged, since it uses a different allocator
298-
LIBCPP_ASSERT(vs.size() == 3); // vs' size is unchanged, since it uses a different allocator
299-
assert(std::ranges::equal(vm[0], expected, std::equal_to<>()));
300-
assert(vm[0].keys().get_allocator().resource() == &mr);
301-
assert(vm[0].values().get_allocator().resource() == &mr);
302-
}
303-
}
304-
#endif
305183
return 0;
306184
}

libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/copy.pass.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include <cassert>
1616
#include <flat_map>
17-
#include <memory_resource>
1817
#include <vector>
1918

2019
#include "test_macros.h"
@@ -66,25 +65,6 @@ int main(int, char**) {
6665
assert(mo.keys().get_allocator() == other_allocator<int>(6));
6766
assert(mo.values().get_allocator() == other_allocator<char>(7));
6867
}
69-
{
70-
using C = test_less<int>;
71-
std::pmr::monotonic_buffer_resource mr;
72-
using M = std::flat_map<int, int, C, std::pmr::vector<int>, std::pmr::vector<int>>;
73-
auto mo = M({{1, 1}, {2, 2}, {3, 3}}, C(5), &mr);
74-
auto m = mo;
75-
76-
assert(m.key_comp() == C(5));
77-
assert((m == M{{1, 1}, {2, 2}, {3, 3}}));
78-
auto [ks, vs] = std::move(m).extract();
79-
assert(ks.get_allocator().resource() == std::pmr::get_default_resource());
80-
assert(vs.get_allocator().resource() == std::pmr::get_default_resource());
8168

82-
// mo is unchanged
83-
assert(mo.key_comp() == C(5));
84-
assert((mo == M{{1, 1}, {2, 2}, {3, 3}}));
85-
auto [kso, vso] = std::move(mo).extract();
86-
assert(kso.get_allocator().resource() == &mr);
87-
assert(vso.get_allocator().resource() == &mr);
88-
}
8969
return 0;
9070
}

libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/copy_alloc.pass.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <deque>
1717
#include <flat_map>
1818
#include <functional>
19-
#include <memory_resource>
2019
#include <vector>
2120

2221
#include "test_macros.h"
@@ -63,34 +62,6 @@ int main(int, char**) {
6362
assert(mo.keys().get_allocator() == test_allocator<int>(6));
6463
assert(mo.values().get_allocator() == test_allocator<char>(7));
6564
}
66-
{
67-
// explicit(false)
68-
using C = test_less<int>;
69-
using M = std::flat_map<int, int, C, std::pmr::vector<int>, std::pmr::vector<int>>;
70-
std::pmr::monotonic_buffer_resource mr1;
71-
std::pmr::monotonic_buffer_resource mr2;
72-
M mo = M({1, 2, 3}, {2, 2, 1}, C(5), &mr1);
73-
M m = {mo, &mr2}; // also test the implicitness of this constructor
7465

75-
assert(m.key_comp() == C(5));
76-
assert((m.keys() == std::pmr::vector<int>{1, 2, 3}));
77-
assert((m.values() == std::pmr::vector<int>{2, 2, 1}));
78-
assert(m.keys().get_allocator().resource() == &mr2);
79-
assert(m.values().get_allocator().resource() == &mr2);
80-
81-
// mo is unchanged
82-
assert(mo.key_comp() == C(5));
83-
assert((mo.keys() == std::pmr::vector<int>{1, 2, 3}));
84-
assert((mo.values() == std::pmr::vector<int>{2, 2, 1}));
85-
assert(mo.keys().get_allocator().resource() == &mr1);
86-
assert(mo.values().get_allocator().resource() == &mr1);
87-
}
88-
{
89-
using M = std::flat_map<int, int, std::less<>, std::pmr::vector<int>, std::pmr::deque<int>>;
90-
std::pmr::vector<M> vs;
91-
M m = {{1, 2}, {2, 2}, {3, 1}};
92-
vs.push_back(m);
93-
assert(vs[0] == m);
94-
}
9566
return 0;
9667
}

libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/copy_assign.pass.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <deque>
1616
#include <flat_map>
1717
#include <functional>
18-
#include <memory_resource>
1918
#include <vector>
2019

2120
#include "test_macros.h"
@@ -71,22 +70,6 @@ int main(int, char**) {
7170
assert(mo.keys().get_allocator() == other_allocator<int>(6));
7271
assert(mo.values().get_allocator() == other_allocator<char>(7));
7372
}
74-
{
75-
// pmr allocator is not propagated
76-
using M = std::flat_map<int, int, std::less<>, std::pmr::deque<int>, std::pmr::vector<int>>;
77-
std::pmr::monotonic_buffer_resource mr1;
78-
std::pmr::monotonic_buffer_resource mr2;
79-
M mo = M({{1, 1}, {2, 2}, {3, 3}}, &mr1);
80-
M m = M({{4, 4}, {5, 5}}, &mr2);
81-
m = mo;
82-
assert((m == M{{1, 1}, {2, 2}, {3, 3}}));
83-
assert(m.keys().get_allocator().resource() == &mr2);
84-
assert(m.values().get_allocator().resource() == &mr2);
85-
86-
// mo is unchanged
87-
assert((mo == M{{1, 1}, {2, 2}, {3, 3}}));
88-
assert(mo.keys().get_allocator().resource() == &mr1);
89-
}
9073
{
9174
// comparator is copied and invariant is preserved
9275
using M = std::flat_map<int, int, std::function<bool(int, int)>>;

libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/deduct.pass.cpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <list>
1919
#include <flat_map>
2020
#include <functional>
21-
#include <memory_resource>
2221
#include <ranges>
2322
#include <type_traits>
2423
#include <utility>
@@ -89,32 +88,6 @@ void test_containers() {
8988
assert(s.keys().get_allocator().get_id() == 44);
9089
assert(s.values().get_allocator().get_id() == 44);
9190
}
92-
{
93-
std::pmr::monotonic_buffer_resource mr;
94-
std::pmr::monotonic_buffer_resource mr2;
95-
std::pmr::deque<int> pks(ks.begin(), ks.end(), &mr);
96-
std::pmr::deque<short> pvs(vs.begin(), vs.end(), &mr);
97-
std::flat_map s(std::move(pks), std::move(pvs), &mr2);
98-
99-
ASSERT_SAME_TYPE(
100-
decltype(s), std::flat_map<int, short, std::less<int>, std::pmr::deque<int>, std::pmr::deque<short>>);
101-
assert(std::ranges::equal(s, expected));
102-
assert(s.keys().get_allocator().resource() == &mr2);
103-
assert(s.values().get_allocator().resource() == &mr2);
104-
}
105-
{
106-
std::pmr::monotonic_buffer_resource mr;
107-
std::pmr::monotonic_buffer_resource mr2;
108-
std::pmr::deque<int> pks(sorted_ks.begin(), sorted_ks.end(), &mr);
109-
std::pmr::deque<short> pvs(sorted_vs.begin(), sorted_vs.end(), &mr);
110-
std::flat_map s(std::sorted_unique, std::move(pks), std::move(pvs), &mr2);
111-
112-
ASSERT_SAME_TYPE(
113-
decltype(s), std::flat_map<int, short, std::less<int>, std::pmr::deque<int>, std::pmr::deque<short>>);
114-
assert(std::ranges::equal(s, expected));
115-
assert(s.keys().get_allocator().resource() == &mr2);
116-
assert(s.values().get_allocator().resource() == &mr2);
117-
}
11891
}
11992

12093
void test_containers_compare() {
@@ -155,32 +128,6 @@ void test_containers_compare() {
155128
assert(s.keys().get_allocator().get_id() == 44);
156129
assert(s.values().get_allocator().get_id() == 44);
157130
}
158-
{
159-
std::pmr::monotonic_buffer_resource mr;
160-
std::pmr::monotonic_buffer_resource mr2;
161-
std::pmr::deque<int> pks(ks.begin(), ks.end(), &mr);
162-
std::pmr::deque<short> pvs(vs.begin(), vs.end(), &mr);
163-
std::flat_map s(std::move(pks), std::move(pvs), std::greater<int>(), &mr2);
164-
165-
ASSERT_SAME_TYPE(
166-
decltype(s), std::flat_map<int, short, std::greater<int>, std::pmr::deque<int>, std::pmr::deque<short>>);
167-
assert(std::ranges::equal(s, expected));
168-
assert(s.keys().get_allocator().resource() == &mr2);
169-
assert(s.values().get_allocator().resource() == &mr2);
170-
}
171-
{
172-
std::pmr::monotonic_buffer_resource mr;
173-
std::pmr::monotonic_buffer_resource mr2;
174-
std::pmr::deque<int> pks(sorted_ks.begin(), sorted_ks.end(), &mr);
175-
std::pmr::deque<short> pvs(sorted_vs.begin(), sorted_vs.end(), &mr);
176-
std::flat_map s(std::sorted_unique, std::move(pks), std::move(pvs), std::greater<int>(), &mr2);
177-
178-
ASSERT_SAME_TYPE(
179-
decltype(s), std::flat_map<int, short, std::greater<int>, std::pmr::deque<int>, std::pmr::deque<short>>);
180-
assert(std::ranges::equal(s, expected));
181-
assert(s.keys().get_allocator().resource() == &mr2);
182-
assert(s.values().get_allocator().resource() == &mr2);
183-
}
184131
}
185132

186133
void test_iter_iter() {

0 commit comments

Comments
 (0)