|
void | triggerClearEvent (const std::string &event) |
| Triggers a clear event. If a call to barricade is currently pending it will unblock as soon as all clear events are triggered. Else the event is put on the waitlist. This waitlist is emptied upon a call to barricade.
|
|
bool | barricade (const std::string &clear_event, const int timeout_ms=-1) |
| Will block until the event given by clear_event is triggered or a timeout is reached. Unblocks immediately, if the event was on the waitlist.
|
|
bool | barricade (std::initializer_list< std::string > clear_events, const int timeout_ms=-1) |
| Will block until all events given by clear_events are triggered or a timeout is reached. Events on the waitlist are taken into account, too.
|
|
Test class that allows the handling of asynchronous test objects.
The class provides the two basic functions AsyncTest::barricade and AsyncTest::triggerClearEvent. During the test setup gates between the steps with one or more clear events. Allow passing on by calling triggerClearEvent after a test.
Usage:
Suppose you want to test a function that calls another function asynchronously, like the following example:
void asyncCall(std::function<void()> fun)
{
std::thread t(fun);
t.detach();
}
You expect that fun gets called, so your test thread has to wait for the completion, else it would fail. This can be achieved via:
{
public:
MOCK_METHOD0(myMethod, void());
};
{
const int timeout_ms {100};
asyncCall([this]{ myMethod(); });
BARRIER(
"myMethod", timeout_ms) <<
"Timed-out waiting for myMethod call.";
}
#define ACTION_OPEN_BARRIER_VOID(str)
Test class that allows the handling of asynchronous test objects.
TEST_F(BulletCollisionDetectionTester, DISABLED_ContinuousCollisionSelf)
Continuous self collision checks are not supported yet by the bullet integration.
Definition at line 69 of file async_test.h.