Skip to content

Commit 13943f2

Browse files
author
Rohit Grover
committed
tests: simplify the handling of errors from FlashJournal_initialize()
1 parent 4fcf7ed commit 13943f2

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

features/storage/TESTS/flash_journal/basicAPI/basicAPI.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,11 @@ control_t test_logSmallWithoutCommit(const size_t call_count)
228228
/* initialize */
229229
rc = FlashJournal_initialize(&journal, drv, &FLASH_JOURNAL_STRATEGY_SEQUENTIAL, callbackHandler);
230230
TEST_ASSERT(rc >= ARM_DRIVER_OK);
231-
if (drv->GetCapabilities().asynchronous_ops) {
232-
if (rc == ARM_DRIVER_OK) {
233-
return CaseTimeout(200) + CaseRepeatAll;
234-
} else {
235-
return CaseRepeatAll;
236-
}
237-
} else {
238-
return CaseRepeatAll;
231+
if (rc == ARM_DRIVER_OK) {
232+
return CaseTimeout(200) + CaseRepeatAll;
239233
}
240-
break;
234+
TEST_ASSERT_EQUAL(1, rc); /* synchronous completion of initialize() is expected to return 1 */
235+
return CaseRepeatAll;
241236

242237
case 2:
243238
/* log without commit */
@@ -346,15 +341,11 @@ control_t test_logLargeWithoutCommit(const size_t call_count)
346341
case 1:
347342
rc = FlashJournal_initialize(&journal, drv, &FLASH_JOURNAL_STRATEGY_SEQUENTIAL, callbackHandler);
348343
TEST_ASSERT(rc >= ARM_DRIVER_OK);
349-
if (drv->GetCapabilities().asynchronous_ops) {
350-
if (rc == ARM_DRIVER_OK) {
351-
return CaseTimeout(200) + CaseRepeatAll;
352-
} else {
353-
return CaseRepeatAll;
354-
}
355-
} else {
356-
return CaseRepeatAll;
344+
if (rc == ARM_DRIVER_OK) {
345+
return CaseTimeout(200) + CaseRepeatAll;
357346
}
347+
TEST_ASSERT_EQUAL(1, rc); /* synchronous completion of initialize() is expected to return 1 */
348+
return CaseRepeatAll;
358349

359350
case 2:
360351
memset(buffer, 0xAA, SIZEOF_LARGE_WRITE);

0 commit comments

Comments
 (0)