Skip to content

Commit c8952ca

Browse files
committed
move test to libcxx
1 parent 104c929 commit c8952ca

File tree

4 files changed

+80
-30
lines changed

4 files changed

+80
-30
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
//===----------------------------------------------------------------------===//
8+
9+
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
10+
// UNSUPPORTED: no-localization
11+
12+
// <flat_set>
13+
14+
// https://github.com/llvm/llvm-project/issues/136656
15+
16+
#include <flat_set>
17+
#include <ranges>
18+
#include <sstream>
19+
#include <vector>
20+
21+
#include "MinSequenceContainer.h"
22+
#include "test_macros.h"
23+
24+
void test() {
25+
MinSequenceContainer<int> v;
26+
std::flat_multiset s(v);
27+
std::istringstream ints("0 1 1 0");
28+
auto r = std::ranges::subrange(std::istream_iterator<int>(ints), std::istream_iterator<int>()) |
29+
std::views::transform([](int i) { return i * i; });
30+
static_assert(
31+
![](auto& t) { return requires { t.insert_range(r); }; }(v),
32+
"This test is to test the case where the underlying container does not provide insert_range");
33+
s.insert_range(r);
34+
}
35+
36+
int main(int, char**) {
37+
test();
38+
39+
return 0;
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
//===----------------------------------------------------------------------===//
8+
9+
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
10+
// UNSUPPORTED: no-localization
11+
12+
// <flat_set>
13+
14+
// https://github.com/llvm/llvm-project/issues/136656
15+
16+
#include <flat_set>
17+
#include <ranges>
18+
#include <sstream>
19+
#include <vector>
20+
21+
#include "MinSequenceContainer.h"
22+
#include "test_macros.h"
23+
24+
void test() {
25+
MinSequenceContainer<int> v;
26+
std::flat_set s(v);
27+
std::istringstream ints("0 1 1 0");
28+
auto r = std::ranges::subrange(std::istream_iterator<int>(ints), std::istream_iterator<int>()) |
29+
std::views::transform([](int i) { return i * i; });
30+
static_assert(
31+
![](auto& t) { return requires { t.insert_range(r); }; }(v),
32+
"This test is to test the case where the underlying container does not provide insert_range");
33+
s.insert_range(r);
34+
}
35+
36+
int main(int, char**) {
37+
test();
38+
39+
return 0;
40+
}

libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.modifiers/insert_range.pass.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <flat_set>
1919
#include <functional>
2020
#include <ranges>
21-
#include <sstream>
2221
#include <vector>
2322

2423
#include "MinSequenceContainer.h"
@@ -86,20 +85,6 @@ void test() {
8685
MoveOnly expected[] = {1, 1, 3, 4, 5};
8786
assert(std::ranges::equal(m, expected));
8887
}
89-
#if _LIBCPP_HAS_LOCALIZATION
90-
{
91-
// https://github.com/llvm/llvm-project/issues/136656
92-
MinSequenceContainer<int> v;
93-
std::flat_multiset s(v);
94-
std::istringstream ints("0 1 1 0");
95-
auto r = std::ranges::subrange(std::istream_iterator<int>(ints), std::istream_iterator<int>()) |
96-
std::views::transform([](int i) { return i * i; });
97-
static_assert(
98-
![](auto& t) { return requires { t.insert_range(r); }; }(v),
99-
"This test is to test the case where the underlying container does not provide insert_range");
100-
s.insert_range(r);
101-
}
102-
#endif
10388
}
10489

10590
void test_exception() {

libcxx/test/std/containers/container.adaptors/flat.set/flat.set.modifiers/insert_range.pass.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <flat_set>
1919
#include <functional>
2020
#include <ranges>
21-
#include <sstream>
2221
#include <vector>
2322

2423
#include "MinSequenceContainer.h"
@@ -97,20 +96,6 @@ void test() {
9796
MoveOnly expected[] = {1, 3, 4, 5};
9897
assert(std::ranges::equal(m, expected));
9998
}
100-
#if _LIBCPP_HAS_LOCALIZATION
101-
{
102-
// https://github.com/llvm/llvm-project/issues/136656
103-
MinSequenceContainer<int> v;
104-
std::flat_set s(v);
105-
std::istringstream ints("0 1 1 0");
106-
auto r = std::ranges::subrange(std::istream_iterator<int>(ints), std::istream_iterator<int>()) |
107-
std::views::transform([](int i) { return i * i; });
108-
static_assert(
109-
![](auto& t) { return requires { t.insert_range(r); }; }(v),
110-
"This test is to test the case where the underlying container does not provide insert_range");
111-
s.insert_range(r);
112-
}
113-
#endif
11499
}
115100

116101
void test_exception() {

0 commit comments

Comments
 (0)