Skip to content

Commit 46b3642

Browse files
committed
transparent tests
1 parent 137cfef commit 46b3642

File tree

7 files changed

+61
-0
lines changed

7 files changed

+61
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ void test() {
138138
assert(n == 1);
139139
assert(transparent_used);
140140
}
141+
{
142+
// std::string and C string literal
143+
using M = std::flat_multiset<std::string, std::less<>>;
144+
M m = {"alpha", "beta", "beta", "epsilon", "eta", "gamma"};
145+
auto n = m.erase("beta");
146+
assert(n == 2);
147+
assert((m == M{"alpha", "epsilon", "eta", "gamma"}));
148+
}
141149
}
142150

143151
void test_exception() {

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

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

1515
#include <cassert>
1616
#include <flat_set>
17+
#include <functional>
1718
#include <string>
1819
#include <utility>
1920
#include <deque>
@@ -74,6 +75,13 @@ void test() {
7475
assert(b);
7576
assert(transparent_used);
7677
}
78+
{
79+
// std::string and C string literal
80+
using M = std::flat_multiset<std::string, std::less<>>;
81+
M m = {"alpha", "beta", "beta", "epsilon", "eta", "gamma"};
82+
assert(m.contains("beta"));
83+
assert(!m.contains("charlie"));
84+
}
7785
}
7886

7987
int main(int, char**) {

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <cassert>
1616
#include <deque>
1717
#include <flat_set>
18+
#include <functional>
1819
#include <string>
1920
#include <utility>
2021

@@ -73,6 +74,13 @@ void test() {
7374
assert(n == 4);
7475
assert(transparent_used);
7576
}
77+
{
78+
// std::string and C string literal
79+
using M = std::flat_multiset<std::string, std::less<>>;
80+
M m = {"alpha", "beta", "beta", "epsilon", "eta", "gamma"};
81+
auto n = m.count("beta");
82+
assert(n == 2);
83+
}
7684
}
7785

7886
int main(int, char**) {

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <cassert>
1717
#include <deque>
1818
#include <flat_set>
19+
#include <functional>
1920
#include <string>
2021
#include <utility>
2122

@@ -104,6 +105,14 @@ void test() {
104105
assert(p.first != p.second);
105106
assert(transparent_used);
106107
}
108+
{
109+
// std::string and C string literal
110+
using M = std::flat_multiset<std::string, std::less<>>;
111+
M m = {"alpha", "beta", "beta", "epsilon", "eta", "gamma"};
112+
auto [first, last] = m.equal_range("beta");
113+
assert(first == m.begin() + 1);
114+
assert(last == m.begin() + 3);
115+
}
107116
}
108117

109118
int main(int, char**) {

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <cassert>
1717
#include <deque>
1818
#include <flat_set>
19+
#include <functional>
1920
#include <string>
2021
#include <utility>
2122

@@ -91,6 +92,15 @@ void test() {
9192
assert(it != m.end());
9293
assert(transparent_used);
9394
}
95+
{
96+
// std::string and C string literal
97+
using M = std::flat_multiset<std::string, std::less<>>;
98+
M m = {"alpha", "beta", "beta", "epsilon", "eta", "gamma"};
99+
auto it = m.find("beta");
100+
assert(it == m.begin() + 1);
101+
auto it2 = m.find("charlie");
102+
assert(it2 == m.end());
103+
}
94104
}
95105

96106
int main(int, char**) {

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <cassert>
1717
#include <deque>
1818
#include <flat_set>
19+
#include <functional>
1920
#include <string>
2021
#include <utility>
2122

@@ -97,6 +98,15 @@ void test() {
9798
assert(it != m.end());
9899
assert(transparent_used);
99100
}
101+
{
102+
// std::string and C string literal
103+
using M = std::flat_multiset<std::string, std::less<>>;
104+
M m = {"alpha", "beta", "beta", "epsilon", "eta", "gamma"};
105+
auto it = m.lower_bound("beta");
106+
assert(it == m.begin() + 1);
107+
auto it2 = m.lower_bound("charlie");
108+
assert(it2 == m.begin() + 3);
109+
}
100110
}
101111

102112
int main(int, char**) {

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <cassert>
1717
#include <deque>
1818
#include <flat_set>
19+
#include <functional>
1920
#include <string>
2021
#include <utility>
2122

@@ -97,6 +98,13 @@ void test() {
9798
assert(it != m.end());
9899
assert(transparent_used);
99100
}
101+
{
102+
// std::string and C string literal
103+
using M = std::flat_multiset<std::string, std::less<>>;
104+
M m = {"alpha", "beta", "beta", "epsilon", "eta", "gamma"};
105+
auto it = m.upper_bound("beta");
106+
assert(it == m.begin() + 3);
107+
}
100108
}
101109

102110
int main(int, char**) {

0 commit comments

Comments
 (0)