22 #if FOLLY_HAS_COROUTINES 28 Optional<double> f2(
int x) {
33 Optional<std::unique_ptr<int>> f3(
int x,
double y) {
34 return std::make_unique<int>((int)(x + y));
37 TEST(Optional, CoroutineSuccess) {
38 auto r0 = []() -> Optional<int> {
39 auto x = co_await f1();
41 auto y = co_await f2(
x);
43 auto z = co_await f3(
x,
y);
51 Optional<int> f4(
int,
double) {
55 TEST(Optional, CoroutineFailure) {
56 auto r1 = []() -> Optional<int> {
57 auto x = co_await f1();
58 auto y = co_await f2(
x);
59 auto z = co_await f4(
x,
y);
66 Optional<int>
throws() {
70 TEST(Optional, CoroutineException) {
72 auto r2 = []() -> Optional<int> {
73 auto x = co_await
throws();
87 TEST(Optional, CoroutineCleanedUp) {
89 auto r = [&]() -> Optional<int> {
#define TEST(test_case_name, test_name)
#define EXPECT_EQ(val1, val2)
#define EXPECT_TRUE(condition)
#define EXPECT_FALSE(condition)