mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
874ff1fe22
commit
48fdd33db8
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue