Skip to content

Commit 355a23a

Browse files
committed
operations
1 parent f57f746 commit 355a23a

12 files changed

+132
-36
lines changed

libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.operations/contains.pass.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "min_allocator.h"
2424

2525
template <class KeyContainer>
26-
void test_one() {
26+
constexpr void test_one() {
2727
using Key = typename KeyContainer::value_type;
2828
{
2929
using M = std::flat_multiset<Key, std::less<>, KeyContainer>;
@@ -66,15 +66,23 @@ void test_one() {
6666
}
6767
}
6868

69-
void test() {
69+
constexpr bool test() {
7070
test_one<std::vector<int>>();
71-
test_one<std::deque<int>>();
71+
#ifndef __cpp_lib_constexpr_deque
72+
if (!TEST_IS_CONSTANT_EVALUATED)
73+
#endif
74+
test_one<std::deque<int>>();
7275
test_one<MinSequenceContainer<int>>();
7376
test_one<std::vector<int, min_allocator<int>>>();
77+
78+
return true;
7479
}
7580

7681
int main(int, char**) {
7782
test();
83+
#if TEST_STD_VER >= 26
84+
static_assert(test());
85+
#endif
7886

7987
return 0;
8088
}

libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.operations/contains_transparent.pass.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static_assert(!CanContains<NonTransparentSet>);
3535
static_assert(!CanContains<const NonTransparentSet>);
3636

3737
template <class KeyContainer>
38-
void test_one() {
38+
constexpr void test_one() {
3939
using Key = typename KeyContainer::value_type;
4040
using M = std::flat_multiset<Key, TransparentComparator, KeyContainer>;
4141

@@ -60,9 +60,12 @@ void test_one() {
6060
}
6161
}
6262

63-
void test() {
63+
constexpr bool test() {
6464
test_one<std::vector<std::string>>();
65-
test_one<std::deque<std::string>>();
65+
#ifndef __cpp_lib_constexpr_deque
66+
if (!TEST_IS_CONSTANT_EVALUATED)
67+
#endif
68+
test_one<std::deque<std::string>>();
6669
test_one<MinSequenceContainer<std::string>>();
6770
test_one<std::vector<std::string, min_allocator<std::string>>>();
6871

@@ -82,10 +85,15 @@ void test() {
8285
assert(m.contains("beta"));
8386
assert(!m.contains("charlie"));
8487
}
88+
89+
return true;
8590
}
8691

8792
int main(int, char**) {
8893
test();
94+
#if TEST_STD_VER >= 26
95+
static_assert(test());
96+
#endif
8997

9098
return 0;
9199
}

libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.operations/count.pass.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "min_allocator.h"
2424

2525
template <class KeyContainer>
26-
void test_one() {
26+
constexpr void test_one() {
2727
using Key = typename KeyContainer::value_type;
2828
using S = typename KeyContainer::size_type;
2929

@@ -66,15 +66,23 @@ void test_one() {
6666
}
6767
}
6868

69-
void test() {
69+
constexpr bool test() {
7070
test_one<std::vector<int>>();
71-
test_one<std::deque<int>>();
71+
#ifndef __cpp_lib_constexpr_deque
72+
if (!TEST_IS_CONSTANT_EVALUATED)
73+
#endif
74+
test_one<std::deque<int>>();
7275
test_one<MinSequenceContainer<int>>();
7376
test_one<std::vector<int, min_allocator<int>>>();
77+
78+
return true;
7479
}
7580

7681
int main(int, char**) {
7782
test();
83+
#if TEST_STD_VER >= 26
84+
static_assert(test());
85+
#endif
7886

7987
return 0;
8088
}

libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.operations/count_transparent.pass.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static_assert(!CanCount<NonTransparentSet>);
3535
static_assert(!CanCount<const NonTransparentSet>);
3636

3737
template <class KeyContainer>
38-
void test_one() {
38+
constexpr void test_one() {
3939
using Key = typename KeyContainer::value_type;
4040
using M = std::flat_multiset<Key, TransparentComparator, KeyContainer>;
4141
{
@@ -59,9 +59,12 @@ void test_one() {
5959
}
6060
}
6161

62-
void test() {
62+
constexpr bool test() {
6363
test_one<std::vector<std::string>>();
64-
test_one<std::deque<std::string>>();
64+
#ifndef __cpp_lib_constexpr_deque
65+
if (!TEST_IS_CONSTANT_EVALUATED)
66+
#endif
67+
test_one<std::deque<std::string>>();
6568
test_one<MinSequenceContainer<std::string>>();
6669
test_one<std::vector<std::string, min_allocator<std::string>>>();
6770

@@ -81,10 +84,15 @@ void test() {
8184
auto n = m.count("beta");
8285
assert(n == 2);
8386
}
87+
88+
return true;
8489
}
8590

8691
int main(int, char**) {
8792
test();
93+
#if TEST_STD_VER >= 26
94+
static_assert(test());
95+
#endif
8896

8997
return 0;
9098
}

libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.operations/equal_range.pass.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "min_allocator.h"
2525

2626
template <class KeyContainer>
27-
void test_one() {
27+
constexpr void test_one() {
2828
using Key = typename KeyContainer::value_type;
2929
{
3030
using M = std::flat_multiset<Key, std::less<>, KeyContainer>;
@@ -74,15 +74,23 @@ void test_one() {
7474
}
7575
}
7676

77-
void test() {
77+
constexpr bool test() {
7878
test_one<std::vector<int>>();
79-
test_one<std::deque<int>>();
79+
#ifndef __cpp_lib_constexpr_deque
80+
if (!TEST_IS_CONSTANT_EVALUATED)
81+
#endif
82+
test_one<std::deque<int>>();
8083
test_one<MinSequenceContainer<int>>();
8184
test_one<std::vector<int, min_allocator<int>>>();
85+
86+
return true;
8287
}
8388

8489
int main(int, char**) {
8590
test();
91+
#if TEST_STD_VER >= 26
92+
static_assert(test());
93+
#endif
8694

8795
return 0;
8896
}

libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.operations/equal_range_transparent.pass.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static_assert(!CanEqualRange<NonTransparentSet>);
3636
static_assert(!CanEqualRange<const NonTransparentSet>);
3737

3838
template <class KeyContainer>
39-
void test_one() {
39+
constexpr void test_one() {
4040
using Key = typename KeyContainer::value_type;
4141
using M = std::flat_multiset<Key, TransparentComparator, KeyContainer>;
4242

@@ -90,9 +90,12 @@ void test_one() {
9090
}
9191
}
9292

93-
void test() {
93+
constexpr bool test() {
9494
test_one<std::vector<std::string>>();
95-
test_one<std::deque<std::string>>();
95+
#ifndef __cpp_lib_constexpr_deque
96+
if (!TEST_IS_CONSTANT_EVALUATED)
97+
#endif
98+
test_one<std::deque<std::string>>();
9699
test_one<MinSequenceContainer<std::string>>();
97100
test_one<std::vector<std::string, min_allocator<std::string>>>();
98101

@@ -113,10 +116,15 @@ void test() {
113116
assert(first == m.begin() + 1);
114117
assert(last == m.begin() + 3);
115118
}
119+
120+
return true;
116121
}
117122

118123
int main(int, char**) {
119124
test();
125+
#if TEST_STD_VER >= 26
126+
static_assert(test());
127+
#endif
120128

121129
return 0;
122130
}

libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.operations/find.pass.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "min_allocator.h"
2626

2727
template <class KeyContainer>
28-
void test_one() {
28+
constexpr void test_one() {
2929
using Key = typename KeyContainer::value_type;
3030
using M = std::flat_multiset<Key, std::less<>, KeyContainer>;
3131
{
@@ -50,15 +50,23 @@ void test_one() {
5050
}
5151
}
5252

53-
void test() {
53+
constexpr bool test() {
5454
test_one<std::vector<int>>();
55-
test_one<std::deque<int>>();
55+
#ifndef __cpp_lib_constexpr_deque
56+
if (!TEST_IS_CONSTANT_EVALUATED)
57+
#endif
58+
test_one<std::deque<int>>();
5659
test_one<MinSequenceContainer<int>>();
5760
test_one<std::vector<int, min_allocator<int>>>();
61+
62+
return true;
5863
}
5964

6065
int main(int, char**) {
6166
test();
67+
#if TEST_STD_VER >= 26
68+
static_assert(test());
69+
#endif
6270

6371
return 0;
6472
}

libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.operations/find_transparent.pass.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static_assert(!CanFind<NonTransparentSet>);
3636
static_assert(!CanFind<const NonTransparentSet>);
3737

3838
template <class KeyContainer>
39-
void test_one() {
39+
constexpr void test_one() {
4040
using Key = typename KeyContainer::value_type;
4141
using M = std::flat_multiset<Key, TransparentComparator, KeyContainer>;
4242

@@ -77,9 +77,12 @@ void test_one() {
7777
}
7878
}
7979

80-
void test() {
80+
constexpr bool test() {
8181
test_one<std::vector<std::string>>();
82-
test_one<std::deque<std::string>>();
82+
#ifndef __cpp_lib_constexpr_deque
83+
if (!TEST_IS_CONSTANT_EVALUATED)
84+
#endif
85+
test_one<std::deque<std::string>>();
8386
test_one<MinSequenceContainer<std::string>>();
8487
test_one<std::vector<std::string, min_allocator<std::string>>>();
8588

@@ -101,10 +104,15 @@ void test() {
101104
auto it2 = m.find("charlie");
102105
assert(it2 == m.end());
103106
}
107+
108+
return true;
104109
}
105110

106111
int main(int, char**) {
107112
test();
113+
#if TEST_STD_VER >= 26
114+
static_assert(test());
115+
#endif
108116

109117
return 0;
110118
}

libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.operations/lower_bound.pass.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "min_allocator.h"
2525

2626
template <class KeyContainer>
27-
void test_one() {
27+
constexpr void test_one() {
2828
using Key = typename KeyContainer::value_type;
2929
{
3030
using M = std::flat_multiset<Key, std::less<>, KeyContainer>;
@@ -66,15 +66,23 @@ void test_one() {
6666
}
6767
}
6868

69-
void test() {
69+
constexpr bool test() {
7070
test_one<std::vector<int>>();
71-
test_one<std::deque<int>>();
71+
#ifndef __cpp_lib_constexpr_deque
72+
if (!TEST_IS_CONSTANT_EVALUATED)
73+
#endif
74+
test_one<std::deque<int>>();
7275
test_one<MinSequenceContainer<int>>();
7376
test_one<std::vector<int, min_allocator<int>>>();
77+
78+
return true;
7479
}
7580

7681
int main(int, char**) {
7782
test();
83+
#if TEST_STD_VER >= 26
84+
static_assert(test());
85+
#endif
7886

7987
return 0;
8088
}

libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.operations/lower_bound_transparent.pass.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static_assert(!CanLowerBound<NonTransparentSet>);
3636
static_assert(!CanLowerBound<const NonTransparentSet>);
3737

3838
template <class KeyContainer>
39-
void test_one() {
39+
constexpr void test_one() {
4040
using Key = typename KeyContainer::value_type;
4141
using M = std::flat_multiset<Key, TransparentComparator, KeyContainer>;
4242

@@ -83,9 +83,12 @@ void test_one() {
8383
}
8484
}
8585

86-
void test() {
86+
constexpr bool test() {
8787
test_one<std::vector<std::string>>();
88-
test_one<std::deque<std::string>>();
88+
#ifndef __cpp_lib_constexpr_deque
89+
if (!TEST_IS_CONSTANT_EVALUATED)
90+
#endif
91+
test_one<std::deque<std::string>>();
8992
test_one<MinSequenceContainer<std::string>>();
9093
test_one<std::vector<std::string, min_allocator<std::string>>>();
9194

@@ -107,10 +110,15 @@ void test() {
107110
auto it2 = m.lower_bound("charlie");
108111
assert(it2 == m.begin() + 3);
109112
}
113+
114+
return true;
110115
}
111116

112117
int main(int, char**) {
113118
test();
119+
#if TEST_STD_VER >= 26
120+
static_assert(test());
121+
#endif
114122

115123
return 0;
116124
}

0 commit comments

Comments
 (0)