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/11023/head
Przemyslaw Stekiel 2019-05-31 10:33:29 +02:00 committed by Evelyne Donnaes
parent f1044a7de5
commit aba5ca72cd
1 changed files with 8 additions and 7 deletions

View File

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