tests-mbed_drivers-lp_timeout: Rework "Zero delay" test case

Execute test case 100 times in loop since one run is not enough to catch possible failure.
pull/10536/head
Przemyslaw Stekiel 2019-05-31 10:33:29 +02:00
parent 874ff1fe22
commit 48fdd33db8
1 changed files with 8 additions and 7 deletions

View File

@ -196,13 +196,14 @@ void test_multiple(void)
template<typename T>
void test_no_wait(void)
{
Semaphore sem(0, 1);
T timeout;
timeout.attach_callback(mbed::callback(sem_callback, &sem), 0ULL);
bool acquired = sem.try_acquire();
TEST_ASSERT_TRUE(acquired);
timeout.detach();
for (int i = 0; i < 100; i++) {
Semaphore sem(0, 1);
T timeout;
timeout.attach_callback(mbed::callback(sem_callback, &sem), 0ULL);
int32_t sem_slots = sem.wait(0);
TEST_ASSERT_EQUAL(1, sem_slots);
timeout.detach();
}
}
/** Template for tests: accuracy of timeout delay