src/base/coroutine.test.cc
/**
 * This test is stressing the scenario where two distinct fibers are
 * calling the same coroutine.  First the test instantiates (and runs) a
 * coroutine, then spawns another one and it passes it a reference to
 * the first coroutine. Once the new coroutine calls the first coroutine
 * and the first coroutine yields, we are expecting execution flow to
 * be yielded to the second caller (the second coroutine) and not the
 * original caller (the test itself)
 */
This test is stressing the scenario where two distinct fibers are
calling the same coroutine.  First the test instantiates (and runs) a
coroutine, then spawns another one and it passes it a reference to
the first coroutine. Once the new coroutine calls the first coroutine
and the first coroutine yields, we are expecting execution flow to
be yielded to the second caller (the second coroutine) and not the
original caller (the test itself)
This test is stressing the scenario where two distinct fibers are calling the same coroutine . First the test instantiates ( and runs ) a coroutine then spawns another one and it passes it a reference to the first coroutine . Once the new coroutine calls the first coroutine and the first coroutine yields we are expecting execution flow to be yielded to the second caller ( the second coroutine ) and not the original caller ( the test itself )
TEST(Coroutine, TwoCallers)
{
    bool valid_return = false;
    Coroutine<void, void> callee{[]
        (Coroutine<void, void>::CallerType& yield)
    {
        yield();
        yield();
    }};
    Coroutine<void, void> other_caller{[&callee, &valid_return]
        (Coroutine<void, void>::CallerType& yield)
    {
        callee();
        valid_return = true;
        yield();
    }};
    ASSERT_TRUE(valid_return);
}
TEST ( Coroutine , TwoCallers ) { bool valid_return = false ; Coroutine < void , void > callee { [ ] ( Coroutine < void , void > :: CallerType & yield ) { yield ( ) ; yield ( ) ; } } ; Coroutine < void , void > other_caller { [ & callee , & valid_return ] ( Coroutine < void , void > :: CallerType & yield ) { callee ( ) ; valid_return = true ; yield ( ) ; } } ; ASSERT_TRUE ( valid_return ) ; }
This test is stressing the scenario where two distinct fibers are
 calling the same coroutine.
This test is stressing the scenario where two distinct fibers are calling the same coroutine .