Range matchers do not stringify a range produced by std::generator<>
- Dominant language
- C++
- Stars
- 21.5k
- Forks
- 3.5k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 2
Description
Range matchers do not stringify ranges produced by synchronous co_yield generator.
```c++
#include
#include
#include
TEST_CASE("fibonacci")
{
auto fibonacci = []() -> std::generator
{
T j = 0;
T i = 1;
co_yield j;
for(;;) {
co_yield i;
T tmp = i;
i += j;
j = tmp;
}
};
CHECK_THAT(fibonacci() | std::views::take(7), Catch::Matchers::RangeEquals(std::array{0, 1, 1, 2, 3, 5, 9}));
}
```
**Expected behavior**
```
FAILED:
CHECK_THAT( fibonacci() | std::views::take(7), Catch::Matchers::RangeEquals(std::array{0, 1, 1, 2, 3, 5, 9}) )
with expansion:
{ 0, 1, 1, 2, 3, 5, 8 } elements are { 0, 1, 1, 2, 3, 5, 9 }
```
**Actual behaviour**
```
FAILED:
CHECK_THAT( fibonacci() | std::views::take(7), Catch::Matchers::RangeEquals(std::array{0, 1, 1, 2, 3, 5, 9}) )
with expansion:
{?} elements are { 0, 1, 1, 2, 3, 5, 9 }
```
**Platform information:**
- OS: **Ubuntu 24.04**
- Compiler: **gcc-14**
- Catch version: **3.6.0**
Probably, related to #2646
Contributor guide
Assessment
This issue has not been assessed yet.