Range matchers do not stringify a range produced by std::generator<>
Range matchers do not stringify ranges produced by synchronous co_yield generator.
#include <catch2/catch_all.hpp>
#include <generator>
#include <ranges>
TEST_CASE("fibonacci")
{
auto fibonacci = []<typename T = int>() -> std::generator<int>
{
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
Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our contributing guide.
Hello 👋! It looks like this issue hasn’t been active in longer than five months. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.