38 #include <gtest/gtest.h>
57 const bool start_upon_creation =
false;
95 for (
const auto expected : expected_values) {
96 argument = yield.get();
104 for (
const auto val : input) {
120 auto returning_task =
123 for (
const auto ret :
output) {
131 for (
const auto expected : expected_values) {
132 int returned = coro.
get();
147 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233 };
149 const int steps = expected_values.size();
151 auto fibonacci_task =
157 for (
auto iter = 0; iter < steps; iter++) {
158 int sum = prev + current;
169 for (
const auto expected : expected_values) {
171 int returned = coro.
get();
187 const std::string caller_str(
"HloWrd");
188 const std::string coro_str(
"el ol!");
189 const std::string
expected(
"Hello World!");
191 auto cooperative_task =
194 for (
auto& appended_c : coro_str) {
195 auto old_str = yield.get();
196 yield(old_str + appended_c);
203 for (
auto&
c : caller_str) {
206 result = coro(result).
get();
220 const std::string wrong(
"Inner");
221 const std::string
expected(
"Inner + Outer");
226 std::string inner_string(
"Inner");
234 std::string inner_string = coro.
get();
236 std::string outer_string(
"Outer");
237 yield(inner_string +
" + " + outer_string);
244 std::string result = coro.
get();
246 ASSERT_NE(result, wrong);
261 bool valid_return =
false;
278 ASSERT_TRUE(valid_return);