You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SECTION("test async function") {
std::condition_variable cv;
std::mutex cvMutex;
REQUIRE_CALL(myMock, call_async())
.LR_SIDE_EFFECT(cv.notify_all());
// wrapper contains an instance of the mock which is called on the other side of an RPC
wrapper.call_async();
// In order to prevent timing out the REQUIRE_CALL, I need to wait for the call to end before the block exits.
std::unique_lock<std::mutex> lock(cvMutex);
// specify a timeout of 1s. This normally takes less than 1s during a successful test
REQUIRE(cv.wait_for(lock, 1s) == std::cv_status::no_timeout);
}
I would love a way to wrap this very verbose functionality. Maybe like this:
SECTION("test async function") {
REQUIRE_CALL(myMock, call_async())
.ASYNC_TIMEOUT(1s);
wrapper.call_async();
// could also wrap the call in a macro if neccecary...
}
The text was updated successfully, but these errors were encountered:
considering the following code:
I would love a way to wrap this very verbose functionality. Maybe like this:
The text was updated successfully, but these errors were encountered: