MCPcopy Create free account
hub / github.com/boostorg/asio / generator_test

Function generator_test

test/experimental/coro/simple_test.cpp:93–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93boost::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
115void run_generator_test()
116{

Callers

nothing calls this directly

Calls 2

generator_implFunction · 0.85
async_resumeMethod · 0.45

Tested by

no test coverage detected