src/base/coroutine.test.cc
/**
 * This test is checking the parameter passing interface of a
 * coroutine which takes an integer as an argument.
 * Coroutine::operator() and CallerType::get() are the tested
 * APIS.
 */
This test is checking the parameter passing interface of a
coroutine which takes an integer as an argument.
Coroutine::operator() and CallerType::get() are the tested
APIS.
This test is checking the parameter passing interface of a coroutine which takes an integer as an argument . Coroutine :: operator () and CallerType :: get () are the tested APIS .
TEST(Coroutine, Passing)
{
    const std::vector<int> input{ 1, 2, 3 };
    const std::vector<int> expected_values = input;
    auto passing_task =
    [&expected_values] (Coroutine<int, void>::CallerType& yield)
    {
        int argument;
        for (const auto expected : expected_values) {
            argument = yield.get();
            ASSERT_EQ(argument, expected);
        }
    };
    Coroutine<int, void> coro(passing_task);
    ASSERT_TRUE(coro);
    for (const auto val : input) {
        coro(val);
    }
}
TEST ( Coroutine , Passing ) { const std :: vector < int > input { 1 , 2 , 3 } ; const std :: vector < int > expected_values = input ; auto passing_task = [ & expected_values ] ( Coroutine < int , void > :: CallerType & yield ) { int argument ; for ( const auto expected : expected_values ) { argument = yield . get ( ) ; ASSERT_EQ ( argument , expected ) ; } } ; Coroutine < int , void > coro ( passing_task ) ; ASSERT_TRUE ( coro ) ; for ( const auto val : input ) { coro ( val ) ; } }
This test is checking the parameter passing interface of a
 coroutine which takes an integer as an argument.
This test is checking the parameter passing interface of a coroutine which takes an integer as an argument .