Skip to content

Commit 6a5062c

Browse files
committed
Adapt tests-mbedmicro-rtos-mbed-mutex test - use new void unlock(void) function
1 parent e7b8e30 commit 6a5062c

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

TESTS/mbedmicro-rtos-mbed/mutex/main.cpp

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ bool manipulate_protected_zone(const int thread_delay)
6868
changing_counter = false;
6969
core_util_critical_section_exit();
7070

71-
stat = stdio_mutex.unlock();
72-
TEST_ASSERT_EQUAL(osOK, stat);
71+
stdio_mutex.unlock();
72+
7373
return result;
7474
}
7575

@@ -121,17 +121,15 @@ void test_dual_thread_nolock_lock_thread(Mutex *mutex)
121121
osStatus stat;
122122
mutex->lock();
123123

124-
stat = mutex->unlock();
125-
TEST_ASSERT_EQUAL(osOK, stat);
124+
mutex->unlock();
126125
}
127126

128127
void test_dual_thread_nolock_trylock_thread(Mutex *mutex)
129128
{
130129
bool stat_b = mutex->trylock();
131130
TEST_ASSERT_EQUAL(true, stat_b);
132131

133-
osStatus stat = mutex->unlock();
134-
TEST_ASSERT_EQUAL(osOK, stat);
132+
mutex->unlock();
135133
}
136134

137135
/** Test dual thread no-lock
@@ -140,13 +138,13 @@ void test_dual_thread_nolock_trylock_thread(Mutex *mutex)
140138
Given two threads A & B and a mutex
141139
When thread A creates a mutex and starts thread B
142140
and thread B calls @a lock and @a unlock
143-
Then returned statuses are osOK
141+
Then @a lock and @a unlock operations are successfully performed.
144142
145143
Test dual thread second thread trylock
146144
Given two threads A & B and a mutex
147145
When thread A creates a mutex and starts thread B
148146
and thread B calls @a trylock and @a unlock
149-
Then returned statuses are true and osOK
147+
Then @a trylock and @a unlock operations are successfully performed.
150148
*/
151149
template <void (*F)(Mutex *)>
152150
void test_dual_thread_nolock(void)
@@ -183,8 +181,7 @@ void test_dual_thread_lock_unlock(void)
183181

184182
thread.start(callback(test_dual_thread_lock_unlock_thread, &mutex));
185183

186-
stat = mutex.unlock();
187-
TEST_ASSERT_EQUAL(osOK, stat);
184+
mutex.unlock();
188185

189186
wait_ms(TEST_DELAY);
190187
}
@@ -232,15 +229,14 @@ void test_dual_thread_lock(void)
232229

233230
wait_ms(TEST_LONG_DELAY);
234231

235-
stat = mutex.unlock();
236-
TEST_ASSERT_EQUAL(osOK, stat);
232+
mutex.unlock();
237233
}
238234

239235
/** Test single thread lock recursive
240236
241237
Given a mutex and a single running thread
242238
When thread calls @a lock twice and @a unlock twice on the mutex
243-
Then the returned statuses are osOK
239+
Then @a lock and @a unlock operations are successfully performed.
244240
*/
245241
void test_single_thread_lock_recursive(void)
246242
{
@@ -251,18 +247,16 @@ void test_single_thread_lock_recursive(void)
251247

252248
mutex.lock();
253249

254-
stat = mutex.unlock();
255-
TEST_ASSERT_EQUAL(osOK, stat);
250+
mutex.unlock();
256251

257-
stat = mutex.unlock();
258-
TEST_ASSERT_EQUAL(osOK, stat);
252+
mutex.unlock();
259253
}
260254

261255
/** Test single thread trylock
262256
263257
Given a mutex and a single running thread
264258
When thread calls @a trylock and @a unlock on the mutex
265-
Then the returned statuses are osOK
259+
Then @a trylock and @a unlock operations are successfully performed.
266260
*/
267261
void test_single_thread_trylock(void)
268262
{
@@ -271,15 +265,14 @@ void test_single_thread_trylock(void)
271265
bool stat_b = mutex.trylock();
272266
TEST_ASSERT_EQUAL(true, stat_b);
273267

274-
osStatus stat = mutex.unlock();
275-
TEST_ASSERT_EQUAL(osOK, stat);
268+
mutex.unlock();
276269
}
277270

278271
/** Test single thread lock
279272
280273
Given a mutex and a single running thread
281274
When thread calls @a lock and @a unlock on the mutex
282-
Then the returned statuses are osOK
275+
Then @a lock and @a unlock operations are successfully performed.
283276
*/
284277
void test_single_thread_lock(void)
285278
{
@@ -288,8 +281,7 @@ void test_single_thread_lock(void)
288281

289282
mutex.lock();
290283

291-
stat = mutex.unlock();
292-
TEST_ASSERT_EQUAL(osOK, stat);
284+
mutex.unlock();
293285
}
294286

295287
utest::v1::status_t test_setup(const size_t number_of_cases)

0 commit comments

Comments
 (0)