| 91 | } |
| 92 | |
| 93 | boost::asio::awaitable<void> generator_test() |
| 94 | { |
| 95 | int val = 0; |
| 96 | bool destr = false; |
| 97 | { |
| 98 | auto gi = generator_impl( |
| 99 | co_await boost::asio::this_coro::executor, val, destr); |
| 100 | |
| 101 | for (int i = 0; i < 10; i++) |
| 102 | { |
| 103 | BOOST_ASIO_CHECK(val == i); |
| 104 | const auto next = co_await gi.async_resume(boost::asio::use_awaitable); |
| 105 | BOOST_ASIO_CHECK(next); |
| 106 | BOOST_ASIO_CHECK(val == *next); |
| 107 | BOOST_ASIO_CHECK(val == i + 1); |
| 108 | } |
| 109 | |
| 110 | BOOST_ASIO_CHECK(!destr); |
| 111 | } |
| 112 | BOOST_ASIO_CHECK(destr); |
| 113 | }; |
| 114 | |
| 115 | void run_generator_test() |
| 116 | { |
nothing calls this directly
no test coverage detected