[libcxx-commits] [PATCH] D145287: [libc++] Fix ranges::binary_search() returning true for cases where the element is not in the range
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Mar 4 03:56:55 PST 2023
Mordante added inline comments.
================
Comment at: libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/ranges.lower_bound.pass.cpp:202
+ auto ret = std::ranges::lower_bound(It(a), It(a + 7), 5);
+ assert(base(ret) == a + 4);
+ }
----------------
Please test the value of `*ret` too. I know it's kind of double but it makes the test easier to understand.
(The same for `upper_bound`.)
Do you know why these test don't use `std::begin(a)` and `std::end(a)`. To me that makes clear it tests the entire range and I don't need to count the elements.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145287/new/
https://reviews.llvm.org/D145287
More information about the libcxx-commits
mailing list