| 205 | } |
| 206 | |
| 207 | djinni::Future<std::string> TestHelpers::check_async_interface(const std::shared_ptr<AsyncInterface> & i) { |
| 208 | #ifdef DJINNI_FUTURE_HAS_COROUTINE_SUPPORT |
| 209 | auto f1 = [] () -> djinni::Future<std::string> { |
| 210 | co_return "36"; |
| 211 | }; |
| 212 | auto f2 = [] (auto f1) -> djinni::Future<int> { |
| 213 | co_return std::stoi(co_await f1); |
| 214 | }; |
| 215 | auto f3 = i->future_roundtrip(f2(f1())); |
| 216 | return f3; |
| 217 | #else |
| 218 | djinni::Promise<std::string> p; |
| 219 | auto f = p.getFuture(); |
| 220 | auto f2 = f.then([] (djinni::Future<std::string> s) { |
| 221 | return std::stoi(s.get()); |
| 222 | }); |
| 223 | auto f3 = i->future_roundtrip(std::move(f2)); |
| 224 | p.setValue("36"); |
| 225 | return f3; |
| 226 | #endif |
| 227 | } |
| 228 | |
| 229 | djinni::Future<std::string> TestHelpers::check_async_composition(const std::shared_ptr<AsyncInterface> & i) { |
| 230 | djinni::Promise<std::string> p1; |
nothing calls this directly
no test coverage detected