Skip to content

Commit 48fdd33

Browse files
committed
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.
1 parent 874ff1f commit 48fdd33

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

TESTS/mbed_drivers/timeout/timeout_tests.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,14 @@ void test_multiple(void)
196196
template<typename T>
197197
void test_no_wait(void)
198198
{
199-
Semaphore sem(0, 1);
200-
T timeout;
201-
timeout.attach_callback(mbed::callback(sem_callback, &sem), 0ULL);
202-
203-
bool acquired = sem.try_acquire();
204-
TEST_ASSERT_TRUE(acquired);
205-
timeout.detach();
199+
for (int i = 0; i < 100; i++) {
200+
Semaphore sem(0, 1);
201+
T timeout;
202+
timeout.attach_callback(mbed::callback(sem_callback, &sem), 0ULL);
203+
int32_t sem_slots = sem.wait(0);
204+
TEST_ASSERT_EQUAL(1, sem_slots);
205+
timeout.detach();
206+
}
206207
}
207208

208209
/** Template for tests: accuracy of timeout delay

0 commit comments

Comments
 (0)