Commit 950a034
authored
Fix ranges_rotate.pass.cpp complexity checks
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.
If the intent really is to verify the libc++ guarantee, not the standard one, then shouldn't `expected` be set to N/2 i.e. 5, since that's what libc++ actually does?
Either way, to be portable to other implementations, swaps should be reset on each loop. If you want to guard that with `#ifndef _LIBCPP_VERSION` it would not change the test for libc++.1 parent 73e64e5 commit 950a034
File tree
1 file changed
+2
-0
lines changed- libcxx/test/std/algorithms/alg.modifying.operations/alg.rotate
1 file changed
+2
-0
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| |||
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
| 190 | + | |
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
| |||
0 commit comments