Skip to content

Commit 2f695b1

Browse files
committed
Use standard std::equal in fill/fill_n tests due to #126369
1 parent 26bc4d4 commit 2f695b1

File tree

4 files changed

+64
-8
lines changed

4 files changed

+64
-8
lines changed

libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,28 @@ TEST_CONSTEXPR_CXX20 void test_bititer_with_custom_sized_types() {
5656
std::vector<bool, Alloc> in(100, false, Alloc(1));
5757
std::vector<bool, Alloc> expected(100, true, Alloc(1));
5858
std::fill(in.begin(), in.end(), true);
59-
assert(in == expected);
59+
60+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
61+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
62+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
63+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
64+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
65+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
66+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
6067
}
6168
{
6269
using Alloc = sized_allocator<bool, std::uint16_t, std::int16_t>;
6370
std::vector<bool, Alloc> in(200, false, Alloc(1));
6471
std::vector<bool, Alloc> expected(200, true, Alloc(1));
6572
std::fill(in.begin(), in.end(), true);
66-
assert(in == expected);
73+
74+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
75+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
76+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
77+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
78+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
79+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
80+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
6781
}
6882
{
6983
using Alloc = sized_allocator<bool, std::uint32_t, std::int32_t>;

libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,28 @@ TEST_CONSTEXPR_CXX20 void test_bititer_with_custom_sized_types() {
117117
std::vector<bool, Alloc> in(100, false, Alloc(1));
118118
std::vector<bool, Alloc> expected(100, true, Alloc(1));
119119
std::fill_n(in.begin(), in.size(), true);
120-
assert(in == expected);
120+
121+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
122+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
123+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
124+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
125+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
126+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
127+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
121128
}
122129
{
123130
using Alloc = sized_allocator<bool, std::uint16_t, std::int16_t>;
124131
std::vector<bool, Alloc> in(200, false, Alloc(1));
125132
std::vector<bool, Alloc> expected(200, true, Alloc(1));
126133
std::fill_n(in.begin(), in.size(), true);
127-
assert(in == expected);
134+
135+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
136+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
137+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
138+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
139+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
140+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
141+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
128142
}
129143
{
130144
using Alloc = sized_allocator<bool, std::uint32_t, std::int32_t>;

libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill.pass.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,28 @@ TEST_CONSTEXPR_CXX20 void test_bititer_with_custom_sized_types() {
9191
std::vector<bool, Alloc> in(100, false, Alloc(1));
9292
std::vector<bool, Alloc> expected(100, true, Alloc(1));
9393
std::ranges::fill(in, true);
94-
assert(in == expected);
94+
95+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
96+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
97+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
98+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
99+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
100+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
101+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
95102
}
96103
{
97104
using Alloc = sized_allocator<bool, std::uint16_t, std::int16_t>;
98105
std::vector<bool, Alloc> in(200, false, Alloc(1));
99106
std::vector<bool, Alloc> expected(200, true, Alloc(1));
100107
std::ranges::fill(in, true);
101-
assert(in == expected);
108+
109+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
110+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
111+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
112+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
113+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
114+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
115+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
102116
}
103117
{
104118
using Alloc = sized_allocator<bool, std::uint32_t, std::int32_t>;

libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill_n.pass.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,28 @@ TEST_CONSTEXPR_CXX20 void test_bititer_with_custom_sized_types() {
6464
std::vector<bool, Alloc> in(100, false, Alloc(1));
6565
std::vector<bool, Alloc> expected(100, true, Alloc(1));
6666
std::ranges::fill_n(std::ranges::begin(in), in.size(), true);
67-
assert(in == expected);
67+
68+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
69+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
70+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
71+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
72+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
73+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
74+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
6875
}
6976
{
7077
using Alloc = sized_allocator<bool, std::uint16_t, std::int16_t>;
7178
std::vector<bool, Alloc> in(200, false, Alloc(1));
7279
std::vector<bool, Alloc> expected(200, true, Alloc(1));
7380
std::ranges::fill_n(std::ranges::begin(in), in.size(), true);
74-
assert(in == expected);
81+
82+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
83+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
84+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
85+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
86+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
87+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
88+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
7589
}
7690
{
7791
using Alloc = sized_allocator<bool, std::uint32_t, std::int32_t>;

0 commit comments

Comments
 (0)