diff options
author | Jonathan Wakely <github@kayari.org> | 2025-09-12 01:42:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-11 20:42:08 -0400 |
commit | 69e3ff67ac69f3a1177910cffefce19034563b7c (patch) | |
tree | 97a61869e82caa973047314b0bd24a97a02c162f /libcxx/test/std/algorithms | |
parent | 6040c007e3dd3339299786eae78246036d68d954 (diff) | |
download | llvm-69e3ff67ac69f3a1177910cffefce19034563b7c.zip llvm-69e3ff67ac69f3a1177910cffefce19034563b7c.tar.gz llvm-69e3ff67ac69f3a1177910cffefce19034563b7c.tar.bz2 |
[libc++] Fix ranges_rotate.pass.cpp complexity checks (#158144)
The complexity is "at most N swaps" _for each invocation of `rotate`_,
but the tests currently assert that the total number of swaps for N
calls is at most N. The standard allows that to be N squared, so the
test is either requiring more than the standard (and the comment in the
test) promises, or somebody just forgot to reset the counter on each
iteration.
Diffstat (limited to 'libcxx/test/std/algorithms')
-rw-r--r-- | libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/ranges_rotate.pass.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/ranges_rotate.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/ranges_rotate.pass.cpp index 5f59440..574e96d 100644 --- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/ranges_rotate.pass.cpp +++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate/ranges_rotate.pass.cpp @@ -173,6 +173,7 @@ constexpr bool test() { auto end = adl::Iterator::TrackSwaps(in.data() + in.size(), swaps); for (std::size_t mid = 0; mid != input.size(); ++mid) { + swaps = 0; std::ranges::rotate(begin, begin + mid, end); assert(swaps <= expected); } @@ -186,6 +187,7 @@ constexpr bool test() { auto range = std::ranges::subrange(begin, end); for (std::size_t mid = 0; mid != input.size(); ++mid) { + swaps = 0; std::ranges::rotate(range, begin + mid); assert(swaps <= expected); } |