Skip to content

Commit

Permalink
Update #1815 (WIP): Use "FLOW" testcase
Browse files Browse the repository at this point in the history
Use the new "FLOW" tag provided from UtAssert, and add an extra
tag to the MAY_BE use case to decode whether the condition was
a match/no match.
  • Loading branch information
jphickey committed Aug 18, 2021
1 parent 20b9dd9 commit 286c76e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion modules/cfe_assert/inc/cfe_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ typedef void (*CFE_Assert_StatusCallback_t)(uint8 MessageType, const char *Prefi
**
******************************************************************************/
#define CFE_Assert_STATUS_MAY_BE(expected) \
CFE_Assert_Status_DeferredCheck(expected, UTASSERT_CASETYPE_NA, __FILE__, __LINE__, #expected)
CFE_Assert_Status_DeferredCheck(expected, UTASSERT_CASETYPE_FLOW, __FILE__, __LINE__, #expected)

/*****************************************************************************/
/**
Expand Down
6 changes: 6 additions & 0 deletions modules/cfe_assert/src/cfe_assert_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ void UT_BSP_DoText(uint8 MessageType, const char *OutputMessage)
case UTASSERT_CASETYPE_TTF:
Prefix = "TTF";
break;
case UTASSERT_CASETYPE_WARN:
Prefix = "WARN";
break;
case UTASSERT_CASETYPE_NA:
Prefix = "N/A";
break;
Expand All @@ -129,6 +132,9 @@ void UT_BSP_DoText(uint8 MessageType, const char *OutputMessage)
case UTASSERT_CASETYPE_INFO:
Prefix = "INFO";
break;
case UTASSERT_CASETYPE_FLOW:
Prefix = "FLOW";
break;
case UTASSERT_CASETYPE_DEBUG:
Prefix = "DEBUG";
break;
Expand Down
18 changes: 15 additions & 3 deletions modules/cfe_assert/src/cfe_assert_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ bool CFE_Assert_Status_DeferredCheck(CFE_Status_t Status, UtAssert_CaseType_t Ca
const char *Text)
{
bool Result;
const char *ExtraTag;

if (CFE_Assert_Global.StoredText[0] == 0)
{
/* If no status was stored, then this is a bug in the test program (need to store a result first) */
Expand All @@ -127,11 +129,21 @@ bool CFE_Assert_Status_DeferredCheck(CFE_Status_t Status, UtAssert_CaseType_t Ca
}
else
{
Result = (Status == CFE_Assert_Global.StoredStatus);
if (Result)
{
ExtraTag = "match";
}
else
{
ExtraTag = "not match";
}

/* This produces a log message similar to what UtAssert_INT32_EQ would produce.
* Note the file/line will reflect where the call was made, not where this assertion was done */
Result = UtAssertEx(Status == CFE_Assert_Global.StoredStatus, CaseType, CFE_Assert_Global.StoredFile,
CFE_Assert_Global.StoredLine, "%s (%ld) == %s (%ld)", CFE_Assert_Global.StoredText,
(long)CFE_Assert_Global.StoredStatus, Text, (long)Status);
Result = UtAssertEx(Result, CaseType, CFE_Assert_Global.StoredFile,
CFE_Assert_Global.StoredLine, "%s (%ld) == %s (%ld) -> %s", CFE_Assert_Global.StoredText,
(long)CFE_Assert_Global.StoredStatus, Text, (long)Status, ExtraTag);
}

return Result;
Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_testcase/src/es_cds_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void TestRegisterCDS(void)
* to preconditions beyond the control of this test app. Need to clear the CDS
* memory and/or do a power-on reset to get full test.
*/
UtAssert_NA("CDS already exists. CFE_ES_RegisterCDS new allocation could not be properly tested");
UtAssert_WARN("CDS already exists. CFE_ES_RegisterCDS new allocation could not be properly tested");
}
else
{
Expand Down

0 comments on commit 286c76e

Please sign in to comment.