STL
STL copied to clipboard
<algorithm>: randomized test coverage for std::search_n and ranges::search_n
We've been bitten by bugs in the deceptively simple search_n algorithm in the past, and ranges::search_n makes some slightly different implementation choices from std::search_n. It would raise confidence in the correctness of those choices if we had a test that searched random strings of binary digits for sequences of 0s or 1s of randomly-chosen lengths and validated that ranges::search_n and std::search_n produce identical correct results.
(Such a randomized test must ensure reproducibility and could do so by following the model of tests/std/tests/P0067R5_charconv/test.cpp.)