MCPcopy Create free account
hub / github.com/bloomberg/quantum / TEST

Function TEST

tests/quantum_generic_future_tests.cpp:25–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23using ms = std::chrono::milliseconds;
24
25TEST(GenericFuture, MakeFutureInCoroutineAndMainThread)
26{
27 Dispatcher& dispatcher = DispatcherSingleton::instance({false, false});
28 GenericFuture<int> threadFuture = dispatcher.post([](VoidContextPtr ctx)->int {
29 //post an IO task and get future from there
30 GenericFuture<int> coroFuture(ctx->postAsyncIo([]()->int {
31 return 33;
32 }), ctx);
33 return coroFuture.get(); //forward the promise to main thread
34 });
35 EXPECT_EQ(33, threadFuture.get()); //block until value is available
36}
37
38TEST(GenericFuture, WaitForCoroutineFutureInIoTask)
39{

Callers

nothing calls this directly

Calls 4

postMethod · 0.45
postAsyncIoMethod · 0.45
getMethod · 0.45
validMethod · 0.45

Tested by

no test coverage detected