Add test cases for iteration over the ordered associative container from end to begin using operator--
Details
- Reviewers
rarutyun ldionne zoecarver Mordante • Quuxplusone - Group Reviewers
Restricted Project - Commits
- rG6a929492a603: [libcxx][test][NFC] Add tests for backward iteration over associative
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| libcxx/test/std/containers/associative/map/map.ops/count.pass.cpp | ||
|---|---|---|
| 110–145 ↗ | (On Diff #402800) | This test case is intended to improve code coverage of the libc++ implementation of map. The implementation uses helper class __map_value_compare for EBO: template <class _Key, class _CP, class _Compare,
bool = is_empty_v<_Compare> && !is_final_v<_Compare>>
class __map_value_compare : private _Compare { /*...*/};
template <class _Key, class _CP, class _Compare>
class __map_value_compare<_Key, _CP, _Compare, false>
{
_Compare comp;
/*...*/
};To test both generic template and the specialization, we need additional test-case for final comparator. |
| libcxx/test/std/containers/associative/map/map.ops/count.pass.cpp | ||
|---|---|---|
| 110–145 ↗ | (On Diff #402800) | Having not looked closely at all, I suggest we pull the whole body of main out into void test() { ~~~ } so that main becomes a two-liner; and then we make test into a template. template<class Compare>
void test() {
~~~
}
int main(int, char**)
{
test<std::less<int>>();
#if TEST_STD_VER >= 11
test<FinalCompare<int>>();
#endif
#if TEST_STD_VER > 11
test<std::less<>>();
#endif
}Or do all the different tests here use different key types so this idea would end up being complicated? Might also make sense to move this discussion/diff into its own separate PR, on the assumption that every other diff here is uncontroversial. (Every other diff is just testing backward iteration, right?) |
Perhaps, after line 88, assert(i == m.begin()); . Ditto throughout.