MCPcopy Create free account
hub / github.com/Snapchat/djinni / check_async_interface

Method check_async_interface

test-suite/handwritten-src/cpp/test_helpers.cpp:207–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207djinni::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
229djinni::Future<std::string> TestHelpers::check_async_composition(const std::shared_ptr<AsyncInterface> & i) {
230 djinni::Promise<std::string> p1;

Callers

nothing calls this directly

Calls 5

getMethod · 0.65
future_roundtripMethod · 0.45
getFutureMethod · 0.45
thenMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected