3 // Test co-await in while condition.
7 // boiler-plate for tests of codegen
8 #include "../coro1-ret-int-yield-int.h"
10 /* An awaiter that suspends always and returns an int as the
11 await_resume output. */
14 IntAwaiter (int _v) : v(_v) {}
15 bool await_ready () { return false; }
16 void await_suspend (coro::coroutine_handle<>) {}
17 int await_resume () { return v; }
24 for (int x = co_await IntAwaiter (3); x < 10; x++)
35 for (x = co_await IntAwaiter (3); x < 10; x++)
46 for (co_await IntAwaiter (3); x < 10; x++)
53 check_a_coro (struct coro1& x)
57 PRINT ("check_a_coro: apparently done when we shouldn't be...");
61 PRINT ("check_a_coro: resume initial suspend");
64 // will be false - so no yield expected.
65 PRINT ("check_a_coro: resume for init");
68 int y = x.handle.promise().get_value();
71 PRINTF ("check_a_coro: apparently wrong value : %d\n", y);
77 PRINT ("check_a_coro: apparently not done...");
85 struct coro1 x = coro_a (false);
90 struct coro1 x = coro_b (false);
95 struct coro1 x = coro_c (false);