diff --git a/modules/core_private/ut-stubs/inc/ut_support.h b/modules/core_private/ut-stubs/inc/ut_support.h index 0c6ca99c5..fa4683ba2 100644 --- a/modules/core_private/ut-stubs/inc/ut_support.h +++ b/modules/core_private/ut-stubs/inc/ut_support.h @@ -235,43 +235,6 @@ void UT_ResetCDS(void); /* Reset pool buffer array index */ void UT_ResetPoolBufferIndex(void); -/*****************************************************************************/ -/** -** \brief Output single test's pass/fail status -** -** \par Description -** Out the results and description for a single test, and update the -** pass/fail counters. -** -** \par Assumptions, External Events, and Notes: -** -** \param[in] test Equals 0 if the test failed; non-zero if the -** test passed -** -** \param[in] fun_name Character string pointer to the name of the function -** being tested -** -** \param[in] info Character string pointer to the description of the test -** -** \returns -** This function does not return a value. -** -******************************************************************************/ -void UT_Report(const char *file, uint32 line, bool test, const char *fun_name, const char *info); - -/*****************************************************************************/ -/** -** \brief Test pass/fail summary -** -** \par Description -** Output total number of tests passed and failed. -** -** \returns -** This function does not return a value. -** -******************************************************************************/ -void UT_ReportFailures(void); - /*****************************************************************************/ /** ** \brief Send a message via the software bus @@ -648,6 +611,44 @@ void UT_AddSubTest(void (*Test)(void), void (*Setup)(void), void (*Teardown)(voi bool CFE_UtAssert_SuccessCheck_Impl(CFE_Status_t Status, UtAssert_CaseType_t CaseType, const char *File, uint32 Line, const char *Text); +/*****************************************************************************/ +/** +** \brief Helper function for message check (printf/syslog) verifications +** +** \par Description +** This helper function wraps the normal UtAssert function, intended for verifying +** CFE API calls that are expected to generate printf or syslog messages. This +** includes the actual message in the log, but scrubs it for newlines and other +** items that may affect the ability to parse the log file via a script. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns Test pass status, returns true if status was successful, false if it failed. +** +******************************************************************************/ +bool CFE_UtAssert_MessageCheck_Impl(bool Status, const char *File, uint32 Line, const char *Desc, + const char *FormatString); + +/*****************************************************************************/ +/** +** \brief Helper function for string buffer check verifications +** +** \par Description +** This helper function wraps the normal UtAssert function, intended for verifying +** the contents of string buffer(s). This also includes the actual message in the log, +** but scrubs it for newlines and other items that may affect the ability to parse +** the log file via a script. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns Test pass status, returns true if status was successful, false if it failed. +** +******************************************************************************/ +bool CFE_UtAssert_StringBufCheck_Impl(const char *String1, size_t String1Max, const char *String2, size_t String2Max, + const char *File, uint32 Line); + /*****************************************************************************/ /** ** \brief Helper function for generic unsigned integer value checks @@ -718,22 +719,6 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp ******************************************************************************/ #define CFE_UtAssert_SUCCESS(FN) CFE_UtAssert_SuccessCheck_Impl(FN, UTASSERT_CASETYPE_FAILURE, __FILE__, __LINE__, #FN) -/*****************************************************************************/ -/** -** \brief Asserts the specific status code from the function being tested. -** -** \par Description -** The core of each unit test is the execution of the function being tested. -** This function and macro should be used to test for a specific status code -** from a function (typically an error case). -** -** \par Assumptions, External Events, and Notes: -** None -** -******************************************************************************/ -#define CFE_UtAssert_EQUAL(FN, EXP) \ - CFE_UtAssert_GenericSignedCompare_Impl(FN, CFE_UtAssert_Compare_EQ, EXP, __FILE__, __LINE__, "", #FN, #EXP) - /*****************************************************************************/ /** ** \brief Asserts the expression/function evaluates as logically true @@ -860,9 +845,8 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp ** is potentially useful to confirm a specific code path was followed. ** ******************************************************************************/ -#define CFE_UtAssert_SYSLOG(str) \ - CFE_UtAssert_GenericSignedCompare_Impl(UT_SyslogIsInHistory(str), CFE_UtAssert_Compare_GT, 0, __FILE__, __LINE__, \ - "Syslog generated: ", #str, "") +#define CFE_UtAssert_SYSLOG(str) \ + CFE_UtAssert_MessageCheck_Impl(UT_SyslogIsInHistory(str), __FILE__, __LINE__, "Syslog generated: ", str) /*****************************************************************************/ /** @@ -876,9 +860,8 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp ** is potentially useful to confirm a specific code path was followed. ** ******************************************************************************/ -#define CFE_UtAssert_PRINTF(str) \ - CFE_UtAssert_GenericSignedCompare_Impl(UT_PrintfIsInHistory(str), CFE_UtAssert_Compare_GT, 0, __FILE__, __LINE__, \ - "Printf generated: ", #str, "") +#define CFE_UtAssert_PRINTF(str) \ + CFE_UtAssert_MessageCheck_Impl(UT_PrintfIsInHistory(str), __FILE__, __LINE__, "Printf generated: ", str) /*****************************************************************************/ /** @@ -927,4 +910,56 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp CFE_RESOURCEID_TO_ULONG(id2), __FILE__, __LINE__, \ "Resource ID Check: ", #id1, #id2) +/*****************************************************************************/ +/** +** \brief Macro to check CFE memory size/offset for equality +** +** \par Description +** A macro that checks two memory offset/size values for equality. +** +** \par Assumptions, External Events, and Notes: +** This is a simple unsigned comparison which logs the values as hexadecimal +** +******************************************************************************/ +#define CFE_UtAssert_MEMOFFSET_EQ(off1, off2) \ + CFE_UtAssert_GenericUnsignedCompare_Impl(off1, CFE_UtAssert_Compare_EQ, off2, __FILE__, __LINE__, \ + "Offset Check: ", #off1, #off2) + +/*****************************************************************************/ +/** +** \brief Macro to check CFE message ID for equality +** +** \par Description +** A macro that checks two message ID values for equality. +** +** \par Assumptions, External Events, and Notes: +** The generic #UtAssert_UINT32_EQ check should not be used, as CFE_SB_MsgId_t values +** and integers may not be interchangable with strict type checking. +** +******************************************************************************/ +#define CFE_UtAssert_MSGID_EQ(mid1, mid2) \ + CFE_UtAssert_GenericUnsignedCompare_Impl(CFE_SB_MsgIdToValue(mid1), CFE_UtAssert_Compare_EQ, \ + CFE_SB_MsgIdToValue(mid2), __FILE__, __LINE__, "MsgId Check: ", #mid1, \ + #mid2) + +/*****************************************************************************/ +/** +** \brief Macro to check string buffers for equality +** +** \par Description +** A macro that checks two string buffers for equality. Both buffer maximum sizes are explicitly +** specified, so that strings may reside in a fixed length buffer. The function will never +** check beyond the specified length, regardless of termination. +** +** \par Assumptions, External Events, and Notes: +** The generic #UtAssert_StrCmp macro requires both arguments to be NULL terminated. This also +** includes the actual string in the log, but filters embedded newlines to keep the log clean. +** +** If the string arguments are guaranteed to be NULL terminated and/or the max size is +** not known, then the SIZE_MAX constant may be passed for the respective string. +** +******************************************************************************/ +#define CFE_UtAssert_STRINGBUF_EQ(str1, size1, str2, size2) \ + CFE_UtAssert_StringBufCheck_Impl(str1, size1, str2, size2, __FILE__, __LINE__) + #endif /* UT_SUPPORT_H */ diff --git a/modules/core_private/ut-stubs/src/ut_support.c b/modules/core_private/ut-stubs/src/ut_support.c index d8728e3da..6ba1ac9b3 100644 --- a/modules/core_private/ut-stubs/src/ut_support.c +++ b/modules/core_private/ut-stubs/src/ut_support.c @@ -197,14 +197,6 @@ void UT_ResetPoolBufferIndex(void) UT_SetDataBuffer(UT_KEY(CFE_ES_GetPoolBuf), &UT_CFE_ES_MemoryPool, sizeof(UT_CFE_ES_MemoryPool), false); } -/* -** Output single test's pass/fail status -*/ -void UT_Report(const char *file, uint32 line, bool test, const char *fun_name, const char *info) -{ - UtAssertEx(test, UtAssert_GetContext(), file, line, "%s - %s", fun_name, info); -} - /* ** Calls the specified "task pipe" function ** @@ -826,3 +818,132 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp return UtAssertEx(Result, UTASSERT_CASETYPE_FAILURE, File, Line, "%s%s (%ld) %s %s (%ld)", Desc, ActualText, (long)ActualValue, CFE_UtAssert_GetOpText(CompareType), ReferenceText, (long)ReferenceValue); } + +bool CFE_UtAssert_MessageCheck_Impl(bool Status, const char *File, uint32 Line, const char *Desc, + const char *FormatString) +{ + char ScrubbedFormat[256]; + const char *EndPtr; + size_t FormatLen; + + /* Locate the actual end of the string, but limited to length of local buffer */ + /* Reserve two extra chars for quotes */ + EndPtr = memchr(FormatString, 0, sizeof(ScrubbedFormat) - 2); + if (EndPtr != NULL) + { + FormatLen = EndPtr - FormatString; + } + else + { + FormatLen = sizeof(ScrubbedFormat) - 3; + } + + /* Check for a newline within that range, and if present, end the string there instead */ + EndPtr = memchr(FormatString, '\n', FormatLen); + if (EndPtr != NULL) + { + FormatLen = EndPtr - FormatString; + } + + /* Need to make a copy, as the input string is "const" */ + ScrubbedFormat[0] = '\''; + memcpy(&ScrubbedFormat[1], FormatString, FormatLen); + ScrubbedFormat[FormatLen] = '\''; + ScrubbedFormat[FormatLen + 1] = 0; + + return CFE_UtAssert_GenericSignedCompare_Impl(Status, CFE_UtAssert_Compare_GT, 0, File, Line, Desc, ScrubbedFormat, + ""); +} + +bool CFE_UtAssert_StringBufCheck_Impl(const char *String1, size_t String1Max, const char *String2, size_t String2Max, + const char *File, uint32 Line) +{ + char ScrubbedString1[256]; + char ScrubbedString2[256]; + const char *EndPtr1; + const char *EndPtr2; + size_t FormatLen1; + size_t FormatLen2; + bool Result; + + /* Locate the actual end of both strings */ + if (String1 == NULL) + { + EndPtr1 = NULL; + } + else + { + EndPtr1 = memchr(String1, 0, String1Max); + } + + if (EndPtr1 != NULL) + { + FormatLen1 = EndPtr1 - String1; + } + else + { + FormatLen1 = String1Max; + } + + if (String2 == NULL) + { + EndPtr2 = NULL; + } + else + { + EndPtr2 = memchr(String2, 0, String2Max); + } + + if (EndPtr2 != NULL) + { + FormatLen2 = EndPtr2 - String2; + } + else + { + FormatLen2 = String2Max; + } + + if (FormatLen1 != FormatLen2) + { + /* This means the strings have different termination/length, and therefore must not be equal (content doesn't + * matter) */ + Result = false; + } + else if (FormatLen1 == 0) + { + /* Two empty strings are considered equal */ + Result = true; + } + else + { + /* If the effective lengths are the same, use memcmp to check content */ + Result = (memcmp(String1, String2, FormatLen1) == 0); + } + + /* Now make "safe" copies of the strings */ + /* Check for a newline within the string, and if present, end the string there instead */ + if (FormatLen1 > 0) + { + EndPtr1 = memchr(String1, '\n', FormatLen1); + if (EndPtr1 != NULL) + { + FormatLen1 = EndPtr1 - String1; + } + memcpy(ScrubbedString1, String1, FormatLen1); + } + ScrubbedString1[FormatLen1] = 0; + + if (FormatLen2 > 0) + { + EndPtr2 = memchr(String2, '\n', FormatLen2); + if (EndPtr2 != NULL) + { + FormatLen2 = EndPtr2 - String2; + } + memcpy(ScrubbedString2, String2, FormatLen2); + } + ScrubbedString2[FormatLen2] = 0; + + return UtAssertEx(Result, UTASSERT_CASETYPE_FAILURE, File, Line, "String: \'%s\' == \'%s\'", ScrubbedString1, + ScrubbedString2); +} diff --git a/modules/es/ut-coverage/es_UT.c b/modules/es/ut-coverage/es_UT.c index d430fe261..e35519fe4 100644 --- a/modules/es/ut-coverage/es_UT.c +++ b/modules/es/ut-coverage/es_UT.c @@ -655,7 +655,7 @@ void TestInit(void) UT_SetDummyFuncRtn(OS_SUCCESS); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1, "ut_startup"); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 0, "CFE_ES_Main", "Normal startup"); + UtAssert_STUB_COUNT(CFE_PSP_Panic, 0); } void TestStartupErrorPaths(void) @@ -693,9 +693,8 @@ void TestStartupErrorPaths(void) UT_SetReadBuffer(StartupScript, strlen(StartupScript)); UT_SetDataBuffer(UT_KEY(CFE_PSP_Panic), &PanicStatus, sizeof(PanicStatus), false); CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, 1, 1, "ut_startup"); - UT_Report(__FILE__, __LINE__, - PanicStatus == CFE_PSP_PANIC_STARTUP_SEM && UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 1, "CFE_ES_Main", - "Mutex create failure"); + UtAssert_STUB_COUNT(CFE_PSP_Panic, 1); + UtAssert_UINT32_EQ(PanicStatus, CFE_PSP_PANIC_STARTUP_SEM); /* Perform ES main startup with a file open failure */ ES_ResetUnitTest(); @@ -703,8 +702,7 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, 1, 1, "ut_startup"); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP]), - "CFE_ES_Main", "File open failure"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP]); /* Perform ES main startup with a startup sync failure */ ES_ResetUnitTest(); @@ -714,28 +712,23 @@ void TestStartupErrorPaths(void) UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, &StateHook); UT_SetReadBuffer(StartupScript, strlen(StartupScript)); CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, 1, 1, "ut_startup"); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_STARTUP_SYNC_FAIL_1]), "CFE_ES_Main", - "Startup sync failure 1"); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_STARTUP_SYNC_FAIL_2]), "CFE_ES_Main", - "Startup sync failure 2"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_STARTUP_SYNC_FAIL_1]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_STARTUP_SYNC_FAIL_2]); /* Perform a power on reset with a hardware special sub-type */ ES_ResetUnitTest(); CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_POWERON, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_HW_SPECIAL]), - "CFE_ES_SetupResetVariables", "Power on reset - Hardware special command"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_POR_HW_SPECIAL]); /* Perform a processor reset with a hardware special sub-type */ ES_ResetUnitTest(); CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_PROC_RESET_MAX_HW_SPECIAL]), - "CFE_ES_SetupResetVariables", "Processor reset - hardware special command"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_PROC_RESET_MAX_HW_SPECIAL]); /* Perform a power on reset with an "other cause" sub-type */ ES_ResetUnitTest(); CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_POWERON, -1, 1); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_OTHER]), "CFE_ES_SetupResetVariables", - "Other cause reset"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_POR_OTHER]); /* Perform the maximum number of processor resets */ ES_ResetUnitTest(); @@ -747,28 +740,21 @@ void TestStartupErrorPaths(void) CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); } - UT_Report(__FILE__, __LINE__, - CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount == CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS, - "CFE_ES_SetupResetVariables", "Maximum processor resets"); + UtAssert_UINT32_EQ(CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount, CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS); /* Attempt another processor reset after the maximum have occurred */ ES_ResetUnitTest(); UT_SetDataBuffer(UT_KEY(CFE_PSP_Restart), &ResetType, sizeof(ResetType), false); CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); - UT_Report(__FILE__, __LINE__, - CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount == CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS + 1 && - ResetType == CFE_PSP_RST_TYPE_POWERON && UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, - "CFE_ES_SetupResetVariables", - "Processor reset - power cycle; exceeded maximum " - "processor resets"); + UtAssert_UINT32_EQ(CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount, + CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS + 1); + UtAssert_UINT32_EQ(ResetType, CFE_PSP_RST_TYPE_POWERON); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 1); /* Perform a power on reset with a hardware special sub-type */ ES_ResetUnitTest(); CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_MAX_HW_SPECIAL]), - "CFE_ES_SetupResetVariables", - "Processor reset - hardware special command; exceeded maximum " - "processor resets"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_POR_MAX_HW_SPECIAL]); /* Perform a processor reset with an reset area failure */ ES_ResetUnitTest(); @@ -776,17 +762,15 @@ void TestStartupErrorPaths(void) UT_SetDataBuffer(UT_KEY(CFE_PSP_Panic), &PanicStatus, sizeof(PanicStatus), false); CFE_ES_Global.ResetDataPtr->ResetVars.ES_CausedReset = true; CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); - UT_Report(__FILE__, __LINE__, - PanicStatus == CFE_PSP_PANIC_MEMORY_ALLOC && UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 1, - "CFE_ES_SetupResetVariables", "Get reset area error"); + UtAssert_UINT32_EQ(PanicStatus, CFE_PSP_PANIC_MEMORY_ALLOC); + UtAssert_STUB_COUNT(CFE_PSP_Panic, 1); /* Perform a processor reset triggered by ES */ /* Added for coverage, as the "panic" case will should not cover this one */ ES_ResetUnitTest(); CFE_ES_Global.ResetDataPtr->ResetVars.ES_CausedReset = true; CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 0, "CFE_ES_SetupResetVariables", - "Processor Reset caused by ES"); + UtAssert_STUB_COUNT(CFE_PSP_Panic, 0); /* Perform a processor reset with the size of the reset area too small */ ES_ResetUnitTest(); @@ -794,9 +778,8 @@ void TestStartupErrorPaths(void) UT_SetDataBuffer(UT_KEY(CFE_PSP_Panic), &PanicStatus, sizeof(PanicStatus), false); UT_SetStatusBSPResetArea(OS_SUCCESS, 0, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); - UT_Report(__FILE__, __LINE__, - PanicStatus == CFE_PSP_PANIC_MEMORY_ALLOC && UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 1, - "CFE_ES_SetupResetVariables", "Reset area too small"); + UtAssert_UINT32_EQ(PanicStatus, CFE_PSP_PANIC_MEMORY_ALLOC); + UtAssert_STUB_COUNT(CFE_PSP_Panic, 1); /* Test initialization of the file systems specifying a power on reset * following a failure to create the RAM volume @@ -806,10 +789,8 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_mount), OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_mkfs), OS_ERROR); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_POWERON); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]), - "CFE_ES_InitializeFileSystems", "Power on reset; error creating volatile (RAM) volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]); /* prepare the StatBuf to reflect a RAM disk that is 99% full */ StatBuf.block_size = 1024; @@ -825,13 +806,11 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_mkfs), OS_ERROR); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume), &StatBuf, sizeof(StatBuf), false); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REFORMAT_VOLATILE]), - "CFE_ES_InitializeFileSystems", "Processor reset; error reformatting volatile (RAM) volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_REFORMAT_VOLATILE]); /* Test initialization of the file systems specifying a processor reset * following failure to get the volatile disk memory @@ -840,8 +819,7 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_GetVolatileDiskMem), CFE_PSP_ERROR); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume), &StatBuf, sizeof(StatBuf), false); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]), - "CFE_ES_InitializeFileSystems", "Processor reset; cannot get memory for volatile disk"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); /* Test initialization of the file systems specifying a processor reset * following a failure to remove the RAM volume @@ -850,10 +828,8 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_rmfs), OS_ERROR); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume), &StatBuf, sizeof(StatBuf), false); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REMOVE_VOLATILE]), - "CFE_ES_InitializeFileSystems", "Processor reset; error removing volatile (RAM) volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_REMOVE_VOLATILE]); /* Test initialization of the file systems specifying a processor reset * following a failure to unmount the RAM volume @@ -862,16 +838,13 @@ void TestStartupErrorPaths(void) UT_SetDeferredRetcode(UT_KEY(OS_unmount), 1, -1); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume), &StatBuf, sizeof(StatBuf), false); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_UNMOUNT_VOLATILE]), - "CFE_ES_InitializeFileSystems", "Processor reset; error unmounting volatile (RAM) volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_UNMOUNT_VOLATILE]); /* Test successful initialization of the file systems */ ES_ResetUnitTest(); CFE_ES_InitializeFileSystems(4564564); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 0, "CFE_ES_InitializeFileSystems", - "Initialize file systems; successful"); + UtAssert_STUB_COUNT(CFE_PSP_Panic, 0); /* Test initialization of the file systems specifying a processor reset * following a failure to remount the RAM volume @@ -880,11 +853,9 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_mount), OS_ERROR); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume), &StatBuf, sizeof(StatBuf), false); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REMOUNT_VOLATILE]), - "CFE_ES_InitializeFileSystems", "Processor reset; error remounting volatile (RAM) volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_REMOUNT_VOLATILE]); /* Test initialization of the file systems with an error determining the * number of blocks that are free on the volume @@ -892,8 +863,7 @@ void TestStartupErrorPaths(void) ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_FileSysStatVolume), 1, -1); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_DETERMINE_BLOCKS]), - "CFE_ES_InitializeFileSystems", "Processor reset; error determining blocks free on volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_DETERMINE_BLOCKS]); /* Test reading the object table where a record used error occurs */ ES_ResetUnitTest(); @@ -909,8 +879,7 @@ void TestStartupErrorPaths(void) UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_RECORD_USED]), "CFE_ES_CreateObjects", - "Record used error"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_RECORD_USED]); /* Test reading the object table where an error occurs when * calling a function @@ -929,10 +898,8 @@ void TestStartupErrorPaths(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_EarlyInit), 1, -1); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_RECORD_USED]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_EARLYINIT]), - "CFE_ES_CreateObjects", "Error returned when calling function"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_RECORD_USED]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_EARLYINIT]); /* Test reading the object table where an error occurs when * creating a core app @@ -942,33 +909,28 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_BinSemCreate), OS_ERROR); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_APP_CREATE]), "CFE_ES_CreateObjects", - "Error creating core application"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CORE_APP_CREATE]); /* Test reading the object table where all app slots are taken */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]) == 5, - "CFE_ES_CreateObjects", "No free application slots available, message"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]); /* Test reading the object table with a NULL function pointer */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); CFE_ES_ObjectTable[1].ObjectType = CFE_ES_FUNCTION_CALL; CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]) == 5, - "CFE_ES_CreateObjects", "Bad function pointer, app slots message"); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_FUNCTION_POINTER]), - "CFE_ES_CreateObjects", "Bad function pointer message"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_FUNCTION_POINTER]); /* Test response to an invalid startup type */ ES_ResetUnitTest(); CFE_ES_Global.DebugVars.DebugFlag = 1; CFE_ES_SetupResetVariables(-1, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); - UT_Report(__FILE__, __LINE__, CFE_ES_Global.DebugVars.DebugFlag == 1, "CFE_ES_SetupResetVariables", - "Invalid startup type"); + UtAssert_UINT32_EQ(CFE_ES_Global.DebugVars.DebugFlag, 1); CFE_ES_Global.DebugVars.DebugFlag = 0; /* Test initialization of the file systems specifying a processor reset @@ -979,24 +941,19 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_mount), OS_ERROR); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume), &StatBuf, sizeof(StatBuf), false); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REMOUNT_VOLATILE]), - "CFE_ES_InitializeFileSystems", - "Processor reset; error initializing and mounting volatile " - "(RAM) volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_REMOUNT_VOLATILE]); /* Test application sync delay where the operation times out */ ES_ResetUnitTest(); /* This prep is necessary so GetAppId works */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppType_CORE, NULL, &AppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; - UT_Report(__FILE__, __LINE__, - CFE_ES_WaitForSystemState(CFE_ES_SystemState_OPERATIONAL, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) == - CFE_ES_OPERATION_TIMED_OUT, - "CFE_ES_ApplicationSyncDelay", "Operation timed out"); + UtAssert_INT32_EQ( + CFE_ES_WaitForSystemState(CFE_ES_SystemState_OPERATIONAL, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC), + CFE_ES_OPERATION_TIMED_OUT); /* Test startup sync with alternate minimum system state * of CFE_ES_SystemState_SHUTDOWN @@ -1005,11 +962,10 @@ void TestStartupErrorPaths(void) /* This prep is necessary so GetAppId works */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppType_CORE, NULL, &AppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; - UT_Report(__FILE__, __LINE__, - CFE_ES_WaitForSystemState(CFE_ES_SystemState_SHUTDOWN, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) == - CFE_ES_OPERATION_TIMED_OUT && - AppRecPtr->AppState == CFE_ES_AppState_STOPPED, - "CFE_ES_WaitForSystemState", "Min System State is CFE_ES_SystemState_SHUTDOWN"); + UtAssert_INT32_EQ( + CFE_ES_WaitForSystemState(CFE_ES_SystemState_SHUTDOWN, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC), + CFE_ES_OPERATION_TIMED_OUT); + UtAssert_UINT32_EQ(AppRecPtr->AppState, CFE_ES_AppState_STOPPED); /* Test startup sync with alternate minimum system state * of CFE_ES_SystemState_APPS_INIT @@ -1019,11 +975,10 @@ void TestStartupErrorPaths(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppType_CORE, NULL, &AppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; - UT_Report(__FILE__, __LINE__, - CFE_ES_WaitForSystemState(CFE_ES_SystemState_APPS_INIT, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) == - CFE_ES_OPERATION_TIMED_OUT && - AppRecPtr->AppState == CFE_ES_AppState_LATE_INIT, - "CFE_ES_WaitForSystemState", "Min System State is CFE_ES_SystemState_APPS_INIT"); + UtAssert_INT32_EQ( + CFE_ES_WaitForSystemState(CFE_ES_SystemState_APPS_INIT, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC), + CFE_ES_OPERATION_TIMED_OUT); + UtAssert_UINT32_EQ(AppRecPtr->AppState, CFE_ES_AppState_LATE_INIT); /* Test success */ ES_ResetUnitTest(); @@ -1036,7 +991,6 @@ void TestStartupErrorPaths(void) void TestApps(void) { int NumBytes; - int Return; CFE_ES_AppInfo_t AppInfo; CFE_ES_AppId_t AppId; CFE_ES_TaskId_t TaskId; @@ -1062,8 +1016,8 @@ void TestApps(void) NumBytes = strlen(StartupScript); UT_SetReadBuffer(StartupScript, NumBytes); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_FILE_LINE_TOO_LONG])); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN])); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_FILE_LINE_TOO_LONG]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]); /* Test starting an application where the startup script has extra tokens */ ES_ResetUnitTest(); @@ -1072,8 +1026,8 @@ void TestApps(void) NumBytes = strlen(StartupScript); UT_SetReadBuffer(StartupScript, NumBytes); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_FILE_LINE_TOO_LONG])); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN])); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_FILE_LINE_TOO_LONG]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]); /* Create a valid startup script for subsequent tests */ strncpy(StartupScript, @@ -1090,10 +1044,8 @@ void TestApps(void) ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_read), 1, -1); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_STARTUP_READ]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]), - "CFE_ES_StartApplications", "Error reading startup file"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_STARTUP_READ]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]); /* Test starting an application with an end-of-file returned by the * OS read @@ -1101,96 +1053,82 @@ void TestApps(void) ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_read), 1, 0); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]), - "CFE_ES_StartApplications", "End of file reached"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]); /* Test starting an application with an open failure */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP]), - "CFE_ES_StartApplications", "Can't open ES application startup file"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP]); /* Test successfully starting an application */ ES_ResetUnitTest(); UT_SetReadBuffer(StartupScript, NumBytes); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN])); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]); /* Test parsing the startup script with an unknown entry type */ ES_ResetUnitTest(); { const char *TokenList[] = {"UNKNOWN", "/cf/apps/tst_lib.bundle", "TST_LIB_Init", "TST_LIB", "0", "0", "0x0", "1"}; - UT_Report(__FILE__, __LINE__, CFE_ES_ParseFileEntry(TokenList, 8) == CFE_ES_ERR_APP_CREATE, - "CFE_ES_ParseFileEntry", "Unknown entry type"); + UtAssert_INT32_EQ(CFE_ES_ParseFileEntry(TokenList, 8), CFE_ES_ERR_APP_CREATE); /* Test parsing the startup script with an invalid file name */ UT_SetDefaultReturnValue(UT_KEY(CFE_FS_ParseInputFileName), CFE_FS_INVALID_PATH); - UT_Report(__FILE__, __LINE__, CFE_ES_ParseFileEntry(TokenList, 8) == CFE_FS_INVALID_PATH, - "CFE_ES_ParseFileEntry", "Invalid file name"); + UtAssert_INT32_EQ(CFE_ES_ParseFileEntry(TokenList, 8), CFE_FS_INVALID_PATH); } /* Test parsing the startup script with an invalid argument passed in */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_ParseFileEntry(NULL, 0) == CFE_ES_BAD_ARGUMENT, "CFE_ES_ParseFileEntry", - "Invalid argument"); + UtAssert_INT32_EQ(CFE_ES_ParseFileEntry(NULL, 0), CFE_ES_BAD_ARGUMENT); /* Test application loading and creation with a task creation failure */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); ES_UT_SetupAppStartParams(&StartParams, "ut/filename", "EntryPoint", 170, 4096, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); - UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_APP_CREATE])); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName", &StartParams), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_APP_CREATE]); /* Test application creation with NULL parameters */ ES_ResetUnitTest(); - Return = CFE_ES_AppCreate(&AppId, "AppName", NULL); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_AppCreate", "NULL file name"); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName", NULL), CFE_ES_BAD_ARGUMENT); /* Test application creation with name too long */ memset(NameBuffer, 'x', sizeof(NameBuffer) - 1); NameBuffer[sizeof(NameBuffer) - 1] = 0; ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 4096, 1); - Return = CFE_ES_AppCreate(&AppId, NameBuffer, &StartParams); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_AppCreate", "Name too long"); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, NameBuffer, &StartParams), CFE_ES_BAD_ARGUMENT); /* Test successful application loading and creation */ ES_ResetUnitTest(); ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); - UT_Report(__FILE__, __LINE__, Return == CFE_SUCCESS, "CFE_ES_AppCreate", "Application load/create; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_AppCreate(&AppId, "AppName", &StartParams)); /* Test application loading of the same name again */ ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_ERR_DUPLICATE_NAME, "CFE_ES_AppCreate", "Duplicate name"); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName", &StartParams), CFE_ES_ERR_DUPLICATE_NAME); /* Test application loading and creation where the file cannot be loaded */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_ModuleLoad), 1, -1); ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName2", &StartParams); - UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_EXTRACT_FILENAME_UT55])); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName2", &StartParams), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_EXTRACT_FILENAME_UT55]); /* Test application loading and creation where all app slots are taken */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_NO_RESOURCE_IDS_AVAILABLE && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_FREE_APP_SLOTS]), - "CFE_ES_AppCreate", "No free application slots available"); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName", &StartParams), CFE_ES_NO_RESOURCE_IDS_AVAILABLE); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_NO_FREE_APP_SLOTS]); /* Check operation of the CFE_ES_CheckAppIdSlotUsed() helper function */ CFE_ES_Global.AppTable[1].AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(1)); CFE_ES_Global.AppTable[2].AppId = CFE_ES_APPID_UNDEFINED; - UtAssert_True(CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(1)), "App Slot Used"); - UtAssert_True(!CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(2)), "App Slot Unused"); + CFE_UtAssert_TRUE(CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(1))); + CFE_UtAssert_FALSE(CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(2))); /* Test application loading and creation where the entry point symbol * cannot be found @@ -1198,9 +1136,8 @@ void TestApps(void) ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_ModuleSymbolLookup), 1, -1); ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); - UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_FIND_SYMBOL])); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName", &StartParams), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CANNOT_FIND_SYMBOL]); /* Test application loading and creation where the entry point symbol * cannot be found and module unload fails @@ -1209,10 +1146,9 @@ void TestApps(void) UT_SetDeferredRetcode(UT_KEY(OS_ModuleSymbolLookup), 1, -1); UT_SetDeferredRetcode(UT_KEY(OS_ModuleUnload), 1, -1); ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); - UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_FIND_SYMBOL])); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MODULE_UNLOAD_FAILED])); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName", &StartParams), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CANNOT_FIND_SYMBOL]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MODULE_UNLOAD_FAILED]); /* * Set up a situation where attempting to get appID by context, @@ -1232,8 +1168,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppTimerMsec = 0; memset(&CFE_ES_Global.BackgroundAppScanState, 0, sizeof(CFE_ES_Global.BackgroundAppScanState)); CFE_ES_RunAppTableScan(0, &CFE_ES_Global.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID) && UtAppRecPtr->ControlReq.AppTimerMsec == 0, - "CFE_ES_RunAppTableScan", "Waiting; process control request"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppTimerMsec, 0); + CFE_UtAssert_EVENTSENT(CFE_ES_PCR_ERR2_EID); /* Test scanning and acting on the application table where the timer * has not expired for a waiting application @@ -1243,10 +1179,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; UtAppRecPtr->ControlReq.AppTimerMsec = 5000; CFE_ES_RunAppTableScan(1000, &CFE_ES_Global.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, - UtAppRecPtr->ControlReq.AppTimerMsec == 4000 && - UtAppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_EXIT, - "CFE_ES_RunAppTableScan", "Decrement timer"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppTimerMsec, 4000); + UtAssert_UINT32_EQ(UtAppRecPtr->ControlReq.AppControlRequest, CFE_ES_RunStatus_APP_EXIT); /* Test scanning and acting on the application table where the application * has stopped and is ready to be acted on @@ -1256,8 +1190,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppTimerMsec = 0; CFE_ES_RunAppTableScan(0, &CFE_ES_Global.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID) && UtAppRecPtr->ControlReq.AppTimerMsec == 0, - "CFE_ES_RunAppTableScan", "Stopped; process control request"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppTimerMsec, 0); + CFE_UtAssert_EVENTSENT(CFE_ES_PCR_ERR2_EID); /* Test scanning and acting on the application table where the application * has stopped and is ready to be acted on @@ -1266,8 +1200,8 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_EARLY_INIT, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppTimerMsec = 5000; CFE_ES_RunAppTableScan(0, &CFE_ES_Global.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0 && UtAppRecPtr->ControlReq.AppTimerMsec == 5000, - "CFE_ES_RunAppTableScan", "Initializing; process control request"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppTimerMsec, 5000); + CFE_UtAssert_EVENTCOUNT(0); /* Test a control action request on an application with an * undefined control request state @@ -1276,9 +1210,8 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = 0x12345; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID), "CFE_ES_ProcessControlRequest", - "Unknown state (default)"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_PCR_ERR2_EID); /* Test a successful control action request to exit an application */ ES_ResetUnitTest(); @@ -1286,9 +1219,8 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/Filename", "NotNULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_EXIT_APP_INF_EID), "CFE_ES_ProcessControlRequest", - "Exit application; successful"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_EXIT_APP_INF_EID); /* Test a control action request to exit an application where the * request fails @@ -1298,9 +1230,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_EXIT_APP_ERR_EID), "CFE_ES_ProcessControlRequest", - "Exit application failure"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_EXIT_APP_ERR_EID); /* Test a control action request to stop an application where the * request fails @@ -1310,9 +1241,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_ERR3_EID), "CFE_ES_ProcessControlRequest", - "Stop application failure"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_STOP_ERR3_EID); /* Test a control action request to restart an application where the * request fails due to a CleanUpApp error @@ -1322,9 +1252,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR4_EID), "CFE_ES_ProcessControlRequest", - "Restart application failure; CleanUpApp error"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR4_EID); /* Test a control action request to restart an application where the * request fails due to an AppCreate error @@ -1335,9 +1264,8 @@ void TestApps(void) OS_ModuleLoad(&UtAppRecPtr->LoadStatus.ModuleId, NULL, NULL, 0); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR3_EID), "CFE_ES_ProcessControlRequest", - "Restart application failure; AppCreate error"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR3_EID); /* Test a control action request to reload an application where the * request fails due to a CleanUpApp error @@ -1347,9 +1275,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR4_EID), "CFE_ES_ProcessControlRequest", - "Reload application failure; CleanUpApp error"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR4_EID); /* Test a control action request to reload an application where the * request fails due to an AppCreate error @@ -1360,9 +1287,8 @@ void TestApps(void) OS_ModuleLoad(&UtAppRecPtr->LoadStatus.ModuleId, NULL, NULL, 0); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR3_EID), "CFE_ES_ProcessControlRequest", - "Reload application failure; AppCreate error"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR3_EID); /* Test a successful control action request to exit an application that * has an error @@ -1373,9 +1299,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERREXIT_APP_INF_EID), "CFE_ES_ProcessControlRequest", - "Exit application on error; successful"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_ERREXIT_APP_INF_EID); /* Test a control action request to exit an application that * has an error where the request fails @@ -1385,9 +1310,8 @@ void TestApps(void) UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERREXIT_APP_ERR_EID), "CFE_ES_ProcessControlRequest", - "Exit application on error failure"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_ERREXIT_APP_ERR_EID); /* Test a successful control action request to stop an application */ ES_ResetUnitTest(); @@ -1395,9 +1319,8 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_INF_EID), "CFE_ES_ProcessControlRequest", - "Stop application; successful"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_STOP_INF_EID); /* Test a successful control action request to restart an application */ ES_ResetUnitTest(); @@ -1405,9 +1328,8 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_INF_EID), "CFE_ES_ProcessControlRequest", - "Restart application; successful"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_INF_EID); /* Test a successful control action request to reload an application */ ES_ResetUnitTest(); @@ -1415,9 +1337,8 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_INF_EID), "CFE_ES_ProcessControlRequest", - "Reload application; successful"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_INF_EID); /* Test a control action request for an application that has an invalid * state (exception) @@ -1427,16 +1348,14 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_EXCEPTION; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR1_EID), "CFE_ES_ProcessControlRequest", - "Invalid state"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_PCR_ERR1_EID); /* Test populating the application information structure with data */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_SUCCESS, "CFE_ES_GetAppInfo", - "Get application information; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_GetAppInfo(&AppInfo, AppId)); /* Test populating the application information structure with data using * a null application information pointer @@ -1444,8 +1363,7 @@ void TestApps(void) ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(NULL, AppId) == CFE_ES_BAD_ARGUMENT, "CFE_ES_GetAppInfo", - "Null application information pointer"); + UtAssert_INT32_EQ(CFE_ES_GetAppInfo(NULL, AppId), CFE_ES_BAD_ARGUMENT); /* Test populating the application information structure using an * inactive application ID @@ -1454,16 +1372,14 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_AppRecordSetFree(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetAppInfo", "Application ID not active"); + UtAssert_INT32_EQ(CFE_ES_GetAppInfo(&AppInfo, AppId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test populating the application information structure using an * application ID value greater than the maximum allowed */ ES_ResetUnitTest(); AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(99999)); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetAppInfo", "Application ID exceeds maximum"); + UtAssert_INT32_EQ(CFE_ES_GetAppInfo(&AppInfo, AppId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test populating the application information structure using a valid * application ID, but with a failure to retrieve the module information @@ -1472,8 +1388,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_ModuleInfo), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_SUCCESS, "CFE_ES_GetAppInfo", - "Module not found"); + CFE_UtAssert_SUCCESS(CFE_ES_GetAppInfo(&AppInfo, AppId)); /* Test deleting an application and cleaning up its resources with OS * delete and close failures @@ -1486,8 +1401,7 @@ void TestApps(void) UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_close), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", - "Task OS delete and close failure"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); /* Test deleting an application and cleaning up its resources with a * mutex delete failure @@ -1498,8 +1412,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemDelete), 1, OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", - "Task mutex delete failure"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); /* Test deleting an application and cleaning up its resources with a * failure to unload the module @@ -1508,8 +1421,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UT_SetDeferredRetcode(UT_KEY(OS_ModuleUnload), 1, OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", - "Module unload failure"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); /* Test deleting an application and cleaning up its resources where the * EVS application cleanup fails @@ -1518,8 +1430,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", - "EVS application cleanup failure"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); /* Test cleaning up the OS resources for a task with a failure * deleting mutexes @@ -1529,8 +1440,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_MutSemDelete), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_MUT_SEM_DELETE_ERR, - "CFE_ES_CleanupTaskResources", "Mutex delete failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_MUT_SEM_DELETE_ERR); /* Test cleaning up the OS resources for a task with a failure deleting * binary semaphores @@ -1540,8 +1450,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_BinSemDelete), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_BIN_SEM_DELETE_ERR, - "CFE_ES_CleanupTaskResources", "Binary semaphore delete failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_BIN_SEM_DELETE_ERR); /* Test cleaning up the OS resources for a task with a failure deleting * counting semaphores @@ -1551,8 +1460,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_CountSemDelete), 1, OS_ERROR); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_COUNT_SEM_DELETE_ERR, - "CFE_ES_CleanupTaskResources", "Counting semaphore failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_COUNT_SEM_DELETE_ERR); /* Test cleaning up the OS resources for a task with a failure * deleting queues @@ -1562,8 +1470,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_QueueDelete), 1, OS_ERROR); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_QUEUE_DELETE_ERR, - "CFE_ES_CleanupTaskResources", "Queue delete failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_QUEUE_DELETE_ERR); /* Test cleaning up the OS resources for a task with a failure * deleting timers @@ -1576,8 +1483,7 @@ void TestApps(void) * that the code call OS_TimerGetInfo first. */ UT_SetDeferredRetcode(UT_KEY(OS_TimerDelete), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_TIMER_DELETE_ERR, - "CFE_ES_CleanupTaskResources", "Timer delete failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_TIMER_DELETE_ERR); /* Test cleaning up the OS resources for a task with a failure * closing files @@ -1588,8 +1494,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_close), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) != CFE_SUCCESS, "CFE_ES_CleanupTaskResources", - "File close failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_APP_CLEANUP_ERR); /* Test cleaning up the OS resources for a task with a failure * to delete the task @@ -1599,16 +1504,14 @@ void TestApps(void) TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_TASK_DELETE_ERR, - "CFE_ES_CleanupTaskResources", "Task delete failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_TASK_DELETE_ERR); /* Test successfully cleaning up the OS resources for a task */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_SUCCESS, "CFE_ES_CleanupTaskResources", - "Clean up task OS resources; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_CleanupTaskResources(TaskId)); /* Test parsing the startup script for a cFE application and a restart * application exception action @@ -1617,8 +1520,7 @@ void TestApps(void) { const char *TokenList[] = {"CFE_APP", "/cf/apps/tst_lib.bundle", "TST_LIB_Init", "TST_LIB", "0", "0", "0x0", "0"}; - UT_Report(__FILE__, __LINE__, CFE_ES_ParseFileEntry(TokenList, 8) == CFE_SUCCESS, "CFE_ES_ParseFileEntry", - "CFE application; restart application on exception"); + CFE_UtAssert_SUCCESS(CFE_ES_ParseFileEntry(TokenList, 8)); } /* Test scanning and acting on the application table where the timer @@ -1628,8 +1530,8 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_WAITING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppTimerMsec = 0; CFE_ES_RunAppTableScan(0, &CFE_ES_Global.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0 && UtAppRecPtr->ControlReq.AppTimerMsec == 0, - "CFE_ES_RunAppTableScan", "Waiting; process control request"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppTimerMsec, 0); + CFE_UtAssert_EVENTCOUNT(0); /* Test scanning and acting on the application table where the application * is already running @@ -1638,8 +1540,8 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppTimerMsec = 0; CFE_ES_RunAppTableScan(0, &CFE_ES_Global.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0 && UtAppRecPtr->ControlReq.AppTimerMsec == 0, - "CFE_ES_RunAppTableScan", "Running; process control request"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppTimerMsec, 0); + CFE_UtAssert_EVENTCOUNT(0); /* Test deleting an application and cleaning up its resources where the * application ID matches the main task ID @@ -1654,12 +1556,9 @@ void TestApps(void) /* Associate a child task with the app to be deleted */ ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_SUCCESS, "CFE_ES_CleanUpApp", - "Main task ID matches task ID, nominal"); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), "CFE_ES_CleanUpApp", - "Main task ID matches task ID, other task unaffected"); - UT_Report(__FILE__, __LINE__, !CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr), "CFE_ES_CleanUpApp", - "Main task ID matches task ID, memory pool deleted"); + CFE_UtAssert_SUCCESS(CFE_ES_CleanUpApp(AppId)); + CFE_UtAssert_TRUE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); + CFE_UtAssert_FALSE(CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr)); /* Test deleting an application and cleaning up its resources where the * memory pool deletion fails @@ -1671,9 +1570,8 @@ void TestApps(void) UtPoolRecPtr->OwnerAppID = CFE_ES_AppRecordGetID(UtAppRecPtr); UtPoolRecPtr->PoolID = CFE_ES_MEMHANDLE_C(CFE_ResourceId_FromInteger(99999)); /* Mismatch */ AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", - "Mem Pool delete error"); - UT_Report(__FILE__, __LINE__, CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr), "CFE_ES_CleanUpApp", "Mem Pool not freed"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); + CFE_UtAssert_TRUE(CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr)); /* Test deleting an application and cleaning up its resources where the * application ID doesn't match the main task ID @@ -1692,10 +1590,8 @@ void TestApps(void) UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", - "Main task ID doesn't match task ID, CFE_ES_APP_CLEANUP_ERR"); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), "CFE_ES_CleanUpApp", - "Main task ID doesn't match task ID, second task unchanged"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); + CFE_UtAssert_TRUE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); /* Test deleting an application and cleaning up its resources where the * application ID doesn't match and the application is a core application @@ -1712,14 +1608,10 @@ void TestApps(void) UtAppRecPtr->MainTaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_SUCCESS, "CFE_ES_CleanUpApp", - "Application ID mismatch; core application"); + CFE_UtAssert_SUCCESS(CFE_ES_CleanUpApp(AppId)); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), "CFE_ES_CleanUpApp", - "Application ID mismatch; core application"); - - UT_Report(__FILE__, __LINE__, CFE_ES_Global.RegisteredExternalApps == 1, "CFE_ES_CleanUpApp", - "Application ID mismatch; core application"); + CFE_UtAssert_TRUE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); + UtAssert_UINT32_EQ(CFE_ES_Global.RegisteredExternalApps, 1); /* Test successfully deleting an application and cleaning up its resources * and the application is an external application @@ -1729,10 +1621,9 @@ void TestApps(void) /* Setup an entry which will be deleted */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanUpApp(AppId) == CFE_SUCCESS && !CFE_ES_TaskRecordIsUsed(UtTaskRecPtr) && - CFE_ES_Global.RegisteredExternalApps == 0, - "CFE_ES_CleanUpApp", "Successful application cleanup; external application"); + CFE_UtAssert_SUCCESS(CFE_ES_CleanUpApp(AppId)); + CFE_UtAssert_FALSE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); + UtAssert_UINT32_EQ(CFE_ES_Global.RegisteredExternalApps, 0); /* Test cleaning up the OS resources for a task with failure to * obtain information on mutex, binary, and counter semaphores, and @@ -1747,8 +1638,7 @@ void TestApps(void) UT_SetDeferredRetcode(UT_KEY(OS_QueueGetInfo), 1, OS_ERROR); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); UT_SetDeferredRetcode(UT_KEY(OS_FDGetInfo), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_SUCCESS, "CFE_ES_CleanupTaskResources", - "Get OS information failures"); + CFE_UtAssert_SUCCESS(CFE_ES_CleanupTaskResources(TaskId)); } void TestResourceID(void) @@ -1777,9 +1667,7 @@ void TestResourceID(void) cfe_id1 = CFE_ES_TASKID_C(ES_UT_MakeTaskIdForIndex(0)); osal_id = CFE_ES_TaskId_ToOSAL(cfe_id1); cfe_id2 = CFE_ES_TaskId_FromOSAL(osal_id); - UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(cfe_id1, cfe_id2), - "CFE_ES_TaskId_ToOSAL()/FromOSAL(): before=%lx, after=%lx", CFE_RESOURCEID_TO_ULONG(cfe_id1), - CFE_RESOURCEID_TO_ULONG(cfe_id2)); + CFE_UtAssert_RESOURCEID_EQ(cfe_id1, cfe_id2); } void TestLibs(void) @@ -1787,7 +1675,6 @@ void TestLibs(void) CFE_ES_LibRecord_t * UtLibRecPtr; char LongLibraryName[sizeof(UtLibRecPtr->LibName) + 1]; CFE_ES_LibId_t Id; - int32 Return; CFE_ES_ModuleLoadParams_t LoadParams; /* Test shared library loading and initialization where the initialization @@ -1796,57 +1683,44 @@ void TestLibs(void) ES_ResetUnitTest(); UT_SetDummyFuncRtn(-444); ES_UT_SetupModuleLoadParams(&LoadParams, "filename", "entrypt"); - Return = CFE_ES_LoadLibrary(&Id, "LibName", &LoadParams); - UtAssert_INT32_EQ(Return, -444); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_SHARED_LIBRARY_INIT])); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "LibName", &LoadParams), -444); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_SHARED_LIBRARY_INIT]); /* Test Load library returning an error on a null pointer argument */ - Return = CFE_ES_LoadLibrary(&Id, "LibName", NULL); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_LoadLibrary", - "Load shared library bad argument (NULL filename)"); - - Return = CFE_ES_LoadLibrary(&Id, NULL, &LoadParams); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_LoadLibrary", - "Load shared library bad argument (NULL library name)"); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "LibName", NULL), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, NULL, &LoadParams), CFE_ES_BAD_ARGUMENT); /* Test Load library returning an error on a too long library name */ memset(LongLibraryName, 'a', sizeof(LongLibraryName) - 1); LongLibraryName[sizeof(LongLibraryName) - 1] = '\0'; - Return = CFE_ES_LoadLibrary(&Id, LongLibraryName, &LoadParams); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_LoadLibrary", - "Load shared library bad argument (library name too long)"); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, LongLibraryName, &LoadParams), CFE_ES_BAD_ARGUMENT); /* Test successful shared library loading and initialization */ UT_InitData(); UT_SetDummyFuncRtn(OS_SUCCESS); - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams); - UT_Report(__FILE__, __LINE__, Return == CFE_SUCCESS, "CFE_ES_LoadLibrary", "successful"); + CFE_UtAssert_SUCCESS(CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams)); UtLibRecPtr = CFE_ES_LocateLibRecordByID(Id); - UtAssert_True(UtLibRecPtr != NULL, "CFE_ES_LoadLibrary() return valid ID"); - UtAssert_True(CFE_ES_LibRecordIsUsed(UtLibRecPtr), "CFE_ES_LoadLibrary() record used"); + UtAssert_NOT_NULL(UtLibRecPtr); + CFE_UtAssert_TRUE(CFE_ES_LibRecordIsUsed(UtLibRecPtr)); /* Try loading same library again, should return the DUPLICATE code */ - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_ERR_DUPLICATE_NAME, "CFE_ES_LoadLibrary", "Duplicate"); - UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(Id, CFE_ES_LibRecordGetID(UtLibRecPtr)), - "CFE_ES_LoadLibrary() returned previous ID"); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams), CFE_ES_ERR_DUPLICATE_NAME); + CFE_UtAssert_RESOURCEID_EQ(Id, CFE_ES_LibRecordGetID(UtLibRecPtr)); /* Test shared library loading and initialization where the library * fails to load */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_ModuleLoad), 1, -1); - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams); - UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Test shared library loading and initialization where the library * entry point symbol cannot be found */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_ModuleSymbolLookup), 1, -1); - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams); - UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* * Test shared library loading and initialization where the library @@ -1855,14 +1729,12 @@ void TestLibs(void) */ ES_ResetUnitTest(); ES_UT_SetupModuleLoadParams(&LoadParams, "nullep", "NULL"); - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB1", &LoadParams); - UtAssert_INT32_EQ(Return, CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_LoadLibrary(&Id, "TST_LIB1", &LoadParams)); UtAssert_STUB_COUNT(OS_ModuleSymbolLookup, 0); /* should NOT have been called */ /* Likewise for a entry point where the string is empty */ LoadParams.InitSymbolName[0] = 0; - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB2", &LoadParams); - UtAssert_INT32_EQ(Return, CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_LoadLibrary(&Id, "TST_LIB2", &LoadParams)); UtAssert_STUB_COUNT(OS_ModuleSymbolLookup, 0); /* should NOT have been called */ /* Test shared library loading and initialization where the library @@ -1872,34 +1744,31 @@ void TestLibs(void) UT_SetDefaultReturnValue(UT_KEY(OS_remove), OS_ERROR); /* for coverage of error path */ UT_SetDefaultReturnValue(UT_KEY(dummy_function), -555); ES_UT_SetupModuleLoadParams(&LoadParams, "filename", "dummy_function"); - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams); - UT_Report(__FILE__, __LINE__, Return == -555, "CFE_ES_LoadLibrary", "Library initialization function failure"); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams), -555); /* Test shared library loading and initialization where there are no * library slots available */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); - Return = CFE_ES_LoadLibrary(&Id, "LibName", &LoadParams); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_NO_RESOURCE_IDS_AVAILABLE && UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_LIBRARY_SLOTS]), - "CFE_ES_LoadLibrary", "No free library slots"); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "LibName", &LoadParams), CFE_ES_NO_RESOURCE_IDS_AVAILABLE); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_LIBRARY_SLOTS]); /* check operation of the CFE_ES_CheckLibIdSlotUsed() function */ CFE_ES_Global.LibTable[1].LibId = CFE_ES_LIBID_C(ES_UT_MakeLibIdForIndex(1)); CFE_ES_Global.LibTable[2].LibId = CFE_ES_LIBID_UNDEFINED; - UtAssert_True(CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(1)), "Lib Slot Used"); - UtAssert_True(!CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(2)), "Lib Slot Unused"); + CFE_UtAssert_TRUE(CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(1))); + CFE_UtAssert_FALSE(CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(2))); /* * Test public Name+ID query/lookup API */ ES_ResetUnitTest(); ES_UT_SetupSingleLibId("UT", &UtLibRecPtr); Id = CFE_ES_LibRecordGetID(UtLibRecPtr); - UtAssert_INT32_EQ(CFE_ES_GetLibName(LongLibraryName, Id, sizeof(LongLibraryName)), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GetLibName(LongLibraryName, Id, sizeof(LongLibraryName))); UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&Id, "Nonexistent"), CFE_ES_ERR_NAME_NOT_FOUND); - UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&Id, LongLibraryName), CFE_SUCCESS); - UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(Id, CFE_ES_LibRecordGetID(UtLibRecPtr)), "Library IDs Match"); + CFE_UtAssert_SUCCESS(CFE_ES_GetLibIDByName(&Id, LongLibraryName)); + CFE_UtAssert_RESOURCEID_EQ(Id, CFE_ES_LibRecordGetID(UtLibRecPtr)); UtAssert_INT32_EQ(CFE_ES_GetLibName(LongLibraryName, CFE_ES_LIBID_UNDEFINED, sizeof(LongLibraryName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetLibName(NULL, Id, sizeof(LongLibraryName)), CFE_ES_BAD_ARGUMENT); @@ -1908,7 +1777,6 @@ void TestLibs(void) void TestERLog(void) { - int Return; void * LocalBuffer; size_t LocalBufSize; CFE_ES_BackgroundLogDumpGlobal_t State; @@ -1921,12 +1789,11 @@ void TestERLog(void) */ ES_ResetUnitTest(); CFE_ES_Global.ResetDataPtr->ERLogIndex = CFE_PLATFORM_ES_ER_LOG_ENTRIES + 1; - Return = CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, 1, NULL); - UT_Report(__FILE__, __LINE__, - Return == CFE_SUCCESS && - !strcmp(CFE_ES_Global.ResetDataPtr->ERLog[0].BaseInfo.Description, "No Description String Given.") && - CFE_ES_Global.ResetDataPtr->ERLogIndex == 1, - "CFE_ES_WriteToERLog", "Log entries exceeded; no description; valid context size"); + CFE_UtAssert_SUCCESS(CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, 1, NULL)); + UtAssert_UINT32_EQ(CFE_ES_Global.ResetDataPtr->ERLogIndex, 1); + CFE_UtAssert_STRINGBUF_EQ(CFE_ES_Global.ResetDataPtr->ERLog[0].BaseInfo.Description, + sizeof(CFE_ES_Global.ResetDataPtr->ERLog[0].BaseInfo.Description), + "No Description String Given.", SIZE_MAX); /* Test non-rolling over log entry, * null description, @@ -1934,9 +1801,8 @@ void TestERLog(void) */ ES_ResetUnitTest(); CFE_ES_Global.ResetDataPtr->ERLogIndex = 0; - Return = CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, 1, NULL); - UT_Report(__FILE__, __LINE__, Return == CFE_SUCCESS && CFE_ES_Global.ResetDataPtr->ERLogIndex == 1, - "CFE_ES_WriteToERLog", "No log entry rollover; no description; no context"); + CFE_UtAssert_SUCCESS(CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, 1, NULL)); + UtAssert_UINT32_EQ(CFE_ES_Global.ResetDataPtr->ERLogIndex, 1); /* Test ER log background write functions */ memset(&State, 0, sizeof(State)); @@ -1944,47 +1810,42 @@ void TestERLog(void) LocalBufSize = 0; UT_SetDeferredRetcode(UT_KEY(CFE_PSP_Exception_CopyContext), 1, 128); - UtAssert_True(!CFE_ES_BackgroundERLogFileDataGetter(&State, 0, &LocalBuffer, &LocalBufSize), - "CFE_ES_BackgroundERLogFileDataGetter at start, with context"); - UtAssert_UINT32_EQ(State.EntryBuffer.ContextSize, 128); + CFE_UtAssert_FALSE(CFE_ES_BackgroundERLogFileDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); + CFE_UtAssert_MEMOFFSET_EQ(State.EntryBuffer.ContextSize, 128); UtAssert_NOT_NULL(LocalBuffer); UtAssert_NONZERO(LocalBufSize); memset(&State.EntryBuffer, 0xEE, sizeof(State.EntryBuffer)); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_Exception_CopyContext), 1, -1); - UtAssert_True( - CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES - 1, &LocalBuffer, &LocalBufSize), - "CFE_ES_BackgroundERLogFileDataGetter at EOF, no context"); + CFE_UtAssert_TRUE( + CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES - 1, &LocalBuffer, &LocalBufSize)); UtAssert_ZERO(State.EntryBuffer.ContextSize); - UtAssert_True( - CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES, &LocalBuffer, &LocalBufSize), - "CFE_ES_BackgroundERLogFileDataGetter beyond EOF"); + CFE_UtAssert_TRUE( + CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES, &LocalBuffer, &LocalBufSize)); UtAssert_NULL(LocalBuffer); UtAssert_ZERO(LocalBufSize); /* Test ER log background write event handling */ UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_COMPLETE, CFE_SUCCESS, 10, 0, 100); - UtAssert_True(UT_EventIsInHistory(CFE_ES_ERLOG2_EID), "COMPLETE: CFE_ES_ERLOG2_EID generated"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERLOG2_EID); UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR, -1, 10, 10, 100); - UtAssert_True(UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), - "HEADER_WRITE_ERROR: CFE_ES_FILEWRITE_ERR_EID generated"); + CFE_UtAssert_EVENTSENT(CFE_ES_FILEWRITE_ERR_EID); UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR, -1, 10, 10, 100); - UtAssert_True(UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), - "RECORD_WRITE_ERROR: CFE_ES_FILEWRITE_ERR_EID generated"); + CFE_UtAssert_EVENTSENT(CFE_ES_FILEWRITE_ERR_EID); UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_CREATE_ERROR, -1, 10, 10, 100); - UtAssert_True(UT_EventIsInHistory(CFE_ES_ERLOG2_ERR_EID), "CREATE_ERROR: CFE_ES_ERLOG2_ERR_EID generated"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERLOG2_ERR_EID); UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_UNDEFINED, CFE_SUCCESS, 10, 0, 100); - UtAssert_True(UT_GetNumEventsSent() == 0, "UNDEFINED: No event generated"); + CFE_UtAssert_EVENTCOUNT(0); } void TestGenericPool(void) @@ -2024,31 +1885,31 @@ void TestGenericPool(void) /* Test successfully creating direct access pool, with alignment, no mutex */ memset(&UT_MemPoolDirectBuffer, 0xee, sizeof(UT_MemPoolDirectBuffer)); OffsetEnd = sizeof(UT_MemPoolDirectBuffer.Data); - UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool1, 0, OffsetEnd, 32, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - UT_POOL_BLOCK_SIZES, ES_UT_PoolDirectRetrieve, ES_UT_PoolDirectCommit), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolInitialize(&Pool1, 0, OffsetEnd, 32, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, + UT_POOL_BLOCK_SIZES, ES_UT_PoolDirectRetrieve, + ES_UT_PoolDirectCommit)); /* Allocate buffers until no space left */ - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset1, 44), CFE_SUCCESS); - UtAssert_True(Offset1 > 0 && Offset1 < OffsetEnd, "0 < Offset(%lu) < %lu", (unsigned long)Offset1, - (unsigned long)OffsetEnd); - UtAssert_True((Offset1 & 0x1F) == 0, "Offset(%lu) 32 byte alignment", (unsigned long)Offset1); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset1, 44)); + UtAssert_NONZERO(Offset1); + CFE_UtAssert_ATMOST(Offset1, OffsetEnd - 44); + UtAssert_True((Offset1 & 0x1F) == 0, "Offset1(%lu) 32 byte alignment", (unsigned long)Offset1); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset2, 72), CFE_SUCCESS); - UtAssert_True(Offset2 > Offset1 && Offset2 < OffsetEnd, "%lu < Offset(%lu) < %lu", (unsigned long)Offset1, - (unsigned long)Offset2, (unsigned long)OffsetEnd); - UtAssert_True((Offset2 & 0x1F) == 0, "Offset(%lu) 32 byte alignment", (unsigned long)Offset2); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset2, 72)); + CFE_UtAssert_ATLEAST(Offset2, Offset1 + 44); + CFE_UtAssert_ATMOST(Offset2, OffsetEnd - 72); + UtAssert_True((Offset2 & 0x1F) == 0, "Offset2(%lu) 32 byte alignment", (unsigned long)Offset2); UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 72), CFE_ES_ERR_MEM_BLOCK_SIZE); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 6), CFE_SUCCESS); - UtAssert_True(Offset3 > Offset2 && Offset3 < OffsetEnd, "%lu < Offset(%lu) < %lu", (unsigned long)Offset2, - (unsigned long)Offset3, (unsigned long)OffsetEnd); - UtAssert_True((Offset3 & 0x1F) == 0, "Offset(%lu) 32 byte alignment", (unsigned long)Offset3); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 6)); + CFE_UtAssert_ATLEAST(Offset3, Offset2 + 72); + CFE_UtAssert_ATMOST(Offset3, OffsetEnd - 6); + UtAssert_True((Offset3 & 0x1F) == 0, "Offset3(%lu) 32 byte alignment", (unsigned long)Offset3); /* Free a buffer and attempt to reallocate */ - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset2), CFE_SUCCESS); - UtAssert_UINT32_EQ(BlockSize, 72); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset2)); + CFE_UtAssert_MEMOFFSET_EQ(BlockSize, 72); /* Should not be able to free more than once */ /* This should increment the validation error count */ @@ -2056,9 +1917,8 @@ void TestGenericPool(void) UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset2), CFE_ES_POOL_BLOCK_INVALID); UtAssert_NONZERO(Pool1.ValidationErrorCount); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset4, 100), CFE_SUCCESS); - UtAssert_True(Offset4 == Offset2, "New Offset(%lu) == Old Offset(%lu)", (unsigned long)Offset4, - (unsigned long)Offset2); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset4, 100)); + CFE_UtAssert_MEMOFFSET_EQ(Offset4, Offset2); /* Attempt Bigger than the largest bucket */ UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset1, 1000), CFE_ES_ERR_MEM_BLOCK_SIZE); @@ -2069,23 +1929,23 @@ void TestGenericPool(void) CFE_ES_GenPoolGetBucketUsage(&Pool1, 1, &BlockStats); /* Check various outputs to ensure correctness */ - UtAssert_UINT32_EQ(TotalSize, OffsetEnd); + CFE_UtAssert_MEMOFFSET_EQ(TotalSize, OffsetEnd); UtAssert_UINT32_EQ(CountBuf, 3); - UtAssert_True(FreeSize > 0, "FreeSize(%lu) > 0", (unsigned long)FreeSize); + UtAssert_NONZERO(FreeSize); /* put blocks so the pool has a mixture of allocated an deallocated blocks */ - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset1), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset2), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset1)); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset2)); /* Now wipe the pool management structure, and attempt to rebuild it. */ - UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool2, 0, OffsetEnd, 32, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - UT_POOL_BLOCK_SIZES, ES_UT_PoolDirectRetrieve, ES_UT_PoolDirectCommit), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolInitialize(&Pool2, 0, OffsetEnd, 32, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, + UT_POOL_BLOCK_SIZES, ES_UT_PoolDirectRetrieve, + ES_UT_PoolDirectCommit)); - UtAssert_INT32_EQ(CFE_ES_GenPoolRebuild(&Pool2), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolRebuild(&Pool2)); /* After rebuilding, Pool2 should have similar state data to Pool1. */ - UtAssert_UINT32_EQ(Pool1.TailPosition, Pool2.TailPosition); + CFE_UtAssert_MEMOFFSET_EQ(Pool1.TailPosition, Pool2.TailPosition); UtAssert_UINT32_EQ(Pool1.AllocationCount, Pool2.AllocationCount); for (i = 0; i < Pool1.NumBuckets; ++i) @@ -2103,59 +1963,58 @@ void TestGenericPool(void) /* Get blocks again, from the recovered pool, to demonstrate that * the pool is functional after recovery. */ - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 44), CFE_SUCCESS); - UtAssert_UINT32_EQ(Offset3, Offset1); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 44)); + CFE_UtAssert_MEMOFFSET_EQ(Offset3, Offset1); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset4, 72), CFE_SUCCESS); - UtAssert_UINT32_EQ(Offset4, Offset2); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset4, 72)); + CFE_UtAssert_MEMOFFSET_EQ(Offset4, Offset2); /* Test successfully creating indirect memory pool, no alignment, with mutex */ memset(&UT_MemPoolIndirectBuffer, 0xee, sizeof(UT_MemPoolIndirectBuffer)); OffsetEnd = sizeof(UT_MemPoolIndirectBuffer.Data); - UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool2, 2, OffsetEnd - 2, 0, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - UT_POOL_BLOCK_SIZES, ES_UT_PoolIndirectRetrieve, - ES_UT_PoolIndirectCommit), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolInitialize(&Pool2, 2, OffsetEnd - 2, 0, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, + UT_POOL_BLOCK_SIZES, ES_UT_PoolIndirectRetrieve, + ES_UT_PoolIndirectCommit)); /* Do Series of allocations - confirm that the implementation is * properly adhering to the block sizes specified. */ - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset1, 1), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset1, 1)); /* With no alignment adjustments, the result offset should be exactly matching */ - UtAssert_True(Offset1 == 2 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", (unsigned long)Offset1); + CFE_UtAssert_MEMOFFSET_EQ(Offset1, 2 + sizeof(CFE_ES_GenPoolBD_t)); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset2, 55), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset2, 55)); /* the previous block should be 4 in size (smallest block) */ - UtAssert_True(Offset2 == Offset1 + 4 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", (unsigned long)Offset2); + CFE_UtAssert_MEMOFFSET_EQ(Offset2, Offset1 + 4 + sizeof(CFE_ES_GenPoolBD_t)); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 15), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 15)); /* the previous block should be 56 in size */ - UtAssert_True(Offset3 == Offset2 + 56 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", (unsigned long)Offset3); + CFE_UtAssert_MEMOFFSET_EQ(Offset3, Offset2 + 56 + sizeof(CFE_ES_GenPoolBD_t)); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset4, 54), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset4, 54)); /* the previous block should be 16 in size */ - UtAssert_True(Offset4 == Offset3 + 16 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", (unsigned long)Offset4); + CFE_UtAssert_MEMOFFSET_EQ(Offset4, Offset3 + 16 + sizeof(CFE_ES_GenPoolBD_t)); - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset1), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset2), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset3), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset4), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset1, 56), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset1)); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset2)); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset3)); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset4)); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset1, 56)); /* should re-issue previous block */ - UtAssert_True(Offset4 == Offset1, "Offset(%lu) match", (unsigned long)Offset1); + CFE_UtAssert_MEMOFFSET_EQ(Offset4, Offset1); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 56), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 56)); /* should re-issue previous block */ - UtAssert_True(Offset3 == Offset2, "Offset(%lu) match", (unsigned long)Offset3); + CFE_UtAssert_MEMOFFSET_EQ(Offset3, Offset2); /* Getting another will fail, despite being enough space, * because its now fragmented. */ UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset2, 12), CFE_ES_ERR_MEM_BLOCK_SIZE); /* Put the buffer, then corrupt the memory and try to recycle */ - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset3), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset3)); memset(UT_MemPoolIndirectBuffer.Data, 0xee, sizeof(UT_MemPoolIndirectBuffer.Data)); UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 56), CFE_ES_ERR_MEM_BLOCK_SIZE); @@ -2165,35 +2024,34 @@ void TestGenericPool(void) /* Calculate exact (predicted) pool consumption per block */ OffsetEnd = (sizeof(CFE_ES_GenPoolBD_t) + 31) & 0xFFF0; OffsetEnd *= 2; /* make enough for 2 */ - UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool1, 0, OffsetEnd, 16, 1, UT_POOL_BLOCK_SIZES, - ES_UT_PoolDirectRetrieve, ES_UT_PoolDirectCommit), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolInitialize(&Pool1, 0, OffsetEnd, 16, 1, UT_POOL_BLOCK_SIZES, + ES_UT_PoolDirectRetrieve, ES_UT_PoolDirectCommit)); /* * This should be exactly enough for 2 allocations. * Allocation larger than 16 should fail. */ UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset1, 32), CFE_ES_ERR_MEM_BLOCK_SIZE); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset2, 1), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 16), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset2, 1)); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 16)); /* Call stats functions for coverage (no return code) */ CFE_ES_GenPoolGetUsage(&Pool1, &FreeSize, &TotalSize); CFE_ES_GenPoolGetCounts(&Pool1, &NumBlocks, &CountBuf, &ErrBuf); /* Check various outputs to ensure correctness */ - UtAssert_UINT32_EQ(TotalSize, OffsetEnd); - UtAssert_UINT32_EQ(FreeSize, 0); + CFE_UtAssert_MEMOFFSET_EQ(TotalSize, OffsetEnd); + CFE_UtAssert_MEMOFFSET_EQ(FreeSize, 0); UtAssert_UINT32_EQ(CountBuf, 2); /* * Check other validation */ UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, 0), CFE_ES_BUFFER_NOT_IN_POOL); - UtAssert_True(CFE_ES_GenPoolValidateState(&Pool1), "Nominal Handle validation"); + CFE_UtAssert_TRUE(CFE_ES_GenPoolValidateState(&Pool1)); Pool1.TailPosition = 0xFFFFFF; - UtAssert_True(!CFE_ES_GenPoolValidateState(&Pool1), "Validate Corrupt handle"); + CFE_UtAssert_FALSE(CFE_ES_GenPoolValidateState(&Pool1)); } void TestTask(void) @@ -2247,71 +2105,64 @@ void TestTask(void) /* Set up buffer for first cycle, pipe failure is on 2nd */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); CFE_ES_TaskMain(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_COMMAND_PIPE]), "CFE_ES_TaskMain", - "Command pipe error, UT_OSP_COMMAND_PIPE message"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_COMMAND_PIPE]); /* Test task main process loop with bad checksum information */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_GetCFETextSegmentInfo), 1, -1); /* this is needed so CFE_ES_GetAppId works */ ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == CFE_SUCCESS, "CFE_ES_TaskInit", - "Checksum fail, task init result"); - UT_Report(__FILE__, __LINE__, CFE_ES_Global.TaskData.HkPacket.Payload.CFECoreChecksum == 0xFFFF, "CFE_ES_TaskInit", - "Checksum fail, checksum value"); + CFE_UtAssert_SUCCESS(CFE_ES_TaskInit()); + UtAssert_UINT32_EQ(CFE_ES_Global.TaskData.HkPacket.Payload.CFECoreChecksum, 0xFFFF); /* Test successful task main process loop - Power On Reset Path */ ES_ResetUnitTest(); /* this is needed so CFE_ES_GetAppId works */ ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); CFE_ES_Global.ResetDataPtr->ResetVars.ResetType = 2; - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == CFE_SUCCESS && CFE_ES_Global.TaskData.HkPacket.Payload.CFECoreChecksum != 0xFFFF, - "CFE_ES_TaskInit", "Checksum success, POR Path"); + CFE_UtAssert_SUCCESS(CFE_ES_TaskInit()); /* Test successful task main process loop - Processor Reset Path */ ES_ResetUnitTest(); /* this is needed so CFE_ES_GetAppId works */ ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); CFE_ES_Global.ResetDataPtr->ResetVars.ResetType = 1; - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == CFE_SUCCESS && CFE_ES_Global.TaskData.HkPacket.Payload.CFECoreChecksum != 0xFFFF, - "CFE_ES_TaskInit", "Checksum success, PR Path"); + CFE_UtAssert_SUCCESS(CFE_ES_TaskInit()); /* Test task main process loop with a with an EVS register failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -1, "CFE_ES_TaskInit", "EVS register fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -1); /* Test task main process loop with a SB pipe create failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, -2); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -2, "CFE_ES_TaskInit", "SB pipe create fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -2); /* Test task main process loop with a HK packet subscribe failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 1, -3); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -3, "CFE_ES_TaskInit", "HK packet subscribe fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -3); /* Test task main process loop with a ground command subscribe failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 2, -4); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -4, "CFE_ES_TaskInit", "Ground command subscribe fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -4); /* Test task main process loop with an init event send failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 1, -5); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -5, "CFE_ES_TaskInit", "Initialization event send fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -5); /* Test task main process loop with version event send failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 2, -6); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -6, "CFE_ES_TaskInit", "Version event send fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -6); /* Test task init with background init fail */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_BinSemCreate), 1, -7); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -7, "CFE_ES_TaskInit", "Background init fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -7); /* Set the log mode to OVERWRITE; CFE_ES_TaskInit() sets SystemLogMode to * DISCARD, which can result in a log overflow depending on the value that @@ -2322,26 +2173,23 @@ void TestTask(void) /* Test a successful HK request */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_SEND_HK); - UT_Report(__FILE__, __LINE__, CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree > 0, "CFE_ES_HousekeepingCmd", - "HK packet - get heap successful"); + UtAssert_NONZERO(CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree); /* Test the HK request with a get heap failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_HeapGetInfo), 1, -1); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_SEND_HK); - UT_Report(__FILE__, __LINE__, CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree == 0, "CFE_ES_HousekeepingCmd", - "HK packet - get heap fail"); + UtAssert_ZERO(CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree); /* Test successful no-op command */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_CMD_NOOP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_NOOP_INF_EID), "CFE_ES_NoopCmd", "No-op"); + CFE_UtAssert_EVENTSENT(CFE_ES_NOOP_INF_EID); /* Test successful reset counters command */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_CMD_RESET_COUNTERS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESET_INF_EID), "CFE_ES_ResetCountersCmd", - "Reset counters"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESET_INF_EID); /* Test successful cFE restart */ ES_ResetUnitTest(); @@ -2349,16 +2197,14 @@ void TestTask(void) CmdBuf.RestartCmd.Payload.RestartType = CFE_PSP_RST_TYPE_PROCESSOR; UT_SetDataBuffer(UT_KEY(CFE_PSP_Restart), &ResetType, sizeof(ResetType), false); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartCmd), UT_TPID_CFE_ES_CMD_RESTART_CC); - UT_Report(__FILE__, __LINE__, - ResetType == CFE_PSP_RST_TYPE_PROCESSOR && UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, - "CFE_ES_RestartCmd", "Restart cFE"); + UtAssert_UINT32_EQ(ResetType, CFE_PSP_RST_TYPE_PROCESSOR); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 1); /* Test cFE restart with bad restart type */ ES_ResetUnitTest(); CmdBuf.RestartCmd.Payload.RestartType = 4524; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartCmd), UT_TPID_CFE_ES_CMD_RESTART_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_BOOT_ERR_EID), "CFE_ES_RestartCmd", - "Invalid restart type"); + CFE_UtAssert_EVENTSENT(CFE_ES_BOOT_ERR_EID); /* Test successful app create */ ES_ResetUnitTest(); @@ -2374,15 +2220,13 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(8192); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INF_EID), "CFE_ES_StartAppCmd", - "Start application from file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_INF_EID); /* Test app create with an OS task create failure */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_ERR_EID), "CFE_ES_StartAppCmd", - "Start application from file name fail"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_ERR_EID); /* Test app create with an invalid file name */ ES_ResetUnitTest(); @@ -2399,8 +2243,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INVALID_FILENAME_ERR_EID), "CFE_ES_StartAppCmd", - "Invalid file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_INVALID_FILENAME_ERR_EID); /* Test app create with a null application entry point */ ES_ResetUnitTest(); @@ -2414,8 +2257,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INVALID_ENTRY_POINT_ERR_EID), "CFE_ES_StartAppCmd", - "Application entry point null"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_INVALID_ENTRY_POINT_ERR_EID); /* Test app create with a null application name */ ES_ResetUnitTest(); @@ -2430,8 +2272,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_NULL_APP_NAME_ERR_EID), "CFE_ES_StartAppCmd", - "Application name null"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_NULL_APP_NAME_ERR_EID); /* Test app create with with an invalid exception action */ ES_ResetUnitTest(); @@ -2447,8 +2288,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = 255; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_EXC_ACTION_ERR_EID), "CFE_ES_StartAppCmd", - "Invalid exception action"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_EXC_ACTION_ERR_EID); /* Test app create with a default stack size */ ES_ResetUnitTest(); @@ -2464,8 +2304,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(0); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INF_EID), "CFE_ES_StartAppCmd", - "Default Stack Size"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_INF_EID); /* Test app create with a bad priority */ ES_ResetUnitTest(); @@ -2481,8 +2320,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_PRIORITY_ERR_EID), "CFE_ES_StartAppCmd", - "Priority is too large"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_PRIORITY_ERR_EID); /* Test successful app stop */ ES_ResetUnitTest(); @@ -2490,15 +2328,13 @@ void TestTask(void) strncpy(CmdBuf.StopAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1); CmdBuf.StopAppCmd.Payload.Application[sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StopAppCmd), UT_TPID_CFE_ES_CMD_STOP_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_DBG_EID), "CFE_ES_StopAppCmd", - "Stop application initiated"); + CFE_UtAssert_EVENTSENT(CFE_ES_STOP_DBG_EID); /* Test app stop failure */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_WAITING, "CFE_ES", NULL, NULL); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StopAppCmd), UT_TPID_CFE_ES_CMD_STOP_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_ERR1_EID), "CFE_ES_StopAppCmd", - "Stop application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_STOP_ERR1_EID); /* Test app stop with a bad app name */ ES_ResetUnitTest(); @@ -2506,8 +2342,7 @@ void TestTask(void) strncpy(CmdBuf.StopAppCmd.Payload.Application, "BAD_APP_NAME", sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1); CmdBuf.StopAppCmd.Payload.Application[sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StopAppCmd), UT_TPID_CFE_ES_CMD_STOP_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_ERR2_EID), "CFE_ES_StopAppCmd", - "Stop application bad name"); + CFE_UtAssert_EVENTSENT(CFE_ES_STOP_ERR2_EID); /* Test successful app restart */ ES_ResetUnitTest(); @@ -2516,8 +2351,7 @@ void TestTask(void) strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartAppCmd), UT_TPID_CFE_ES_CMD_RESTART_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_DBG_EID), "CFE_ES_RestartAppCmd", - "Restart application initiated"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_DBG_EID); /* Test app restart with failed file check */ ES_ResetUnitTest(); @@ -2527,8 +2361,7 @@ void TestTask(void) strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application)); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartAppCmd), UT_TPID_CFE_ES_CMD_RESTART_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR1_EID), "CFE_ES_RestartAppCmd", - "Restart application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR1_EID); /* Test app restart with a bad app name */ ES_ResetUnitTest(); @@ -2537,8 +2370,7 @@ void TestTask(void) sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartAppCmd), UT_TPID_CFE_ES_CMD_RESTART_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR2_EID), "CFE_ES_RestartAppCmd", - "Restart application bad name"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR2_EID); /* Test failed app restart, core app */ ES_ResetUnitTest(); @@ -2547,8 +2379,7 @@ void TestTask(void) strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartAppCmd), UT_TPID_CFE_ES_CMD_RESTART_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR1_EID), "CFE_ES_RestartAppCmd", - "Restart application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR1_EID); /* Test failed app restart, not running */ ES_ResetUnitTest(); @@ -2557,8 +2388,7 @@ void TestTask(void) strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application)); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartAppCmd), UT_TPID_CFE_ES_CMD_RESTART_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR1_EID), "CFE_ES_RestartAppCmd", - "Restart application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR1_EID); /* Test successful app reload */ ES_ResetUnitTest(); @@ -2569,8 +2399,7 @@ void TestTask(void) strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ReloadAppCmd), UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_DBG_EID), "CFE_ES_ReloadAppCmd", - "Reload application initiated"); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_DBG_EID); /* Test app reload with missing file */ ES_ResetUnitTest(); @@ -2582,8 +2411,7 @@ void TestTask(void) strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ReloadAppCmd), UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR1_EID), "CFE_ES_ReloadAppCmd", - "Reload application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR1_EID); /* Test app reload with a bad app name */ ES_ResetUnitTest(); @@ -2592,8 +2420,7 @@ void TestTask(void) sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ReloadAppCmd), UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR2_EID), "CFE_ES_ReloadAppCmd", - "Reload application bad name"); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR2_EID); /* Test failed app reload, core app */ ES_ResetUnitTest(); @@ -2602,8 +2429,7 @@ void TestTask(void) strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ReloadAppCmd), UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR1_EID), "CFE_ES_ReloadAppCmd", - "Reload application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR1_EID); /* Test failed app reload, not RUNNING */ ES_ResetUnitTest(); @@ -2612,8 +2438,7 @@ void TestTask(void) strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ReloadAppCmd), UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR1_EID), "CFE_ES_ReloadAppCmd", - "Reload application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR1_EID); /* Test successful telemetry packet request for single app data */ ES_ResetUnitTest(); @@ -2622,8 +2447,7 @@ void TestTask(void) strncpy(CmdBuf.QueryOneCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1); CmdBuf.QueryOneCmd.Payload.Application[sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryOneCmd), UT_TPID_CFE_ES_CMD_QUERY_ONE_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ONE_APP_EID), "CFE_ES_QueryOneCmd", - "Query application - success"); + CFE_UtAssert_EVENTSENT(CFE_ES_ONE_APP_EID); /* Test telemetry packet request for single app data with send message failure */ ES_ResetUnitTest(); @@ -2633,8 +2457,7 @@ void TestTask(void) CmdBuf.QueryOneCmd.Payload.Application[sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1] = '\0'; UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, -1); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryOneCmd), UT_TPID_CFE_ES_CMD_QUERY_ONE_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ONE_ERR_EID), "CFE_ES_QueryOneCmd", - "Query application - SB send message fail"); + CFE_UtAssert_EVENTSENT(CFE_ES_ONE_ERR_EID); /* Test telemetry packet request for single app data with a bad app name */ ES_ResetUnitTest(); @@ -2643,8 +2466,7 @@ void TestTask(void) strncpy(CmdBuf.QueryOneCmd.Payload.Application, "BAD_APP_NAME", sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1); CmdBuf.QueryOneCmd.Payload.Application[sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryOneCmd), UT_TPID_CFE_ES_CMD_QUERY_ONE_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ONE_APPID_ERR_EID), "CFE_ES_QueryOneCmd", - "Query application - bad application name"); + CFE_UtAssert_EVENTSENT(CFE_ES_ONE_APPID_ERR_EID); /* Test successful write of all app data to file */ ES_ResetUnitTest(); @@ -2653,31 +2475,27 @@ void TestTask(void) strncpy(CmdBuf.QueryAllCmd.Payload.FileName, "AllFilename", sizeof(CmdBuf.QueryAllCmd.Payload.FileName) - 1); CmdBuf.QueryAllCmd.Payload.FileName[sizeof(CmdBuf.QueryAllCmd.Payload.FileName) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ALL_APPS_EID), "CFE_ES_QueryAllCmd", - "Query all applications - success"); + CFE_UtAssert_EVENTSENT(CFE_ES_ALL_APPS_EID); /* Test write of all app data to file with a null file name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ALL_APPS_EID), "CFE_ES_QueryAllCmd", - "Query all applications - null file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_ALL_APPS_EID); /* Test write of all app data to file with a bad file name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_OSCREATE_ERR_EID), "CFE_ES_QueryAllCmd", - "Query all applications - bad file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_OSCREATE_ERR_EID); /* Test write of all app data to file with a write header failure */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_WRHDR_ERR_EID), "CFE_ES_QueryAllCmd", - "Write application information file fail; write header"); + CFE_UtAssert_EVENTSENT(CFE_ES_WRHDR_ERR_EID); /* Test write of all app data to file with a file write failure */ ES_ResetUnitTest(); @@ -2685,8 +2503,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKWR_ERR_EID), "CFE_ES_QueryAllCmd", - "Write application information file fail; task write"); + CFE_UtAssert_EVENTSENT(CFE_ES_TASKWR_ERR_EID); /* Test write of all app data to file with a file create failure */ ES_ResetUnitTest(); @@ -2694,8 +2511,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_OSCREATE_ERR_EID), "CFE_ES_QueryAllCmd", - "Write application information file fail; OS create"); + CFE_UtAssert_EVENTSENT(CFE_ES_OSCREATE_ERR_EID); /* Test successful write of all task data to a file */ ES_ResetUnitTest(); @@ -2703,8 +2519,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_EID), "CFE_ES_QueryAllTasksCmd", - "Task information file written"); + CFE_UtAssert_EVENTSENT(CFE_ES_TASKINFO_EID); /* Test write of all task data to a file with file name validation failure */ ES_ResetUnitTest(); @@ -2712,8 +2527,7 @@ void TestTask(void) UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_OSCREATE_ERR_EID), "CFE_ES_QueryAllTasksCmd", - "Task information file write fail; OS create"); + CFE_UtAssert_EVENTSENT(CFE_ES_TASKINFO_OSCREATE_ERR_EID); /* Test write of all task data to a file with write header failure */ ES_ResetUnitTest(); @@ -2723,8 +2537,7 @@ void TestTask(void) UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, -1); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_WRHDR_ERR_EID), "CFE_ES_QueryAllTasksCmd", - "Task information file write fail; write header"); + CFE_UtAssert_EVENTSENT(CFE_ES_TASKINFO_WRHDR_ERR_EID); /* Test write of all task data to a file with a task write failure */ ES_ResetUnitTest(); @@ -2733,8 +2546,7 @@ void TestTask(void) UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_WR_ERR_EID), "CFE_ES_QueryAllTasksCmd", - "Task information file write fail; task write"); + CFE_UtAssert_EVENTSENT(CFE_ES_TASKINFO_WR_ERR_EID); /* Test write of all task data to a file with an OS create failure */ ES_ResetUnitTest(); @@ -2742,15 +2554,13 @@ void TestTask(void) UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_OSCREATE_ERR_EID), "CFE_ES_QueryAllTasksCmd", - "Task information file write fail; OS create"); + CFE_UtAssert_EVENTSENT(CFE_ES_TASKINFO_OSCREATE_ERR_EID); /* Test successful clearing of the system log */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ClearSysLogCmd), UT_TPID_CFE_ES_CMD_CLEAR_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG1_INF_EID), "CFE_ES_ClearSysLogCmd", - "Clear ES log data"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOG1_INF_EID); /* Test successful overwriting of the system log using discard mode */ ES_ResetUnitTest(); @@ -2758,8 +2568,7 @@ void TestTask(void) CmdBuf.OverwriteSysLogCmd.Payload.Mode = CFE_ES_LogMode_OVERWRITE; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.OverwriteSysLogCmd), UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOGMODE_EID), "CFE_ES_OverWriteSysLogCmd", - "Overwrite system log received (discard mode)"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOGMODE_EID); /* Test overwriting the system log using an invalid mode */ ES_ResetUnitTest(); @@ -2767,8 +2576,7 @@ void TestTask(void) CmdBuf.OverwriteSysLogCmd.Payload.Mode = 255; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.OverwriteSysLogCmd), UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERR_SYSLOGMODE_EID), "CFE_ES_OverWriteSysLogCmd", - "Overwrite system log using invalid mode"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERR_SYSLOGMODE_EID); /* Test successful writing of the system log */ ES_ResetUnitTest(); @@ -2777,24 +2585,21 @@ void TestTask(void) CmdBuf.WriteSysLogCmd.Payload.FileName[sizeof(CmdBuf.WriteSysLogCmd.Payload.FileName) - 1] = '\0'; CFE_ES_Global.TaskData.HkPacket.Payload.SysLogEntries = 123; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG2_EID), "CFE_ES_WriteSysLogCmd", - "Write system log; success"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOG2_EID); /* Test writing the system log using a bad file name */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG2_ERR_EID), "CFE_ES_WriteSysLogCmd", - "Write system log; bad file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOG2_ERR_EID); /* Test writing the system log using a null file name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.WriteSysLogCmd.Payload.FileName[0] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG2_EID), "CFE_ES_WriteSysLogCmd", - "Write system log; null file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOG2_EID); /* Test writing the system log with an OS create failure */ ES_ResetUnitTest(); @@ -2802,8 +2607,7 @@ void TestTask(void) UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); CmdBuf.WriteSysLogCmd.Payload.FileName[0] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG2_ERR_EID), "CFE_ES_WriteSysLogCmd", - "Write system log; OS create"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOG2_ERR_EID); /* Test writing the system log with an OS write failure */ ES_ResetUnitTest(); @@ -2815,21 +2619,19 @@ void TestTask(void) CFE_ES_Global.ResetDataPtr->SystemLogEndIdx = CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx; CmdBuf.WriteSysLogCmd.Payload.FileName[0] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), "CFE_ES_WriteSysLogCmd", - "Write system log; OS write"); + CFE_UtAssert_EVENTSENT(CFE_ES_FILEWRITE_ERR_EID); /* Test writing the system log with a write header failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), "CFE_ES_WriteSysLogCmd", - "Write system log; write header"); + CFE_UtAssert_EVENTSENT(CFE_ES_FILEWRITE_ERR_EID); /* Test successful clearing of the E&R log */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ClearERLogCmd), UT_TPID_CFE_ES_CMD_CLEAR_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERLOG1_INF_EID), "CFE_ES_ClearERLogCmd", "Clear E&R log"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERLOG1_INF_EID); /* Test successful writing of the E&R log */ /* In the current implementation, it does not directly write the file, @@ -2840,38 +2642,32 @@ void TestTask(void) CmdBuf.WriteERLogCmd.Payload.FileName[sizeof(CmdBuf.WriteERLogCmd.Payload.FileName) - 1] = '\0'; UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), false); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteERLogCmd), UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_FS_BackgroundFileDumpRequest)) == 1, - "CFE_ES_WriteERLogCmd", "Write E&R log command; pending"); - UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_ERLOG_PENDING_ERR_EID), "CFE_ES_WriteERLogCmd", - "Write E&R log command; no events"); + UtAssert_STUB_COUNT(CFE_FS_BackgroundFileDumpRequest, 1); + CFE_UtAssert_EVENTCOUNT(0); /* Failure of parsing the file name */ UT_ClearEventHistory(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteERLogCmd), UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERLOG2_ERR_EID), "CFE_ES_WriteERLogCmd", - "Write E&R log command; bad file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERLOG2_ERR_EID); /* Failure from CFE_FS_BackgroundFileDumpRequest() should send the pending error event ID */ UT_ClearEventHistory(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_BackgroundFileDumpRequest), 1, CFE_STATUS_REQUEST_ALREADY_PENDING); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteERLogCmd), UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERLOG_PENDING_ERR_EID), "CFE_ES_WriteERLogCmd", - "Write E&R log command; already pending event (from FS)"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERLOG_PENDING_ERR_EID); /* Same event but pending locally */ UT_ClearEventHistory(); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), true); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteERLogCmd), UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERLOG_PENDING_ERR_EID), "CFE_ES_WriteERLogCmd", - "Write E&R log command; already pending event (local)"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERLOG_PENDING_ERR_EID); /* Test scan for exceptions in the PSP, should invoke a Processor Reset */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetCount), 1); CFE_ES_RunExceptionScan(0, NULL); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, "CFE_ES_RunExceptionScan", - "Scan for exceptions; processor restart"); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 1); ES_ResetUnitTest(); CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount = 0; @@ -2879,12 +2675,11 @@ void TestTask(void) UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetCount), 1); CFE_ES_RunExceptionScan(0, NULL); /* first time should do a processor restart (limit reached) */ - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, "CFE_ES_RunExceptionScan", - "Scan for exceptions; processor restart"); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 1); + /* next time should do a poweron restart (limit reached) */ CFE_ES_RunExceptionScan(0, NULL); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 2, "CFE_ES_RunExceptionScan", - "Scan for exceptions; poweron restart"); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 2); /* nominal for app restart - associate exception with a task ID */ ES_ResetUnitTest(); @@ -2897,11 +2692,8 @@ void TestTask(void) CFE_ES_RunExceptionScan(0, NULL); /* should have changed AppControlRequest from RUN to SYS_RESTART, * and the call to CFE_PSP_Restart should NOT increment */ - UT_Report(__FILE__, __LINE__, UtAppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_SYS_RESTART, - "CFE_ES_RunExceptionScan", "Scan for exceptions; app restart request pending"); - - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 0, "CFE_ES_RunExceptionScan", - "Scan for exceptions; no psp restart"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppControlRequest, CFE_ES_RunStatus_SYS_RESTART); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 0); /* repeat, but for a CORE app, which cannot be restarted */ ES_ResetUnitTest(); @@ -2912,29 +2704,25 @@ void TestTask(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->StartParams.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; CFE_ES_RunExceptionScan(0, NULL); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, "CFE_ES_RunExceptionScan", - "Scan for exceptions; core app, psp restart"); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 1); /* check failure of getting summary data */ UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetSummary), CFE_PSP_NO_EXCEPTION_DATA); CFE_ES_RunExceptionScan(0, NULL); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 2, "CFE_ES_RunExceptionScan", - "Scan for exceptions; fail to get context"); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 2); /* Test clearing the log with a bad size in the verify command * length call */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_CLEAR_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ClearERLogCmd", - "Packet length error"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test resetting and setting the max for the processor reset count */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ResetPRCountCmd), UT_TPID_CFE_ES_CMD_RESET_PR_COUNT_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESET_PR_COUNT_EID), "CFE_ES_ResetPRCountCmd", - "Set processor reset count to zero"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESET_PR_COUNT_EID); /* Test setting the maximum processor reset count */ ES_ResetUnitTest(); @@ -2942,8 +2730,7 @@ void TestTask(void) CmdBuf.SetMaxPRCountCmd.Payload.MaxPRCount = 3; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.SetMaxPRCountCmd), UT_TPID_CFE_ES_CMD_SET_MAX_PR_COUNT_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SET_MAX_PR_COUNT_EID), "CFE_ES_SetMaxPRCountCmd", - "Set maximum processor reset count"); + CFE_UtAssert_EVENTSENT(CFE_ES_SET_MAX_PR_COUNT_EID); /* Test failed deletion of specified CDS */ ES_ResetUnitTest(); @@ -2953,16 +2740,14 @@ void TestTask(void) strncpy(CmdBuf.DeleteCDSCmd.Payload.CdsName, "CFE_ES.CDS_NAME", sizeof(CmdBuf.DeleteCDSCmd.Payload.CdsName) - 1); CmdBuf.DeleteCDSCmd.Payload.CdsName[sizeof(CmdBuf.DeleteCDSCmd.Payload.CdsName) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_DELETE_ERR_EID), "CFE_ES_DeleteCDSCmd", - "Delete from CDS; error"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_DELETE_ERR_EID); /* Test failed deletion of specified critical table CDS */ /* NOTE - reuse command from previous test */ ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, true, NULL); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_DELETE_TBL_ERR_EID), "CFE_ES_DeleteCDSCmd", - "Delete from CDS; wrong type"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_DELETE_TBL_ERR_EID); /* Test successful deletion of a specified CDS */ ES_ResetUnitTest(); @@ -2971,16 +2756,14 @@ void TestTask(void) /* Set up the block to read what we need to from the CDS */ UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_DELETED_INFO_EID), "CFE_ES_DeleteCDSCmd", - "Delete from CDS; success"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_DELETED_INFO_EID); /* Test deletion of a specified CDS with the owning app being active */ ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, false, NULL); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_OWNER_ACTIVE_EID), "CFE_ES_DeleteCDSCmd", - "Delete from CDS; owner active"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_OWNER_ACTIVE_EID); /* Test deletion of a specified CDS with the name not found */ ES_ResetUnitTest(); @@ -2988,16 +2771,14 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_BAD", NULL, NULL); CFE_ES_CDSBlockRecordSetFree(UtCDSRegRecPtr); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_NAME_ERR_EID), "CFE_ES_DeleteCDSCmd", - "Delete from CDS; not found"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_NAME_ERR_EID); /* Test successful dump of CDS to file using the default dump file name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_REG_DUMP_INF_EID), "CFE_ES_DumpCDSRegistryCmd", - "Dump CDS; success (default dump file)"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_REG_DUMP_INF_EID); /* Test dumping of the CDS to a file with a bad file name */ ES_ResetUnitTest(); @@ -3005,8 +2786,7 @@ void TestTask(void) UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CREATING_CDS_DUMP_ERR_EID), "CFE_ES_DumpCDSRegistryCmd", - "Dump CDS; bad file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_CREATING_CDS_DUMP_ERR_EID); /* Test dumping of the CDS to a file with a bad FS write header */ ES_ResetUnitTest(); @@ -3014,8 +2794,7 @@ void TestTask(void) UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, -1); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_WRITE_CFE_HDR_ERR_EID), "CFE_ES_DumpCDSRegistryCmd", - "Dump CDS; write header"); + CFE_UtAssert_EVENTSENT(CFE_ES_WRITE_CFE_HDR_ERR_EID); /* Test dumping of the CDS to a file with an OS create failure */ ES_ResetUnitTest(); @@ -3023,8 +2802,7 @@ void TestTask(void) UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CREATING_CDS_DUMP_ERR_EID), "CFE_ES_DumpCDSRegistryCmd", - "Dump CDS; OS create"); + CFE_UtAssert_EVENTSENT(CFE_ES_CREATING_CDS_DUMP_ERR_EID); /* Test dumping of the CDS to a file with an OS write failure */ ES_ResetUnitTest(); @@ -3033,16 +2811,14 @@ void TestTask(void) ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, false, NULL); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_DUMP_ERR_EID), "CFE_ES_DumpCDSRegistryCmd", - "Dump CDS; OS write"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_DUMP_ERR_EID); /* Test telemetry pool statistics retrieval with an invalid handle */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.SendMemPoolStatsCmd), UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_INVALID_POOL_HANDLE_ERR_EID), "CFE_ES_SendMemPoolStatsCmd", - "Telemetry pool; bad handle"); + CFE_UtAssert_EVENTSENT(CFE_ES_INVALID_POOL_HANDLE_ERR_EID); /* Test successful telemetry pool statistics retrieval */ ES_ResetUnitTest(); @@ -3050,47 +2826,41 @@ void TestTask(void) CmdBuf.SendMemPoolStatsCmd.Payload.PoolHandle = CFE_ES_MemPoolRecordGetID(UtPoolRecPtr); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.SendMemPoolStatsCmd), UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TLM_POOL_STATS_INFO_EID), "CFE_ES_SendMemPoolStatsCmd", - "Telemetry pool; success"); + CFE_UtAssert_EVENTSENT(CFE_ES_TLM_POOL_STATS_INFO_EID); /* Test the command pipe message process with an invalid command */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_CMD_INVALID_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CC1_ERR_EID), "CFE_ES_TaskPipe", "Invalid ground command"); + CFE_UtAssert_EVENTSENT(CFE_ES_CC1_ERR_EID); /* Test sending a no-op command with an invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_NOOP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_NoopCmd", - "No-op; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a reset counters command with an invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESET_COUNTERS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ResetCountersCmd", - "Reset counters; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a cFE restart command with an invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESTART_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_RestartCmd", - "Restart cFE; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test cFE restart with a power on reset */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.RestartCmd.Payload.RestartType = CFE_PSP_RST_TYPE_POWERON; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartCmd), UT_TPID_CFE_ES_CMD_RESTART_CC); - UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_BOOT_ERR_EID), "CFE_ES_RestartCmd", - "Power on reset restart type"); + CFE_UtAssert_EVENTNOTSENT(CFE_ES_BOOT_ERR_EID); /* Test sending a start application command with an invalid command * length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_StartAppCmd", - "Start application command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test start application command with a processor restart on application * exception @@ -3108,80 +2878,70 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.Priority = 160; CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(CFE_PLATFORM_ES_DEFAULT_STACK_SIZE); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INF_EID), "CFE_ES_StartAppCmd", - "Processor restart on application exception"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_INF_EID); /* Test sending a stop application command with an invalid command * length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_STOP_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_StopAppCmd", - "Stop application command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a restart application command with an invalid command * length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESTART_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_RestartAppCmd", - "Restart application command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a reload application command with an invalid command * length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ReloadAppCmd", - "Reload application command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a write request for a single application with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_QUERY_ONE_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_QueryOneAppCmd", - "Query one application command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a write request for all applications with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_QueryAllAppCmd", - "Query all applications command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a write request for all tasks with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_QueryAllAppCmd", - "Query all tasks command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a request to clear the system log with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_CLEAR_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ClearSysLogCmd", - "Clear system log command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a request to overwrite the system log with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_OverwriteSysLogCmd", - "Overwrite system log command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a request to write the system log with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_WriteSysLogCmd", - "Write system log command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test successful overwriting of the system log using overwrite mode */ ES_ResetUnitTest(); @@ -3189,49 +2949,42 @@ void TestTask(void) CmdBuf.OverwriteSysLogCmd.Payload.Mode = CFE_ES_LogMode_OVERWRITE; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.OverwriteSysLogCmd), UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOGMODE_EID), "CFE_ES_OverWriteSysLogCmd", - "Overwrite system log received (overwrite mode)"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOGMODE_EID); /* Test sending a request to write the error log with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_WriteErrlogCmd", - "Write error log command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a request to reset the processor reset count with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESET_PR_COUNT_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ResetPRCountCmd", - "Reset processor reset count command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a request to set the maximum processor reset count with * an invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SET_MAX_PR_COUNT_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_SetMaxPRCountCmd", - "Set maximum processor reset count command; invalid " - "command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a request to delete the CDS with an invalid command * length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_DeleteCDSCmd", - "Delete CDS command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a telemetry pool statistics retrieval command with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_DeleteCDSCmd", - "Telemetry pool command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test successful dump of CDS to file using a specified dump file name */ ES_ResetUnitTest(); @@ -3243,8 +2996,7 @@ void TestTask(void) CmdBuf.DumpCDSRegistryCmd.Payload.DumpFilename[sizeof(CmdBuf.DumpCDSRegistryCmd.Payload.DumpFilename) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_REG_DUMP_INF_EID), "CFE_ES_DumpCDSRegistryCmd", - "Dump CDS; success (dump file specified)"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_REG_DUMP_INF_EID); } /* end TestTask */ void TestPerf(void) @@ -3273,8 +3025,7 @@ void TestPerf(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); Perf->MetaData.State = CFE_ES_PERF_MAX_STATES; CFE_ES_SetupPerfVariables(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, Perf->MetaData.State == CFE_ES_PERF_IDLE, "CFE_ES_SetupPerfVariables", - "Idle data collection"); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_IDLE); /* Test successful performance data collection start in START * trigger mode @@ -3283,8 +3034,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_START; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", - "Collect performance data; mode START"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_EID); /* Test successful performance data collection start in CENTER * trigger mode @@ -3293,8 +3043,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_CENTER; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", - "Collect performance data; mode CENTER"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_EID); /* Test successful performance data collection start in END * trigger mode @@ -3303,8 +3052,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_END; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", - "Collect performance data; mode END"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_EID); /* Test performance data collection start with an invalid trigger mode * (too high) @@ -3313,8 +3061,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = (CFE_ES_PERF_TRIGGER_END + 1); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID), "CFE_ES_StartPerfDataCmd", - "Trigger mode out of range (high)"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID); /* Test performance data collection start with an invalid trigger mode * (too low) @@ -3323,8 +3070,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = 0xffffffff; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID), "CFE_ES_StartPerfDataCmd", - "Trigger mode out of range (low)"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID); /* Test performance data collection start with a file write in progress */ ES_ResetUnitTest(); @@ -3334,8 +3080,7 @@ void TestPerf(void) CFE_ES_Global.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_INIT; CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_START; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_ERR_EID), "CFE_ES_StartPerfDataCmd", - "Cannot collect performance data; write in progress"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_ERR_EID); /* Test performance data collection by sending another valid * start command @@ -3345,16 +3090,14 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_START; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", - "Start collecting performance data"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_EID); /* Test successful performance data collection stop */ ES_ResetUnitTest(); memset(&CFE_ES_Global.BackgroundPerfDumpState, 0, sizeof(CFE_ES_Global.BackgroundPerfDumpState)); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_EID), "CFE_ES_StopPerfDataCmd", - "Stop collecting performance data"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STOPCMD_EID); /* Test performance data collection stop with a file name validation issue */ ES_ResetUnitTest(); @@ -3362,8 +3105,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_ParseInputFileNameEx), CFE_FS_INVALID_PATH); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_LOG_ERR_EID), "CFE_ES_StopPerfDataCmd", - "Stop performance data command bad file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_LOG_ERR_EID); /* Test successful performance data collection stop with a non-default file name */ @@ -3374,15 +3116,13 @@ void TestPerf(void) strncpy(CmdBuf.PerfStopCmd.Payload.DataFileName, "filename", sizeof(CmdBuf.PerfStopCmd.Payload.DataFileName) - 1); CmdBuf.PerfStopCmd.Payload.DataFileName[sizeof(CmdBuf.PerfStopCmd.Payload.DataFileName) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_EID), "CFE_ES_StopPerfDataCmd", - "Stop collecting performance data (non-default file name)"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STOPCMD_EID); /* Test performance data collection stop with a file write in progress */ ES_ResetUnitTest(); CFE_ES_Global.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_INIT; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_ERR2_EID), "CFE_ES_StopPerfDataCmd", - "Stop performance data command ignored"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STOPCMD_ERR2_EID); /* Test performance filter mask command with out of range filter mask value */ @@ -3391,8 +3131,7 @@ void TestPerf(void) CmdBuf.PerfSetFilterMaskCmd.Payload.FilterMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetFilterMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_FILTMSKERR_EID), "CFE_ES_SetPerfFilterMaskCmd", - "Performance filter mask command error; index out of range"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_FILTMSKERR_EID); /* Test successful performance filter mask command */ ES_ResetUnitTest(); @@ -3400,8 +3139,7 @@ void TestPerf(void) CmdBuf.PerfSetFilterMaskCmd.Payload.FilterMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK / 2; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetFilterMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_FILTMSKCMD_EID), "CFE_ES_SetPerfFilterMaskCmd", - "Set performance filter mask command received"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_FILTMSKCMD_EID); /* Test successful performance filter mask command with minimum filter mask value */ @@ -3410,8 +3148,7 @@ void TestPerf(void) CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = 0; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetTrigMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKCMD_EID), "CFE_ES_SetPerfTriggerMaskCmd", - "Set performance trigger mask command received; minimum index"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_TRIGMSKCMD_EID); /* Test successful performance filter mask command with maximum filter * mask value @@ -3421,8 +3158,7 @@ void TestPerf(void) CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK - 1; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetTrigMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKCMD_EID), "CFE_ES_SetPerfTriggerMaskCmd", - "Set performance trigger mask command received; maximum index"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_TRIGMSKCMD_EID); /* Test successful performance filter mask command with a greater than the * maximum filter mask value @@ -3432,8 +3168,7 @@ void TestPerf(void) CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK + 1; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetTrigMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKERR_EID), "CFE_ES_SetPerfTriggerMaskCmd", - "Performance trigger mask command error; index out of range"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_TRIGMSKERR_EID); /* Test successful addition of a new entry to the performance log */ ES_ResetUnitTest(); @@ -3442,8 +3177,7 @@ void TestPerf(void) Perf->MetaData.InvalidMarkerReported = false; Perf->MetaData.DataEnd = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE + 1; CFE_ES_PerfLogAdd(CFE_MISSION_ES_PERF_MAX_IDS, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.InvalidMarkerReported == true, "CFE_ES_PerfLogAdd", - "Invalid performance marker"); + UtAssert_UINT32_EQ(Perf->MetaData.InvalidMarkerReported, true); /* Test addition of a new entry to the performance log with START * trigger mode @@ -3454,9 +3188,8 @@ void TestPerf(void) Perf->MetaData.DataCount = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE + 1; Perf->MetaData.TriggerMask[0] = 0xFFFF; CFE_ES_PerfLogAdd(1, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.Mode == CFE_ES_PERF_TRIGGER_START && Perf->MetaData.State == CFE_ES_PERF_IDLE, - "CFE_ES_PerfLogAdd", "Triggered; START"); + UtAssert_UINT32_EQ(Perf->MetaData.Mode, CFE_ES_PERF_TRIGGER_START); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_IDLE); /* Test addition of a new entry to the performance log with CENTER * trigger mode @@ -3466,9 +3199,8 @@ void TestPerf(void) Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_CENTER; Perf->MetaData.TriggerCount = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE / 2 + 1; CFE_ES_PerfLogAdd(1, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.Mode == CFE_ES_PERF_TRIGGER_CENTER && Perf->MetaData.State == CFE_ES_PERF_IDLE, - "CFE_ES_PerfLogAdd", "Triggered; CENTER"); + UtAssert_UINT32_EQ(Perf->MetaData.Mode, CFE_ES_PERF_TRIGGER_CENTER); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_IDLE); /* Test addition of a new entry to the performance log with END * trigger mode @@ -3477,9 +3209,8 @@ void TestPerf(void) Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_END; CFE_ES_PerfLogAdd(1, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.Mode == CFE_ES_PERF_TRIGGER_END && Perf->MetaData.State == CFE_ES_PERF_IDLE, - "CFE_ES_PerfLogAdd", "Triggered; END"); + UtAssert_UINT32_EQ(Perf->MetaData.Mode, CFE_ES_PERF_TRIGGER_END); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_IDLE); /* Test addition of a new entry to the performance log with an invalid * marker after an invalid marker has already been reported @@ -3488,8 +3219,7 @@ void TestPerf(void) Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; Perf->MetaData.InvalidMarkerReported = 2; CFE_ES_PerfLogAdd(CFE_MISSION_ES_PERF_MAX_IDS + 1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.InvalidMarkerReported == 2, "CFE_ES_PerfLogAdd", - "Invalid marker after previous invalid marker"); + UtAssert_UINT32_EQ(Perf->MetaData.InvalidMarkerReported, 2); /* Test addition of a new entry to the performance log with a marker that * is not in the filter mask @@ -3499,7 +3229,7 @@ void TestPerf(void) Perf->MetaData.FilterMask[0] = 0x0; Perf->MetaData.DataEnd = 0; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.DataEnd == 0, "CFE_ES_PerfLogAdd", "Marker not in filter mask"); + UtAssert_UINT32_EQ(Perf->MetaData.DataEnd, 0); /* Test addition of a new entry to the performance log with the data count * below the maximum allowed @@ -3509,7 +3239,7 @@ void TestPerf(void) Perf->MetaData.DataCount = 0; Perf->MetaData.FilterMask[0] = 0xffff; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.DataCount == 1, "CFE_ES_PerfLogAdd", "Data count below maximum"); + UtAssert_UINT32_EQ(Perf->MetaData.DataCount, 1); /* Test addition of a new entry to the performance log with a marker that * is not in the trigger mask @@ -3518,8 +3248,7 @@ void TestPerf(void) Perf->MetaData.State = CFE_ES_PERF_WAITING_FOR_TRIGGER; Perf->MetaData.TriggerMask[0] = 0x0; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.State != CFE_ES_PERF_TRIGGERED, "CFE_ES_PerfLogAdd", - "Marker not in trigger mask"); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_WAITING_FOR_TRIGGER); /* Test addition of a new entry to the performance log with a start * trigger mode and the trigger count is less the buffer size @@ -3530,8 +3259,7 @@ void TestPerf(void) Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_START; Perf->MetaData.TriggerMask[0] = 0xffff; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.TriggerCount == 1, "CFE_ES_PerfLogAdd", - "Start trigger mode; trigger count less than the buffer size"); + UtAssert_UINT32_EQ(Perf->MetaData.TriggerCount, 1); /* Test addition of a new entry to the performance log with a center * trigger mode and the trigger count is less than half the buffer size @@ -3541,9 +3269,7 @@ void TestPerf(void) Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_CENTER; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.State != CFE_ES_PERF_IDLE, "CFE_ES_PerfLogAdd", - "Center trigger mode; trigger count less than half the " - "buffer size"); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_TRIGGERED); /* Test addition of a new entry to the performance log with an invalid * trigger mode @@ -3553,32 +3279,27 @@ void TestPerf(void) Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; Perf->MetaData.Mode = -1; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.State != CFE_ES_PERF_IDLE, "CFE_ES_PerfLogAdd", - "Invalid trigger mode"); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_TRIGGERED); /* Test performance data collection start with an invalid message length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", - "Invalid message length"); + CFE_UtAssert_EVENTNOTSENT(CFE_ES_PERF_STARTCMD_EID); /* Test performance data collection stop with an invalid message length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_EID), "CFE_ES_StopPerfDataCmd", - "Invalid message length"); + CFE_UtAssert_EVENTNOTSENT(CFE_ES_PERF_STOPCMD_EID); /* Test performance data filer mask with an invalid message length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC); - UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_PERF_FILTMSKCMD_EID), "CFE_ES_SetPerfFilterMaskCmd", - "Invalid message length"); + CFE_UtAssert_EVENTNOTSENT(CFE_ES_PERF_FILTMSKCMD_EID); /* Test performance data trigger mask with an invalid message length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); - UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKCMD_EID), "CFE_ES_SetPerfTriggerMaskCmd", - "Invalid message length"); + CFE_UtAssert_EVENTNOTSENT(CFE_ES_PERF_TRIGMSKCMD_EID); /* Test perf log dump state machine */ /* Nominal call 1 - should go through up to the DELAY state */ @@ -3586,17 +3307,11 @@ void TestPerf(void) memset(&CFE_ES_Global.BackgroundPerfDumpState, 0, sizeof(CFE_ES_Global.BackgroundPerfDumpState)); CFE_ES_Global.BackgroundPerfDumpState.PendingState = CFE_ES_PerfDumpState_INIT; CFE_ES_RunPerfLogDump(1000, &CFE_ES_Global.BackgroundPerfDumpState); - UtAssert_True(CFE_ES_Global.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_DELAY, - "CFE_ES_RunPerfLogDump - CFE_ES_Global.BackgroundPerfDumpState.CurrentState (%d) == DELAY (%d)", - (int)CFE_ES_Global.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_DELAY); - UtAssert_True(UT_GetStubCount(UT_KEY(OS_OpenCreate)) == 1, "CFE_ES_RunPerfLogDump - OS_OpenCreate() called"); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.CurrentState, CFE_ES_PerfDumpState_DELAY); /* Nominal call 2 - should go through up to the remainder of states, back to IDLE */ CFE_ES_RunPerfLogDump(1000, &CFE_ES_Global.BackgroundPerfDumpState); - UtAssert_True(CFE_ES_Global.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_IDLE, - "CFE_ES_RunPerfLogDump - CFE_ES_Global.BackgroundPerfDumpState.CurrentState (%d) == IDLE (%d)", - (int)CFE_ES_Global.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_IDLE); - UtAssert_True(UT_GetStubCount(UT_KEY(OS_close)) == 1, "CFE_ES_RunPerfLogDump - OS_close() called"); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.CurrentState, CFE_ES_PerfDumpState_IDLE); /* Test a failure to open the output file */ /* This should go immediately back to idle, and generate CFE_ES_PERF_LOG_ERR_EID */ @@ -3605,12 +3320,8 @@ void TestPerf(void) CFE_ES_Global.BackgroundPerfDumpState.PendingState = CFE_ES_PerfDumpState_INIT; UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), -10); CFE_ES_RunPerfLogDump(1000, &CFE_ES_Global.BackgroundPerfDumpState); - UtAssert_True(CFE_ES_Global.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_IDLE, - "CFE_ES_RunPerfLogDump - OS create fail, CFE_ES_Global.BackgroundPerfDumpState.CurrentState (%d) " - "== IDLE (%d)", - (int)CFE_ES_Global.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_IDLE); - UtAssert_True(UT_EventIsInHistory(CFE_ES_PERF_LOG_ERR_EID), - "CFE_ES_RunPerfLogDump - OS create fail, generated CFE_ES_PERF_LOG_ERR_EID"); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.CurrentState, CFE_ES_PerfDumpState_IDLE); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_LOG_ERR_EID); /* Test a failure to write to the output file */ ES_ResetUnitTest(); @@ -3618,19 +3329,12 @@ void TestPerf(void) UT_SetDefaultReturnValue(UT_KEY(OS_write), -10); CFE_ES_Global.BackgroundPerfDumpState.PendingState = CFE_ES_PerfDumpState_INIT; CFE_ES_RunPerfLogDump(1000, &CFE_ES_Global.BackgroundPerfDumpState); - UtAssert_True(CFE_ES_Global.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_DELAY, - "CFE_ES_RunPerfLogDump - OS_write fail, CFE_ES_Global.BackgroundPerfDumpState.CurrentState (%d) == " - "DELAY (%d)", - (int)CFE_ES_Global.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_DELAY); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.CurrentState, CFE_ES_PerfDumpState_DELAY); /* This will trigger the OS_write() failure, which should go through up to the remainder of states, back to IDLE */ CFE_ES_RunPerfLogDump(1000, &CFE_ES_Global.BackgroundPerfDumpState); - UtAssert_True( - CFE_ES_Global.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_IDLE, - "CFE_ES_RunPerfLogDump - OS_write fail, CFE_ES_Global.BackgroundPerfDumpState.CurrentState (%d) == IDLE (%d)", - (int)CFE_ES_Global.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_IDLE); - UtAssert_True(UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), - "CFE_ES_RunPerfLogDump - OS_write fail, generated CFE_ES_FILEWRITE_ERR_EID"); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.CurrentState, CFE_ES_PerfDumpState_IDLE); + CFE_UtAssert_EVENTSENT(CFE_ES_FILEWRITE_ERR_EID); /* Test the ability of the file writer to handle the "wrap around" from the end of * the perflog buffer back to the beginning. Just need to set up the metadata @@ -3645,13 +3349,9 @@ void TestPerf(void) CFE_ES_Global.BackgroundPerfDumpState.StateCounter = 4; CFE_ES_RunPerfLogDump(1000, &CFE_ES_Global.BackgroundPerfDumpState); /* check that the wraparound occurred */ - UtAssert_True(CFE_ES_Global.BackgroundPerfDumpState.DataPos == 2, - "CFE_ES_RunPerfLogDump - wraparound, DataPos (%u) == 2", - (unsigned int)CFE_ES_Global.BackgroundPerfDumpState.DataPos); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.DataPos, 2); /* should have written 4 entries to the log */ - UtAssert_True(CFE_ES_Global.BackgroundPerfDumpState.FileSize == sizeof(CFE_ES_PerfDataEntry_t) * 4, - "CFE_ES_RunPerfLogDump - wraparound, FileSize (%u) == sizeof(CFE_ES_PerfDataEntry_t) * 4", - (unsigned int)CFE_ES_Global.BackgroundPerfDumpState.FileSize); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.FileSize, sizeof(CFE_ES_PerfDataEntry_t) * 4); /* Confirm that the "CFE_ES_GetPerfLogDumpRemaining" function works. * This requires that the state is not idle, in order to get nonzero results. @@ -3663,10 +3363,10 @@ void TestPerf(void) CFE_ES_Global.BackgroundPerfDumpState.StateCounter = 10; Perf->MetaData.DataCount = 100; /* in states other than WRITE_PERF_ENTRIES, it should report the full size of the log */ - UtAssert_True(CFE_ES_GetPerfLogDumpRemaining() == 100, " CFE_ES_GetPerfLogDumpRemaining - Setup Phase"); + UtAssert_UINT32_EQ(CFE_ES_GetPerfLogDumpRemaining(), 100); /* in WRITE_PERF_ENTRIES, it should report the StateCounter */ CFE_ES_Global.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES; - UtAssert_True(CFE_ES_GetPerfLogDumpRemaining() == 10, " CFE_ES_GetPerfLogDumpRemaining - Active Phase"); + UtAssert_UINT32_EQ(CFE_ES_GetPerfLogDumpRemaining(), 10); } void TestAPI(void) @@ -3674,10 +3374,8 @@ void TestAPI(void) osal_id_t TestObjId; char AppName[OS_MAX_API_NAME + 12]; uint32 StackBuf[8]; - int32 Return; uint8 Data[12]; uint32 ResetType; - uint32 * ResetTypePtr; CFE_ES_AppId_t AppId; CFE_ES_TaskId_t TaskId; uint32 RunStatus; @@ -3696,77 +3394,59 @@ void TestAPI(void) CFE_ES_ResetCFE(ResetType); CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount = CFE_ES_Global.ResetDataPtr->ResetVars.MaxProcessorResetCount; - UT_Report(__FILE__, __LINE__, - CFE_ES_ResetCFE(ResetType) == CFE_ES_NOT_IMPLEMENTED && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_MAX_PROC_RESETS]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_PROC_RESET_COMMANDED]), - "CFE_ES_ResetCFE", "Processor reset"); + UtAssert_INT32_EQ(CFE_ES_ResetCFE(ResetType), CFE_ES_NOT_IMPLEMENTED); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_POR_MAX_PROC_RESETS]); /* Test getting the reset type using a valid pointer and a null pointer */ ES_ResetUnitTest(); - Return = CFE_ES_GetResetType(&ResetType); - ResetTypePtr = NULL; - CFE_ES_GetResetType(ResetTypePtr); - UT_Report(__FILE__, __LINE__, Return == CFE_PSP_RST_TYPE_PROCESSOR && ResetTypePtr == NULL, "CFE_ES_GetResetType", - "Get reset type successful"); + UtAssert_INT32_EQ(CFE_ES_GetResetType(&ResetType), CFE_PSP_RST_TYPE_PROCESSOR); + UtAssert_INT32_EQ(CFE_ES_GetResetType(NULL), CFE_PSP_RST_TYPE_PROCESSOR); /* Test resetting the cFE with a power on reset */ ES_ResetUnitTest(); - ResetType = CFE_PSP_RST_TYPE_POWERON; - UT_Report(__FILE__, __LINE__, - CFE_ES_ResetCFE(ResetType) == CFE_ES_NOT_IMPLEMENTED && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_COMMANDED]), - "CFE_ES_ResetCFE", "Power on reset"); + UtAssert_INT32_EQ(CFE_ES_ResetCFE(CFE_PSP_RST_TYPE_POWERON), CFE_ES_NOT_IMPLEMENTED); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_POR_COMMANDED]); /* Test resetting the cFE with an invalid argument */ ES_ResetUnitTest(); - ResetType = CFE_PSP_RST_TYPE_POWERON + 3; - UT_Report(__FILE__, __LINE__, CFE_ES_ResetCFE(ResetType) == CFE_ES_BAD_ARGUMENT, "CFE_ES_ResetCFE", - "Bad reset type"); + UtAssert_INT32_EQ(CFE_ES_ResetCFE(CFE_PSP_RST_TYPE_POWERON + 3), CFE_ES_BAD_ARGUMENT); /* Test restarting an app that doesn't exist */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_APPID_C( ES_UT_MakeAppIdForIndex(CFE_PLATFORM_ES_MAX_APPLICATIONS - 1)); /* Should be within range, but not used */ - UT_Report(__FILE__, __LINE__, CFE_ES_RestartApp(AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_RestartApp", - "Bad application ID"); + UtAssert_INT32_EQ(CFE_ES_RestartApp(AppId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test restarting an app with an ID out of range (high) */ ES_ResetUnitTest(); AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(99999)); - UT_Report(__FILE__, __LINE__, CFE_ES_RestartApp(AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_RestartApp", - "Application ID too large"); + UtAssert_INT32_EQ(CFE_ES_RestartApp(AppId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test reloading an app that doesn't exist */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_ReloadApp(AppId, "filename") == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_ReloadApp", "Bad application ID"); + UtAssert_INT32_EQ(CFE_ES_ReloadApp(AppId, "filename"), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test deleting an app that doesn't exist */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteApp(AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_DeleteApp", - "Bad application ID"); + UtAssert_INT32_EQ(CFE_ES_DeleteApp(AppId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test exiting an app with an init error */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_INIT]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_MAX_PROC_RESETS]), - "CFE_ES_ExitApp", "Application initialization error"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CORE_INIT]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_POR_MAX_PROC_RESETS]); /* Test exiting an app with a runtime error */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_RUNTIME]), "CFE_ES_ExitApp", - "Application runtime error"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CORE_RUNTIME]); /* Test exiting an app with an exit error */ /* Note - this exit code of 1000 is invalid, which causes @@ -3776,11 +3456,8 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_STOPPED, "UT", &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; CFE_ES_ExitApp(1000); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_APP_EXIT]), "CFE_ES_ExitApp", - "Application exit error"); - UtAssert_True(UtAppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_ERROR, - "CFE_ES_ExitApp - AppControlRequest (%u) == CFE_ES_RunStatus_APP_ERROR (%u)", - (unsigned int)UtAppRecPtr->ControlReq.AppControlRequest, (unsigned int)CFE_ES_RunStatus_APP_ERROR); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CORE_APP_EXIT]); + UtAssert_UINT32_EQ(UtAppRecPtr->ControlReq.AppControlRequest, CFE_ES_RunStatus_APP_ERROR); #if 0 /* Can't cover this path since it contains a while(1) (i.e., @@ -3800,22 +3477,21 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == true, "CFE_ES_RunLoop", "Request to run application"); + CFE_UtAssert_TRUE(CFE_ES_RunLoop(&RunStatus)); /* Test successful run loop app stop request */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", - "Request to stop running application"); + CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); /* Test successful run loop app exit request */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_EXIT; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", "Request to exit application"); + CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); /* Test run loop with bad app ID */ ES_ResetUnitTest(); @@ -3823,133 +3499,119 @@ void TestAPI(void) RunStatus = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; CFE_ES_TaskRecordSetFree(UtTaskRecPtr); /* make it so task ID is bad */ - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", "Bad internal application ID"); + CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); /* Test run loop with an invalid run status */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); RunStatus = 1000; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", "Invalid run status"); + CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); /* Test run loop with a NULL run status */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(NULL), "CFE_ES_RunLoop", "Nominal, NULL output pointer"); + CFE_UtAssert_TRUE(CFE_ES_RunLoop(NULL)); /* Test run loop with startup sync code */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_LATE_INIT, NULL, &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - UT_Report(__FILE__, __LINE__, - CFE_ES_RunLoop(&RunStatus) == true && UtAppRecPtr->AppState == CFE_ES_AppState_RUNNING, "CFE_ES_RunLoop", - "Status change from initializing to run"); + CFE_UtAssert_TRUE(CFE_ES_RunLoop(&RunStatus)); + UtAssert_UINT32_EQ(UtAppRecPtr->AppState, CFE_ES_AppState_RUNNING); /* Test getting the cFE application and task ID by context */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppID(&AppId) == CFE_SUCCESS, "CFE_ES_GetAppID", - "Get application ID by context successful"); - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskID(&TaskId) == CFE_SUCCESS, "CFE_ES_GetTaskID", - "Get task ID by context successful"); + CFE_UtAssert_SUCCESS(CFE_ES_GetAppID(&AppId)); + CFE_UtAssert_SUCCESS(CFE_ES_GetTaskID(&TaskId)); /* Test getting the app name with a bad app ID */ ES_ResetUnitTest(); AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(99999)); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetAppName", "Get application name by ID; bad application ID"); + UtAssert_INT32_EQ(CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test getting the app name with that app ID out of range */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(99999)); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetAppName", "Get application name by ID; ID out of range"); + UtAssert_INT32_EQ(CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test successfully getting the app name using the app ID */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)) == CFE_SUCCESS, - "CFE_ES_GetAppName", "Get application name by ID successful"); + CFE_UtAssert_SUCCESS(CFE_ES_GetAppName(AppName, AppId, sizeof(AppName))); /* Test getting task information using the task ID - NULL buffer */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(NULL, TaskId) == CFE_ES_BAD_ARGUMENT, "CFE_ES_GetTaskInfo", - "Get task info by ID; NULL buffer"); + UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(NULL, TaskId), CFE_ES_BAD_ARGUMENT); /* Test getting task information using the task ID - bad task ID */ UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdToArrayIndex), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetTaskInfo", "Get task info by ID; bad task ID"); + UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, TaskId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test getting task information using the task ID */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UtAppRecPtr->AppState = CFE_ES_AppState_RUNNING; - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_SUCCESS, "CFE_ES_GetTaskInfo", - "Get task info by ID successful"); + CFE_UtAssert_SUCCESS(CFE_ES_GetTaskInfo(&TaskInfo, TaskId)); /* Test getting task information using the task ID with parent inactive */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); CFE_ES_AppRecordSetFree(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetTaskInfo", "Get task info by ID; parent application not active"); + UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, TaskId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test getting task information using the task ID with task inactive */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", NULL, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); CFE_ES_TaskRecordSetFree(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetTaskInfo", "Get task info by ID; task not active"); + UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, TaskId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test getting task information using the task ID with invalid task ID */ ES_ResetUnitTest(); TaskId = CFE_ES_TASKID_UNDEFINED; - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetTaskInfo", "Get task info by ID; invalid task ID"); + UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, TaskId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test creating a child task with a bad app ID */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_ChildTaskCreate", - "Bad application ID"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0), + CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test creating a child task with an OS task create failure */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); - Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, "CFE_ES_ChildTaskCreate", - "OS task create failed"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0), + CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Test creating a child task with a null task ID */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(NULL, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_ChildTaskCreate", "Task ID null"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(NULL, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0), + CFE_ES_BAD_ARGUMENT); /* Test creating a child task with a null task name */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(&TaskId, NULL, TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_ChildTaskCreate", "Task name null"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, NULL, TestAPI, StackBuf, sizeof(StackBuf), 400, 0), + CFE_ES_BAD_ARGUMENT); /* Test creating a child task with a null task ID and name */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(NULL, NULL, TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_ChildTaskCreate", "Task name and ID null"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(NULL, NULL, TestAPI, StackBuf, sizeof(StackBuf), 400, 0), + CFE_ES_BAD_ARGUMENT); /* Test creating a child task with a null function pointer */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", NULL, StackBuf, sizeof(StackBuf), 2, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_ChildTaskCreate", "Function pointer null"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, "TaskName", NULL, StackBuf, sizeof(StackBuf), 2, 0), + CFE_ES_BAD_ARGUMENT); /* Test creating a child task within a child task */ ES_ResetUnitTest(); @@ -3957,15 +3619,13 @@ void TestAPI(void) ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, &UtTaskRecPtr); TestObjId = CFE_ES_TaskId_ToOSAL(CFE_ES_TaskRecordGetID(UtTaskRecPtr)); UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId), OS_ObjectIdToInteger(TestObjId)); /* Set context to that of child */ - Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_ERR_CHILD_TASK_CREATE, "CFE_ES_CreateChildTask", - "Cannot call from a child task"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0), + CFE_ES_ERR_CHILD_TASK_CREATE); /* Test successfully creating a child task */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_SUCCESS, "CFE_ES_CreateChildTask", "Create child task successful"); + CFE_UtAssert_SUCCESS(CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0)); /* Test common entry point */ ES_ResetUnitTest(); @@ -3991,13 +3651,11 @@ void TestAPI(void) ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", NULL, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) == CFE_ES_ERR_CHILD_TASK_DELETE_MAIN_TASK, - "CFE_ES_DeleteChildTask", "Task ID belongs to a main task"); + UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_ES_ERR_CHILD_TASK_DELETE_MAIN_TASK); /* Test deleting a child task with an invalid task ID */ UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdToArrayIndex), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_DeleteChildTask", "Task ID invalid"); + UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test successfully deleting a child task */ ES_ResetUnitTest(); @@ -4005,16 +3663,11 @@ void TestAPI(void) ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, &UtTaskRecPtr); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); /* the app ID */ TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); /* the child task ID */ - Return = CFE_ES_GetAppInfo(&AppInfo, AppId); - UtAssert_True(Return == CFE_SUCCESS, "CFE_ES_GetAppInfo() return=%x", (unsigned int)Return); - UtAssert_True(AppInfo.NumOfChildTasks == 1, "AppInfo.NumOfChildTaskss == %u", - (unsigned int)AppInfo.NumOfChildTasks); - Return = CFE_ES_DeleteChildTask(TaskId); - UtAssert_True(Return == CFE_SUCCESS, "DeleteChildResult() return=%x", (unsigned int)Return); - Return = CFE_ES_GetAppInfo(&AppInfo, AppId); - UtAssert_True(Return == CFE_SUCCESS, "CFE_ES_GetAppInfo() return=%x", (unsigned int)Return); - UtAssert_True(AppInfo.NumOfChildTasks == 0, "AppInfo.NumOfChildTaskss == %u", - (unsigned int)AppInfo.NumOfChildTasks); + CFE_UtAssert_SUCCESS(CFE_ES_GetAppInfo(&AppInfo, AppId)); + UtAssert_UINT32_EQ(AppInfo.NumOfChildTasks, 1); + CFE_UtAssert_SUCCESS(CFE_ES_DeleteChildTask(TaskId)); + CFE_UtAssert_SUCCESS(CFE_ES_GetAppInfo(&AppInfo, AppId)); + UtAssert_UINT32_EQ(AppInfo.NumOfChildTasks, 0); /* Test deleting a child task with an OS task delete failure */ ES_ResetUnitTest(); @@ -4023,14 +3676,12 @@ void TestAPI(void) AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); /* the app ID */ TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); /* the child task ID */ UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) <= 0, "CFE_ES_DeleteChildTask", - "OS task delete failure"); + UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_ES_ERR_CHILD_TASK_DELETE); /* Test deleting a child task with the task ID out of range */ ES_ResetUnitTest(); TaskId = CFE_ES_TASKID_UNDEFINED; - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_DeleteChildTask", "Task ID too large"); + UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test successfully exiting a child task */ ES_ResetUnitTest(); @@ -4039,22 +3690,19 @@ void TestAPI(void) TestObjId = CFE_ES_TaskId_ToOSAL(CFE_ES_TaskRecordGetID(UtTaskRecPtr)); UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId), OS_ObjectIdToInteger(TestObjId)); /* Set context to that of child */ CFE_ES_ExitChildTask(); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(OS_TaskExit)) == 1, "CFE_ES_ExitChildTask", - "Exit child task successful"); + UtAssert_STUB_COUNT(OS_TaskExit, 1); /* Test exiting a child task within an app main task */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, &UtTaskRecPtr); CFE_ES_ExitChildTask(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_CALL_APP_MAIN]), - "CFE_ES_ExitChildTask", "Cannot call from a cFE application main task"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CANNOT_CALL_APP_MAIN]); /* Test exiting a child task with an error retrieving the app ID */ ES_ResetUnitTest(); CFE_ES_ExitChildTask(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_TASKEXIT_BAD_CONTEXT]), - "CFE_ES_ExitChildTask", "Invalid context"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_TASKEXIT_BAD_CONTEXT]); /* Test successfully adding a time-stamped message to the system log that * must be truncated @@ -4063,9 +3711,8 @@ void TestAPI(void) CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE - CFE_TIME_PRINTED_STRING_SIZE - 4; CFE_ES_Global.ResetDataPtr->SystemLogEndIdx = CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx; CFE_ES_Global.ResetDataPtr->SystemLogMode = CFE_ES_LogMode_DISCARD; - UT_Report(__FILE__, __LINE__, - CFE_ES_SysLogWrite_Unsync("SysLogText This message should be truncated") == CFE_ES_ERR_SYS_LOG_TRUNCATED, - "CFE_ES_SysLogWrite_Internal", "Add message to log that must be truncated"); + UtAssert_INT32_EQ(CFE_ES_SysLogWrite_Unsync("SysLogText This message should be truncated"), + CFE_ES_ERR_SYS_LOG_TRUNCATED); /* Reset the system log index to prevent an overflow in later tests */ CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx = 0; @@ -4076,13 +3723,11 @@ void TestAPI(void) */ memset(Data, 1, sizeof(Data)); ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_8) == 0, - "CFE_ES_CalculateCRC", "*Not implemented* CRC-8 algorithm"); + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_8), 0); /* Test calculating a CRC on a range of memory using CRC type 16 */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_16) == 2688, - "CFE_ES_CalculateCRC", "CRC-16 algorithm - memory read successful"); + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_16), 2688); /* * CRC memory read failure test case removed in #322 - @@ -4094,30 +3739,26 @@ void TestAPI(void) * NOTE: This capability is not currently implemented in cFE */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_32) == 0, - "CFE_ES_CalculateCRC", "*Not implemented* CRC-32 algorithm"); + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_32), 0); /* Test calculating a CRC on a range of memory using an invalid CRC type */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CalculateCRC(&Data, 12, 345353, -1) == 0, "CFE_ES_CalculateCRC", - "Invalid CRC type"); + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(&Data, 12, 345353, -1), 0); /* Test shared mutex take with a take error */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, -1); CFE_ES_LockSharedData(__func__, 12345); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MUTEX_TAKE]), "CFE_ES_LockSharedData", - "Mutex take error"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MUTEX_TAKE]); /* Test shared mutex release with a release error */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); UT_SetDeferredRetcode(UT_KEY(OS_MutSemGive), 1, -1); CFE_ES_UnlockSharedData(__func__, 98765); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MUTEX_GIVE]), "CFE_ES_UnlockSharedData", - "Mutex release error"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MUTEX_GIVE]); /* Test waiting for apps to initialize before continuing; transition from * initializing to running @@ -4126,8 +3767,7 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_EARLY_INIT, "UT", &UtAppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_OPERATIONAL; CFE_ES_WaitForStartupSync(0); - UT_Report(__FILE__, __LINE__, UtAppRecPtr->AppState == CFE_ES_AppState_RUNNING, "CFE_ES_WaitForStartupSync", - "Transition from initializing to running"); + UtAssert_INT32_EQ(UtAppRecPtr->AppState, CFE_ES_AppState_RUNNING); /* Test waiting for apps to initialize before continuing with the semaphore * already released @@ -4135,24 +3775,22 @@ void TestAPI(void) ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; - CFE_ES_WaitForStartupSync(99); /* Note - CFE_ES_WaitForStartupSync() returns void, nothing to check for * here. This is for code coverage */ - UT_Report(__FILE__, __LINE__, 1, "CFE_ES_WaitForStartupSync", "System state core ready"); + CFE_UtAssert_VOIDCALL(CFE_ES_WaitForStartupSync(99)); /* Test waiting for apps to initialize as an external app */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_EARLY_INIT, "UT", &UtAppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; - CFE_ES_WaitForStartupSync(99); /* Note - CFE_ES_WaitForStartupSync() returns void, nothing to check for * here. This is for code coverage */ - UT_Report(__FILE__, __LINE__, 1, "CFE_ES_WaitForStartupSync", "System state operational"); + CFE_UtAssert_VOIDCALL(CFE_ES_WaitForStartupSync(99)); /* Test adding a time-stamped message to the system log using an invalid * log mode @@ -4168,8 +3806,7 @@ void TestAPI(void) CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE; CFE_ES_Global.ResetDataPtr->SystemLogEndIdx = CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx; CFE_ES_Global.ResetDataPtr->SystemLogMode = CFE_ES_LogMode_DISCARD; - UT_Report(__FILE__, __LINE__, CFE_ES_WriteToSysLog("SysLogText") == CFE_ES_ERR_SYS_LOG_FULL, "CFE_ES_WriteToSysLog", - "Add message to log that resets the log index"); + UtAssert_INT32_EQ(CFE_ES_WriteToSysLog("SysLogText"), CFE_ES_ERR_SYS_LOG_FULL); /* Test successfully adding a time-stamped message to the system log that * causes the log index to be reset @@ -4178,18 +3815,15 @@ void TestAPI(void) CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE; CFE_ES_Global.ResetDataPtr->SystemLogEndIdx = CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx; CFE_ES_Global.ResetDataPtr->SystemLogMode = CFE_ES_LogMode_OVERWRITE; - UT_Report(__FILE__, __LINE__, - CFE_ES_WriteToSysLog("SysLogText") == CFE_SUCCESS && - CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx < CFE_PLATFORM_ES_SYSTEM_LOG_SIZE, - "CFE_ES_WriteToSysLog", "Add message to log that resets the log index"); + CFE_UtAssert_SUCCESS(CFE_ES_WriteToSysLog("SysLogText")); + CFE_UtAssert_ATMOST(CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx, CFE_PLATFORM_ES_SYSTEM_LOG_SIZE - 1); /* Test run loop with an application error status */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_ERROR; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", - "Application error run status"); + CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); /* * Test public Name+ID query/lookup API for tasks @@ -4201,12 +3835,12 @@ void TestAPI(void) UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, CFE_ES_TASKID_UNDEFINED, sizeof(AppName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetTaskName(NULL, TaskId, sizeof(AppName)), CFE_ES_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName))); UT_SetDeferredRetcode(UT_KEY(OS_GetResourceName), 1, OS_ERROR); UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, NULL), CFE_ES_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, AppName), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GetTaskIDByName(&TaskId, AppName)); UT_SetDeferredRetcode(UT_KEY(OS_TaskGetIdByName), 1, OS_ERROR); UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, "Nonexistent"), CFE_ES_ERR_NAME_NOT_FOUND); } @@ -4221,12 +3855,10 @@ void TestGenericCounterAPI(void) /* Test successfully registering a generic counter */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(&CounterId, "Counter1") == CFE_SUCCESS, - "CFE_ES_RegisterGenCounter", "Register counter successful"); + CFE_UtAssert_SUCCESS(CFE_ES_RegisterGenCounter(&CounterId, "Counter1")); /* Test registering a generic counter that is already registered */ - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(&CounterId, "Counter1") == CFE_ES_ERR_DUPLICATE_NAME, - "CFE_ES_RegisterGenCounter", "Attempt to register an existing counter"); + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&CounterId, "Counter1"), CFE_ES_ERR_DUPLICATE_NAME); /* Test registering the maximum number of generic counters */ for (i = 1; i < CFE_PLATFORM_ES_MAX_GEN_COUNTERS; i++) @@ -4239,119 +3871,98 @@ void TestGenericCounterAPI(void) } } - UT_Report(__FILE__, __LINE__, i == CFE_PLATFORM_ES_MAX_GEN_COUNTERS, "CFE_ES_RegisterGenCounter", - "Register maximum number of counters"); + UtAssert_INT32_EQ(i, CFE_PLATFORM_ES_MAX_GEN_COUNTERS); /* Test registering a generic counter after the maximum are registered */ UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterGenCounter(&CounterId, "Counter999") == CFE_ES_NO_RESOURCE_IDS_AVAILABLE, - "CFE_ES_RegisterGenCounter", "Maximum number of counters exceeded"); + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&CounterId, "Counter999"), CFE_ES_NO_RESOURCE_IDS_AVAILABLE); UT_ResetState(UT_KEY(CFE_ResourceId_FindNext)); /* Check operation of the CFE_ES_CheckCounterIdSlotUsed() helper function */ CFE_ES_Global.CounterTable[1].CounterId = CFE_ES_COUNTERID_C(ES_UT_MakeCounterIdForIndex(1)); CFE_ES_Global.CounterTable[2].CounterId = CFE_ES_COUNTERID_UNDEFINED; - UtAssert_True(CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(1)), "Counter Slot Used"); - UtAssert_True(!CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(2)), "Counter Slot Unused"); + CFE_UtAssert_TRUE(CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(1))); + CFE_UtAssert_FALSE(CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(2))); /* Test getting a registered generic counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCounterIDByName(&CounterId, "Counter999") == CFE_ES_ERR_NAME_NOT_FOUND, - "CFE_ES_GetGenCounterIDByName", "Cannot get counter that does not exist"); + UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CounterId, "Counter999"), CFE_ES_ERR_NAME_NOT_FOUND); /* Test successfully getting a registered generic counter ID by name */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCounterIDByName(&CounterId, "Counter5") == CFE_SUCCESS, - "CFE_ES_GetGenCounterIDByName", "Get generic counter ID successful"); + CFE_UtAssert_SUCCESS(CFE_ES_GetGenCounterIDByName(&CounterId, "Counter5")); /* Test deleting a registered generic counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteGenCounter(CFE_ES_COUNTERID_UNDEFINED) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_DeleteGenCounter", "Cannot delete counter that does not exist"); + UtAssert_INT32_EQ(CFE_ES_DeleteGenCounter(CFE_ES_COUNTERID_UNDEFINED), CFE_ES_BAD_ARGUMENT); /* Test successfully deleting a registered generic counter by ID */ - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteGenCounter(CounterId) == CFE_SUCCESS, "CFE_ES_DeleteGenCounter", - "Successful"); + CFE_UtAssert_SUCCESS(CFE_ES_DeleteGenCounter(CounterId)); /* Test successfully registering a generic counter to verify a place for * it is now available and to provide an ID for subsequent tests */ - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(&CounterId, "CounterX") == CFE_SUCCESS, - "CFE_ES_RegisterGenCounter", "Register counter; back to maximum number"); + CFE_UtAssert_SUCCESS(CFE_ES_RegisterGenCounter(&CounterId, "CounterX")); /* Test incrementing a generic counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, CFE_ES_IncrementGenCounter(CFE_ES_COUNTERID_UNDEFINED) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_IncrementGenCounter", "Bad counter ID"); + UtAssert_INT32_EQ(CFE_ES_IncrementGenCounter(CFE_ES_COUNTERID_UNDEFINED), CFE_ES_BAD_ARGUMENT); /* Test successfully incrementing a generic counter */ - UT_Report(__FILE__, __LINE__, CFE_ES_IncrementGenCounter(CounterId) == CFE_SUCCESS, "CFE_ES_IncrementGenCounter", - "Increment counter successful"); + CFE_UtAssert_SUCCESS(CFE_ES_IncrementGenCounter(CounterId)); /* Test getting a generic counter value for a counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCount(CFE_ES_COUNTERID_UNDEFINED, &CounterCount) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_GetGenCount", "Bad counter ID"); + UtAssert_INT32_EQ(CFE_ES_GetGenCount(CFE_ES_COUNTERID_UNDEFINED, &CounterCount), CFE_ES_BAD_ARGUMENT); /* Test successfully getting a generic counter value */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCount(CounterId, &CounterCount) == CFE_SUCCESS && CounterCount == 1, - "CFE_ES_GetGenCount", "Get counter value successful"); + UtAssert_INT32_EQ(CFE_ES_GetGenCount(CounterId, &CounterCount) == CFE_SUCCESS && CounterCount, 1); /* Test setting a generic counter value for a counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, CFE_ES_SetGenCount(CFE_ES_COUNTERID_UNDEFINED, 5) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_SetGenCount", "Bad counter ID"); + UtAssert_INT32_EQ(CFE_ES_SetGenCount(CFE_ES_COUNTERID_UNDEFINED, 5), CFE_ES_BAD_ARGUMENT); /* Test successfully setting a generic counter value */ - UT_Report(__FILE__, __LINE__, CFE_ES_SetGenCount(CounterId, 5) == CFE_SUCCESS, "CFE_ES_SetGenCount", - "Set counter value successful"); + CFE_UtAssert_SUCCESS(CFE_ES_SetGenCount(CounterId, 5)); /* Test value retrieved from a generic counter value */ CFE_ES_GetGenCount(CounterId, &CounterCount); - UT_Report(__FILE__, __LINE__, (CounterCount == 5), "CFE_ES_SetGenCount", "Check value for counter set"); + UtAssert_INT32_EQ(CounterCount, 5); /* Test registering a generic counter with a null counter ID pointer */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(NULL, "Counter1") == CFE_ES_BAD_ARGUMENT, - "CFE_ES_RegisterGenCounter", "Attempt to register using a null counter ID pointer"); + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(NULL, "Counter1"), CFE_ES_BAD_ARGUMENT); /* Test registering a generic counter with a null counter name */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(&CounterId, NULL) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_RegisterGenCounter", "Attempt to register using a null counter name"); + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&CounterId, NULL), CFE_ES_BAD_ARGUMENT); /* Test incrementing a generic counter where the record is not in use */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_IncrementGenCounter(CounterId) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_IncrementGenCounter", "Record not in use"); + UtAssert_INT32_EQ(CFE_ES_IncrementGenCounter(CounterId), CFE_ES_BAD_ARGUMENT); /* Test setting a generic counter where the record is not in use */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_SetGenCount(CounterId, 0) == CFE_ES_BAD_ARGUMENT, "CFE_ES_SetGenCount", - "Record not in use"); + UtAssert_INT32_EQ(CFE_ES_SetGenCount(CounterId, 0), CFE_ES_BAD_ARGUMENT); /* Test getting a generic counter where the record is not in use */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCount(CounterId, &CounterCount) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_GetGenCount", "Record not in use"); + UtAssert_INT32_EQ(CFE_ES_GetGenCount(CounterId, &CounterCount), CFE_ES_BAD_ARGUMENT); /* Test getting a generic counter where the count is null */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCount(CounterId, NULL) == CFE_ES_BAD_ARGUMENT, "CFE_ES_GetGenCount", - "Null count"); + UtAssert_INT32_EQ(CFE_ES_GetGenCount(CounterId, NULL), CFE_ES_BAD_ARGUMENT); /* Test getting a registered generic counter ID using a null counter * pointer */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCounterIDByName(NULL, "CounterX") == CFE_ES_BAD_ARGUMENT, - "CFE_ES_GetGenCounterIDByName", "Null name"); + UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(NULL, "CounterX"), CFE_ES_BAD_ARGUMENT); /* * Test Name-ID query/conversion API */ ES_ResetUnitTest(); - UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&CounterId, "Counter1"), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(CounterName, CounterId, sizeof(CounterName)), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_RegisterGenCounter(&CounterId, "Counter1")); + CFE_UtAssert_SUCCESS(CFE_ES_GetGenCounterName(CounterName, CounterId, sizeof(CounterName))); UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CounterId2, "Nonexistent"), CFE_ES_ERR_NAME_NOT_FOUND); - UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CounterId2, CounterName), CFE_SUCCESS); - UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(CounterId, CounterId2), "Counter IDs Match"); + CFE_UtAssert_SUCCESS(CFE_ES_GetGenCounterIDByName(&CounterId2, CounterName)); + CFE_UtAssert_RESOURCEID_EQ(CounterId, CounterId2); UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(CounterName, CFE_ES_COUNTERID_UNDEFINED, sizeof(CounterName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(NULL, CounterId, sizeof(CounterName)), CFE_ES_BAD_ARGUMENT); @@ -4373,82 +3984,65 @@ void TestCDS() /* Test init with a mutex create failure */ UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, "CFE_ES_CDS_EarlyInit", - "Mutex create failed"); + UtAssert_INT32_EQ(CFE_ES_CDS_EarlyInit(), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Test locking the CDS registry with a mutex take failure */ UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_LockCDS() == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, "CFE_ES_LockCDS", - "Mutex take failed"); + UtAssert_INT32_EQ(CFE_ES_LockCDS(), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Test unlocking the CDS registry with a mutex give failure */ UT_SetDeferredRetcode(UT_KEY(OS_MutSemGive), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_UnlockCDS() == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, "CFE_ES_UnlockCDS", - "Mutex give failed"); + UtAssert_INT32_EQ(CFE_ES_UnlockCDS(), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Set up the PSP stubs for CDS testing */ UT_SetCDSSize(128 * 1024); /* Test the CDS Cache Fetch/Flush/Load routine error cases */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CacheFetch(&CFE_ES_Global.CDSVars.Cache, 4, 0) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDS_CacheFetch", "Invalid Size"); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CacheFlush(&CFE_ES_Global.CDSVars.Cache) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDS_CacheFlush", "Invalid Size"); + UtAssert_INT32_EQ(CFE_ES_CDS_CacheFetch(&CFE_ES_Global.CDSVars.Cache, 4, 0), CFE_ES_CDS_INVALID_SIZE); + UtAssert_INT32_EQ(CFE_ES_CDS_CacheFlush(&CFE_ES_Global.CDSVars.Cache), CFE_ES_CDS_INVALID_SIZE); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_CachePreload(&CFE_ES_Global.CDSVars.Cache, NULL, 4, 0) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDS_CachePreload", "Invalid Size"); + UtAssert_INT32_EQ(CFE_ES_CDS_CachePreload(&CFE_ES_Global.CDSVars.Cache, NULL, 4, 0), CFE_ES_CDS_INVALID_SIZE); TempSize = 5; - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CachePreload(&CFE_ES_Global.CDSVars.Cache, &TempSize, 4, 4) == CFE_SUCCESS, - "CFE_ES_CDS_CachePreload", "Nominal"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_CachePreload(&CFE_ES_Global.CDSVars.Cache, &TempSize, 4, 4)); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CacheFetch(&CFE_ES_Global.CDSVars.Cache, 4, 4) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDS_CacheFetch", "Access error"); + UtAssert_INT32_EQ(CFE_ES_CDS_CacheFetch(&CFE_ES_Global.CDSVars.Cache, 4, 4), CFE_ES_CDS_ACCESS_ERROR); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CacheFlush(&CFE_ES_Global.CDSVars.Cache) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDS_CacheFlush", "Access Error"); + UtAssert_INT32_EQ(CFE_ES_CDS_CacheFlush(&CFE_ES_Global.CDSVars.Cache), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS registering with a write CDS failure */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name3") == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_RegisterCDS", "Writing to BSP CDS failure"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, "Name3"), CFE_ES_CDS_ACCESS_ERROR); /* Test successful CDS registering */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name") == CFE_SUCCESS, "CFE_ES_RegisterCDS", - "Register CDS successful"); + CFE_UtAssert_SUCCESS(CFE_ES_RegisterCDS(&CDSHandle, 4, "Name")); /* Test CDS registering using an already registered name */ /* No reset here -- just attempt to register the same name again */ - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name") == CFE_ES_CDS_ALREADY_EXISTS, - "CFE_ES_RegisterCDS", "Retrieve existing CDS"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, "Name"), CFE_ES_CDS_ALREADY_EXISTS); /* Test CDS registering using the same name, but a different size */ /* No reset here -- just attempt to register the same name again */ - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 6, "Name") == CFE_SUCCESS, "CFE_ES_RegisterCDS", - "Get CDS of same name, but new size"); + CFE_UtAssert_SUCCESS(CFE_ES_RegisterCDS(&CDSHandle, 6, "Name")); /* Test CDS registering using a null name */ - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "") == CFE_ES_CDS_INVALID_NAME, - "CFE_ES_RegisterCDS", "Invalid name size"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, ""), CFE_ES_CDS_INVALID_NAME); /* Test CDS registering with a block size of zero */ - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 0, "Name") == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_RegisterCDS", "Block size zero"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 0, "Name"), CFE_ES_CDS_INVALID_SIZE); /* Test CDS registering with no memory pool available */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name") == CFE_ES_NOT_IMPLEMENTED, - "CFE_ES_RegisterCDS", "No memory pool available"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, "Name"), CFE_ES_NOT_IMPLEMENTED); /* Test CDS registering with all the CDS registries taken */ ES_ResetUnitTest(); @@ -4457,39 +4051,34 @@ void TestCDS() /* Set all the CDS registries to 'taken' */ UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name2") == CFE_ES_NO_RESOURCE_IDS_AVAILABLE, - "CFE_ES_RegisterCDS", "No available entries"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, "Name2"), CFE_ES_NO_RESOURCE_IDS_AVAILABLE); /* Check operation of the CFE_ES_CheckCDSHandleSlotUsed() helper function */ CFE_ES_Global.CDSVars.Registry[1].BlockID = CFE_ES_CDSHANDLE_C(ES_UT_MakeCDSIdForIndex(1)); CFE_ES_Global.CDSVars.Registry[2].BlockID = CFE_ES_CDS_BAD_HANDLE; - UtAssert_True(CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(1)), "CDS Slot Used"); - UtAssert_True(!CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(2)), "CDS Slot Unused"); + CFE_UtAssert_TRUE(CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(1))); + CFE_UtAssert_FALSE(CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(2))); /* Test CDS registering using a bad app ID */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name2") == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_RegisterCDS", "Bad application ID"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, "Name2"), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test copying to CDS with bad handle */ CDSHandle = CFE_ES_CDS_BAD_HANDLE; - UT_Report(__FILE__, __LINE__, CFE_ES_CopyToCDS(CDSHandle, &TempSize) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_CopyToCDS", "Copy to CDS bad handle"); + UtAssert_INT32_EQ(CFE_ES_CopyToCDS(CDSHandle, &TempSize), CFE_ES_ERR_RESOURCEID_NOT_VALID); + /* Test restoring from a CDS with bad handle */ - UT_Report(__FILE__, __LINE__, CFE_ES_RestoreFromCDS(&TempSize, CDSHandle) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_RestoreFromCDS", "Restore from CDS bad handle"); + UtAssert_INT32_EQ(CFE_ES_RestoreFromCDS(&TempSize, CDSHandle), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test successfully copying to a CDS */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_SUCCESS); ES_UT_SetupSingleCDSRegistry("UT", ES_UT_CDS_BLOCK_SIZE, false, &UtCDSRegRecPtr); CDSHandle = CFE_ES_CDSBlockRecordGetID(UtCDSRegRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CopyToCDS(CDSHandle, &BlockData) == CFE_SUCCESS, "CFE_ES_CopyToCDS", - "Copy to CDS successful"); + CFE_UtAssert_SUCCESS(CFE_ES_CopyToCDS(CDSHandle, &BlockData)); /* Test successfully restoring from a CDS */ - UT_Report(__FILE__, __LINE__, CFE_ES_RestoreFromCDS(&BlockData, CDSHandle) == CFE_SUCCESS, "CFE_ES_RestoreFromCDS", - "Restore from CDS successful"); + CFE_UtAssert_SUCCESS(CFE_ES_RestoreFromCDS(&BlockData, CDSHandle)); /* Test CDS registering using a name longer than the maximum allowed */ ES_ResetUnitTest(); @@ -4503,58 +4092,45 @@ void TestCDS() CDSName[i] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, CDSName) == CFE_ES_CDS_INVALID_NAME, - "CFE_ES_RegisterCDS", "Invalid name size"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, CDSName), CFE_ES_CDS_INVALID_NAME); /* Test unsuccessful CDS registering */ - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, CDS_ABS_MAX_BLOCK_SIZE + 1, "Name") == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_RegisterCDS", "Register CDS unsuccessful"); - - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, CDS_ABS_MAX_BLOCK_SIZE - 1, "Name") == CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_RegisterCDS", "Register CDS unsuccessful"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, CDS_ABS_MAX_BLOCK_SIZE + 1, "Name"), CFE_ES_CDS_INVALID_SIZE); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, CDS_ABS_MAX_BLOCK_SIZE - 1, "Name"), CFE_ES_ERR_MEM_BLOCK_SIZE); /* Test memory pool rebuild and registry recovery with an * unreadable registry */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, "CFE_ES_RebuildCDS", - "First read from CDS bad"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDS(), CFE_ES_CDS_INVALID); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 2, -1); - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, "CFE_ES_RebuildCDS", - "Second read from CDS bad"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDS(), CFE_ES_CDS_INVALID); /* Test CDS registry initialization with a CDS write failure */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSRegistry() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSRegistry", - "Failed to write registry size"); + UtAssert_INT32_EQ(CFE_ES_InitCDSRegistry(), CFE_ES_CDS_ACCESS_ERROR); /* Test successful CDS initialization */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_CDS_EarlyInit", - "Initialization successful"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_EarlyInit()); /* Test CDS initialization with a read error */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_CDS_EarlyInit", - "Unrecoverable read error"); + UtAssert_INT32_EQ(CFE_ES_CDS_EarlyInit(), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS initialization with size below the minimum */ ES_ResetUnitTest(); UT_SetCDSSize(1024); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_EarlyInit() == CFE_SUCCESS && UT_GetStubCount(UT_KEY(CFE_PSP_GetCDSSize)) == 1, - "CFE_ES_CDS_EarlyInit", "CDS size less than minimum"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_EarlyInit()); + UtAssert_STUB_COUNT(CFE_PSP_GetCDSSize, 1); /* Test CDS initialization with size not obtainable */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_GetCDSSize), -1); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == OS_ERROR, "CFE_ES_CDS_EarlyInit", - "Unable to obtain CDS size"); + UtAssert_INT32_EQ(CFE_ES_CDS_EarlyInit(), OS_ERROR); /* Reset back to a sufficient CDS size */ UT_SetCDSSize(128 * 1024); @@ -4563,56 +4139,48 @@ void TestCDS() /* Test CDS initialization with rebuilding not possible */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 3, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_CDS_EarlyInit", - "Rebuilding not possible; create new CDS"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_EarlyInit()); /* Test CDS validation with first CDS read call failure */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateCDS() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_ValidateCDS", - "CDS read (first call) failed"); + UtAssert_INT32_EQ(CFE_ES_ValidateCDS(), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS validation with second CDS read call failure */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateCDS() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_ValidateCDS", - "CDS read (second call) failed"); + UtAssert_INT32_EQ(CFE_ES_ValidateCDS(), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS validation with CDS read end check failure */ memset(CdsPtr + CdsSize - CFE_ES_CDS_SIGNATURE_LEN, 'x', CFE_ES_CDS_SIGNATURE_LEN); - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateCDS() == CFE_ES_CDS_INVALID, "CFE_ES_ValidateCDS", - "Reading from CDS failed end check"); + UtAssert_INT32_EQ(CFE_ES_ValidateCDS(), CFE_ES_CDS_INVALID); /* Test CDS validation with CDS read begin check failure */ UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, &CdsSize, NULL); memset(CdsPtr, 'x', CFE_ES_CDS_SIGNATURE_LEN); - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateCDS() == CFE_ES_CDS_INVALID, "CFE_ES_ValidateCDS", - "Reading from CDS failed begin check"); + UtAssert_INT32_EQ(CFE_ES_ValidateCDS(), CFE_ES_CDS_INVALID); /* Test CDS initialization where first write call to the CDS fails */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSSignatures() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSSignatures", - "CDS write (first call) failed"); + UtAssert_INT32_EQ(CFE_ES_InitCDSSignatures(), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS initialization where second write call to the CDS fails */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSSignatures() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSSignatures", - "CDS write (second call) failed"); + UtAssert_INT32_EQ(CFE_ES_InitCDSSignatures(), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS clear where write call to the CDS fails */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_ClearCDS() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_ClearCDS", "CDS write failed"); + UtAssert_INT32_EQ(CFE_ES_ClearCDS(), CFE_ES_CDS_ACCESS_ERROR); /* Test rebuilding the CDS where the registry is not the same size */ ES_ResetUnitTest(); UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, &CdsSize, NULL); TempSize = CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES + 1; memcpy(CdsPtr + CDS_REG_SIZE_OFFSET, &TempSize, sizeof(TempSize)); - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, "CFE_ES_RebuildCDS", - "Registry too large to recover"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDS(), CFE_ES_CDS_INVALID); /* Test clearing CDS where size is an odd number (requires partial write) */ ES_ResetUnitTest(); CFE_ES_Global.CDSVars.TotalSize = 53; - UT_Report(__FILE__, __LINE__, CFE_ES_ClearCDS() == CFE_SUCCESS, "CFE_ES_ClearCDS", "CDS write failed"); + CFE_UtAssert_SUCCESS(CFE_ES_ClearCDS()); /* * To prepare for the rebuild tests, set up a clean area in PSP mem, @@ -4622,7 +4190,7 @@ void TestCDS() ES_UT_SetupSingleCDSRegistry("UT", 8, false, &UtCDSRegRecPtr); UtAssert_NONZERO(UtCDSRegRecPtr->BlockOffset); UtAssert_NONZERO(UtCDSRegRecPtr->BlockSize); - UtAssert_INT32_EQ(CFE_ES_UpdateCDSRegistry(), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_UpdateCDSRegistry()); /* Test successfully rebuilding the CDS */ ES_ResetUnitTest(); @@ -4631,7 +4199,7 @@ void TestCDS() UtAssert_ZERO(UtCDSRegRecPtr->BlockOffset); UtAssert_ZERO(UtCDSRegRecPtr->BlockSize); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_RebuildCDS", "CDS rebuild successful"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_EarlyInit()); /* Check that the registry entry exists again (was recovered) */ UtAssert_NONZERO(UtCDSRegRecPtr->BlockOffset); @@ -4640,18 +4208,15 @@ void TestCDS() /* Test rebuilding the CDS with the registry unreadable */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, "CFE_ES_RebuildCDS", - "CDS registry unreadable"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDS(), CFE_ES_CDS_INVALID); /* Test deleting the CDS from the registry with a registry write failure */ ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("NO_APP.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, true, NULL); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteCDS("NO_APP.CDS_NAME", true) == -1, "CFE_ES_DeleteCDS", - "CDS block descriptor write failed"); + UtAssert_INT32_EQ(CFE_ES_DeleteCDS("NO_APP.CDS_NAME", true), -1); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteCDS("NO_APP.CDS_NAME", true) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_DeleteCDS", "CDS registry write failed"); + UtAssert_INT32_EQ(CFE_ES_DeleteCDS("NO_APP.CDS_NAME", true), CFE_ES_CDS_ACCESS_ERROR); /* Test deleting the CDS from the registry with the owner application * still active @@ -4659,8 +4224,7 @@ void TestCDS() ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, true, NULL); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteCDS("CFE_ES.CDS_NAME", true) == CFE_ES_CDS_OWNER_ACTIVE_ERR, - "CFE_ES_DeleteCDS", "Owner application still active"); + UtAssert_INT32_EQ(CFE_ES_DeleteCDS("CFE_ES.CDS_NAME", true), CFE_ES_CDS_OWNER_ACTIVE_ERR); /* * To prepare for the rebuild tests, set up a clean area in PSP mem @@ -4669,24 +4233,20 @@ void TestCDS() /* Test CDS initialization where rebuilding the CDS is successful */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_CDS_EarlyInit", - "Initialization with successful rebuild"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_EarlyInit()); /* Test CDS initialization where rebuilding the CDS is unsuccessful */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 3, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_CDS_EarlyInit", - "Initialization with unsuccessful rebuild"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_EarlyInit()); /* Test CDS initialization where initializing the CDS registry fails */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSRegistry() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSRegistry", - "CDS registry write size failed"); + UtAssert_INT32_EQ(CFE_ES_InitCDSRegistry(), CFE_ES_CDS_ACCESS_ERROR); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSRegistry() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSRegistry", - "CDS registry write content failed"); + UtAssert_INT32_EQ(CFE_ES_InitCDSRegistry(), CFE_ES_CDS_ACCESS_ERROR); /* Test deleting the CDS from the registry with a CDS name longer than the * maximum allowed @@ -4695,8 +4255,7 @@ void TestCDS() memset(CDSName, 'a', sizeof(CDSName) - 1); CDSName[sizeof(CDSName) - 1] = '\0'; ES_UT_SetupSingleCDSRegistry(CDSName, ES_UT_CDS_BLOCK_SIZE, true, NULL); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteCDS(CDSName, true) == CFE_ES_ERR_NAME_NOT_FOUND, "CFE_ES_DeleteCDS", - "CDS name too long"); + UtAssert_INT32_EQ(CFE_ES_DeleteCDS(CDSName, true), CFE_ES_ERR_NAME_NOT_FOUND); /* * Test Name-ID query/conversion API @@ -4704,11 +4263,10 @@ void TestCDS() ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("CDS1", ES_UT_CDS_BLOCK_SIZE, false, &UtCDSRegRecPtr); CDSHandle = CFE_ES_CDSBlockRecordGetID(UtCDSRegRecPtr); - UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(CDSName, CDSHandle, sizeof(CDSName)), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GetCDSBlockName(CDSName, CDSHandle, sizeof(CDSName))); UtAssert_INT32_EQ(CFE_ES_GetCDSBlockIDByName(&CDSHandle, "Nonexistent"), CFE_ES_ERR_NAME_NOT_FOUND); - UtAssert_INT32_EQ(CFE_ES_GetCDSBlockIDByName(&CDSHandle, CDSName), CFE_SUCCESS); - UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(CDSHandle, CFE_ES_CDSBlockRecordGetID(UtCDSRegRecPtr)), - "CDS Handle IDs Match"); + CFE_UtAssert_SUCCESS(CFE_ES_GetCDSBlockIDByName(&CDSHandle, CDSName)); + CFE_UtAssert_RESOURCEID_EQ(CDSHandle, CFE_ES_CDSBlockRecordGetID(UtCDSRegRecPtr)); UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(CDSName, CFE_ES_CDS_BAD_HANDLE, sizeof(CDSName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(NULL, CDSHandle, sizeof(CDSName)), CFE_ES_BAD_ARGUMENT); @@ -4731,12 +4289,10 @@ void TestCDSMempool(void) /* Test creating the CDS pool with the pool size too small */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CreateCDSPool(2, 1) == CFE_ES_CDS_INVALID_SIZE, "CFE_ES_CreateCDSPool", - "CDS pool size too small"); + UtAssert_INT32_EQ(CFE_ES_CreateCDSPool(2, 1), CFE_ES_CDS_INVALID_SIZE); /* Test rebuilding the CDS pool with the pool size too small */ - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDSPool(2, 1) == CFE_ES_CDS_INVALID_SIZE, "CFE_ES_RebuildCDSPool", - "CDS pool size too small"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDSPool(2, 1), CFE_ES_CDS_INVALID_SIZE); /* Test rebuilding CDS pool with CDS access errors */ /* @@ -4751,28 +4307,24 @@ void TestCDSMempool(void) UtAssert_NONZERO(UtCdsRegRecPtr->BlockOffset); UtAssert_NONZERO(UtCdsRegRecPtr->BlockSize); CFE_ES_DeleteCDS("UT", false); - UtAssert_INT32_EQ(CFE_ES_UpdateCDSRegistry(), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_UpdateCDSRegistry()); /* Clear/reset the global state */ ES_ResetUnitTest(); /* Test rebuilding the CDS pool with a descriptor retrieve error */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDSPool(SavedSize, SavedOffset) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_RebuildCDSPool", "CDS descriptor retrieve error"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDSPool(SavedSize, SavedOffset), CFE_ES_CDS_ACCESS_ERROR); /* Test rebuilding the CDS pool with a descriptor commit error */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDSPool(SavedSize, SavedOffset) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_RebuildCDSPool", "CDS descriptor commit error"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDSPool(SavedSize, SavedOffset), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS block write using an invalid memory handle */ ES_ResetUnitTest(); BlockHandle = CFE_ES_CDSHANDLE_C(CFE_ResourceId_FromInteger(7)); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_CDSBlockWrite", "Invalid memory handle"); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_CDSBlockRead", "Invalid memory handle"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockWrite(BlockHandle, &Data), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test CDS block access */ ES_ResetUnitTest(); @@ -4782,64 +4334,51 @@ void TestCDSMempool(void) Data = 42; /* Basic success path */ - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_SUCCESS, "CFE_ES_CDSBlockWrite", - "Nominal"); + CFE_UtAssert_SUCCESS(CFE_ES_CDSBlockWrite(BlockHandle, &Data)); Data = 0; - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_SUCCESS, "CFE_ES_CDSBlockRead", - "Nominal"); + CFE_UtAssert_SUCCESS(CFE_ES_CDSBlockRead(&Data, BlockHandle)); UtAssert_INT32_EQ(Data, 42); /* Corrupt/change the block offset, should fail validation */ --UtCdsRegRecPtr->BlockOffset; - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_CDSBlockWrite", "Block offset error"); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_CDSBlockRead", "Block offset error"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockWrite(BlockHandle, &Data), CFE_ES_POOL_BLOCK_INVALID); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_POOL_BLOCK_INVALID); ++UtCdsRegRecPtr->BlockOffset; /* Corrupt/change the block size, should trigger invalid size error */ --UtCdsRegRecPtr->BlockSize; - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDSBlockWrite", "Block size error"); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDSBlockRead", "Block size error"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockWrite(BlockHandle, &Data), CFE_ES_CDS_INVALID_SIZE); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_CDS_INVALID_SIZE); ++UtCdsRegRecPtr->BlockSize; /* Test CDS block read/write with a CDS read error (block descriptor) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDSBlockWrite", "Read error on descriptor"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockWrite(BlockHandle, &Data), CFE_ES_CDS_ACCESS_ERROR); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDSBlockRead", "Read error on descriptor"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS block write with a CDS write error (block header) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDSBlockWrite", "Write error on header"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockWrite(BlockHandle, &Data), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS block read with a CDS read error (block header) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDSBlockRead", "Read error on header"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS block write with a CDS write error (data content) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == OS_ERROR, "CFE_ES_CDSBlockWrite", - "Write error on content"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockWrite(BlockHandle, &Data), OS_ERROR); /* Test CDS block read with a CDS read error (data content) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 3, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == OS_ERROR, "CFE_ES_CDSBlockRead", - "Read error on content"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), OS_ERROR); /* Corrupt the data as to cause a CRC mismatch */ UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, NULL, NULL); CdsPtr[UtCdsRegRecPtr->BlockOffset] ^= 0x02; /* Bit flip */ - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_BLOCK_CRC_ERR, - "CFE_ES_CDSBlockRead", "CRC error on content"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_CDS_BLOCK_CRC_ERR); CdsPtr[UtCdsRegRecPtr->BlockOffset] ^= 0x02; /* Fix Bit */ } @@ -4865,59 +4404,46 @@ void TestESMempool(void) * too small */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreateNoSem(&PoolID1, Buffer1, 0) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateNoSem", "Pool size too small"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID1, Buffer1, 0), CFE_ES_BAD_ARGUMENT); /* Test successfully creating memory pool without using a mutex */ - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreateNoSem(&PoolID1, Buffer1, sizeof(Buffer1)) == CFE_SUCCESS, - "CFE_ES_PoolCreateNoSem", "Memory pool create; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreateNoSem(&PoolID1, Buffer1, sizeof(Buffer1))); /* Test creating memory pool using a mutex with the pool size too small */ - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID2, Buffer2, 0) == CFE_ES_BAD_ARGUMENT, "CFE_ES_PoolCreate", - "Pool size too small"); + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID2, Buffer2, 0), CFE_ES_BAD_ARGUMENT); /* Test successfully creating memory pool using a mutex */ - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", "Create memory pool (using mutex) [1]; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2))); /* Test successfully allocating a pool buffer */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [1]; successful"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256), 256); - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [2]; successful"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256), 256); /* Test successfully getting the size of an existing pool buffer */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID2, addressp2) > 0, "CFE_ES_GetPoolBufInfo", - "Get pool buffer size; successful"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID2, addressp2), 256); /* Test successfully getting the size of an existing pool buffer. Use no * mutex in order to get branch path coverage */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID1, addressp1) > 0, "CFE_ES_GetPoolBufInfo", - "Get pool buffer size; successful (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID1, addressp1), 256); /* Test successfully returning a pool buffer to the memory pool */ - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID1, addressp1) > 0, "CFE_ES_PutPoolBuf", - "Return buffer to the memory pool; successful"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID1, addressp1), 256); - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) > 0, "CFE_ES_PutPoolBuf", - "Return buffer to the memory pool; successful"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID2, addressp2), 256); /* Test successfully allocating an additional pool buffer */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [2]; successful"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256), 256); /* Test successfully returning a pool buffer to the second memory pool. * Use no mutex in order to get branch path coverage */ - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) > 0, "CFE_ES_PutPoolBuf", - "Return buffer to the second memory pool; successful"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID2, addressp2), 256); /* Test handle validation using a handle with an invalid memory address */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_MemValidateRange), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateHandle(PoolID2) == false, "CFE_ES_ValidateHandle", - "Invalid handle; bad memory address"); + CFE_UtAssert_FALSE(CFE_ES_ValidateHandle(PoolID2)); /* Test handle validation using a handle where the first pool structure * field is not the pool start address @@ -4931,103 +4457,86 @@ void TestESMempool(void) */ *((uint32 *)&PoolPtr->PoolID) ^= 10; /* cause it to fail validation */ - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateHandle(PoolID2) == false, "CFE_ES_ValidateHandle", - "Invalid handle; not pool start address"); + CFE_UtAssert_FALSE(CFE_ES_ValidateHandle(PoolID2)); /* Test allocating a pool buffer where the memory handle is not the pool * start address */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetPoolBuf", "Invalid handle; not pool start address"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test getting memory pool statistics where the memory handle is not * the pool start address */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetMemPoolStats(&Stats, CFE_ES_MEMHANDLE_UNDEFINED) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetMemPoolStats", "Invalid handle; not pool start address"); + UtAssert_INT32_EQ(CFE_ES_GetMemPoolStats(&Stats, CFE_ES_MEMHANDLE_UNDEFINED), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test allocating a pool buffer where the memory block doesn't fit within * the remaining memory */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 75000) == CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_GetPoolBuf", "Requested pool size too large"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp1, PoolID1, 75000), CFE_ES_ERR_MEM_BLOCK_SIZE); /* Test getting the size of an existing pool buffer using an * invalid handle */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID2, addressp2) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID2, addressp2), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Undo the previous memory corruption */ *((uint32 *)&PoolPtr->PoolID) ^= 10; /* Repair Pool2 ID */ /* Test returning a pool buffer using an invalid memory block */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(PoolID2, CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp2 - 40)) == CFE_ES_BUFFER_NOT_IN_POOL, - "CFE_ES_PutPoolBuf", "Invalid memory block"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID2, CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp2 - 40)), + CFE_ES_BUFFER_NOT_IN_POOL); /* Test initializing a pre-allocated pool specifying a number of block * sizes greater than the maximum */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS + 2, BlockSizes, - CFE_ES_USE_MUTEX) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateEx", "Number of block sizes exceeds maximum"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS + 2, + BlockSizes, CFE_ES_USE_MUTEX), + CFE_ES_BAD_ARGUMENT); /* Test initializing a pre-allocated pool specifying a pool size that * is too small and using the default block size */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(CFE_ES_GenPoolBD_t) / 2, - CFE_PLATFORM_ES_POOL_MAX_BUCKETS - 2, BlockSizes, - CFE_ES_USE_MUTEX) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateEx", "Memory pool size too small (default block size)"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(CFE_ES_GenPoolBD_t) / 2, + CFE_PLATFORM_ES_POOL_MAX_BUCKETS - 2, BlockSizes, CFE_ES_USE_MUTEX), + CFE_ES_BAD_ARGUMENT); /* Test calling CFE_ES_PoolCreateEx() with NULL pointer arguments */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(NULL, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, BlockSizes, - CFE_ES_USE_MUTEX) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateEx", "Memory pool bad arguments (NULL handle pointer)"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(NULL, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, BlockSizes, + CFE_ES_USE_MUTEX), + CFE_ES_BAD_ARGUMENT); - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, NULL, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, BlockSizes, - CFE_ES_USE_MUTEX) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateEx", "Memory pool bad arguments (NULL mem pointer)"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID1, NULL, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, BlockSizes, + CFE_ES_USE_MUTEX), + CFE_ES_BAD_ARGUMENT); /* * Test to use default block sizes if none are given */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 0, NULL, CFE_ES_USE_MUTEX) == CFE_SUCCESS, - "CFE_ES_PoolCreateEx", "Use default block sizes when none are given"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 0, NULL, CFE_ES_USE_MUTEX)); /* * Test creating a memory pool after the limit reached (no slots) */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, BlockSizes, - CFE_ES_USE_MUTEX) == CFE_ES_NO_RESOURCE_IDS_AVAILABLE, - "CFE_ES_PoolCreateEx", "Memory pool limit reached"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, + BlockSizes, CFE_ES_USE_MUTEX), + CFE_ES_NO_RESOURCE_IDS_AVAILABLE); /* Check operation of the CFE_ES_CheckCounterIdSlotUsed() helper function */ CFE_ES_Global.MemPoolTable[1].PoolID = CFE_ES_MEMHANDLE_C(ES_UT_MakePoolIdForIndex(1)); CFE_ES_Global.MemPoolTable[2].PoolID = CFE_ES_MEMHANDLE_UNDEFINED; - UtAssert_True(CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(1)), "MemPool Slot Used"); - UtAssert_True(!CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(2)), "MemPool Slot Unused"); + CFE_UtAssert_TRUE(CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(1))); + CFE_UtAssert_FALSE(CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(2))); /* * Test creating a memory pool with a semaphore error */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1)) == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, - "CFE_ES_PoolCreateEx", "Memory pool mutex create error"); + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1)), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* * Test creating a memory pool with a semaphore error @@ -5038,8 +4547,7 @@ void TestESMempool(void) OS_MutSemCreate(&PoolPtr->MutexId, "UT", 0); UT_SetDeferredRetcode(UT_KEY(OS_MutSemDelete), 1, OS_ERROR); PoolID1 = CFE_ES_MemPoolRecordGetID(PoolPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_PoolDelete(PoolID1) == CFE_SUCCESS, "CFE_ES_PoolDelete", - "Memory pool delete with semaphore delete error"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolDelete(PoolID1)); /* Test initializing a pre-allocated pool specifying * the block size with one block size set to zero @@ -5049,46 +4557,35 @@ void TestESMempool(void) BlockSizes[1] = 50; BlockSizes[2] = 100; BlockSizes[3] = 0; - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 4, BlockSizes, CFE_ES_USE_MUTEX) == - CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_PoolCreateEx", "Memory pool block size zero (block size specified)"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 4, BlockSizes, CFE_ES_USE_MUTEX), + CFE_ES_ERR_MEM_BLOCK_SIZE); BlockSizes[0] = 10; BlockSizes[1] = 50; - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 2, BlockSizes, CFE_ES_USE_MUTEX) == CFE_SUCCESS, - "CFE_ES_PoolCreateEx", "Make space for new size"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 2, BlockSizes, CFE_ES_USE_MUTEX)); /* Test successfully creating memory pool using a mutex for * subsequent tests */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", "Create memory pool (using mutex) [2]; successful"); - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", "Create memory pool (no mutex) [2]; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1))); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2))); /* Test successfully allocating an additional pool buffer for * subsequent tests */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [3]; successful"); - - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [3]; successful"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256), 256); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256), 256); /* Test getting the size of an existing pool buffer using an * unallocated block */ BdPtr = ((CFE_ES_GenPoolBD_t *)addressp1) - 1; BdPtr->Allocated ^= 717; - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle; unallocated block"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID1, addressp1), CFE_ES_POOL_BLOCK_INVALID); /* Test returning a pool buffer using an unallocated block */ - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", "Deallocate an unallocated block"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID1, addressp1), CFE_ES_POOL_BLOCK_INVALID); BdPtr->Allocated ^= 717; /* repair */ @@ -5097,8 +4594,7 @@ void TestESMempool(void) */ BdPtr->Allocated = 0xaaaa; BdPtr->CheckBits ^= 717; - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle; check bit pattern"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID1, addressp1), CFE_ES_POOL_BLOCK_INVALID); BdPtr->CheckBits ^= 717; /* repair */ @@ -5106,22 +4602,19 @@ void TestESMempool(void) * memory descriptor */ BdPtr->ActualSize = 0xFFFFFFFF; - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", "Invalid/corrupted memory descriptor"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID1, addressp1), CFE_ES_POOL_BLOCK_INVALID); /* Test getting the size of an existing pool buffer using an * unallocated block. Use no mutex in order to get branch path coverage */ BdPtr = ((CFE_ES_GenPoolBD_t *)addressp2) - 1; BdPtr->Allocated ^= 717; - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle; unallocated block (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID2, addressp2), CFE_ES_POOL_BLOCK_INVALID); /* Test returning a pool buffer using an unallocated block. Use no mutex * in order to get branch path coverage */ - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", "Deallocate an unallocated block (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID2, addressp2), CFE_ES_POOL_BLOCK_INVALID); BdPtr->Allocated ^= 717; /* repair */ @@ -5130,8 +4623,7 @@ void TestESMempool(void) * coverage */ BdPtr->CheckBits ^= 717; - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle; check bit pattern (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID2, addressp2), CFE_ES_POOL_BLOCK_INVALID); BdPtr->CheckBits ^= 717; /* repair */ @@ -5139,85 +4631,66 @@ void TestESMempool(void) * memory descriptor. Use no mutex in order to get branch path coverage */ BdPtr->ActualSize = 0xFFFFFFFF; - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", "Invalid/corrupted memory descriptor (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID2, addressp2), CFE_ES_POOL_BLOCK_INVALID); /* Test successfully creating memory pool using a mutex for * subsequent tests */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", "Create memory pool (using mutex) [3]; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1))); /* Test successfully allocating an additional pool buffer for * subsequent tests. Use no mutex in order to get branch path coverage */ - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", "Create memory pool (using mutex) [3]; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2))); /* Test successfully allocating an additional pool buffer for * subsequent tests */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [3]; successful"); - - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [3]; successful"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256), 256); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256), 256); /* Test returning a pool buffer using a buffer size larger than * the maximum */ BdPtr = ((CFE_ES_GenPoolBD_t *)addressp1) - 1; BdPtr->ActualSize = CFE_PLATFORM_ES_MAX_BLOCK_SIZE + 1; - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", "Pool buffer size exceeds maximum"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID1, addressp1), CFE_ES_POOL_BLOCK_INVALID); /* Test returning a pool buffer using a buffer size larger than * the maximum. Use no mutex in order to get branch path coverage */ BdPtr = ((CFE_ES_GenPoolBD_t *)addressp2) - 1; BdPtr->ActualSize = CFE_PLATFORM_ES_MAX_BLOCK_SIZE + 1; - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", "Pool buffer size exceeds maximum (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID2, addressp2), CFE_ES_POOL_BLOCK_INVALID); /* Test allocating an additional pool buffer using a buffer size larger * than the maximum */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID1, 99000) == CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_GetPoolBuf", "Pool buffer size exceeds maximum"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, PoolID1, 99000), CFE_ES_ERR_MEM_BLOCK_SIZE); /* Test handle validation using a null handle */ - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateHandle(CFE_ES_MEMHANDLE_UNDEFINED) == false, "CFE_ES_ValidateHandle", - "NULL handle"); + CFE_UtAssert_FALSE(CFE_ES_ValidateHandle(CFE_ES_MEMHANDLE_UNDEFINED)); /* Test returning a pool buffer using a null handle */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(CFE_ES_MEMHANDLE_UNDEFINED, addressp2) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_PutPoolBuf", "NULL memory handle"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(CFE_ES_MEMHANDLE_UNDEFINED, addressp2), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test allocating a pool buffer using a null handle */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp2, CFE_ES_MEMHANDLE_UNDEFINED, 256) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetPoolBuf", "NULL memory handle"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, CFE_ES_MEMHANDLE_UNDEFINED, 256), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test getting the size of an existing pool buffer using a null handle */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBufInfo(CFE_ES_MEMHANDLE_UNDEFINED, addressp1) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetPoolBufInfo", "NULL memory handle"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(CFE_ES_MEMHANDLE_UNDEFINED, addressp1), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test initializing a pre-allocated pool specifying a small block size */ ES_ResetUnitTest(); BlockSizes[0] = 16; - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, 128, 1, BlockSizes, CFE_ES_USE_MUTEX) == CFE_SUCCESS, - "CFE_ES_PoolCreateEx", "Allocate small memory pool"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, 128, 1, BlockSizes, CFE_ES_USE_MUTEX)); /* Test allocating an additional pool buffer using a buffer size larger * than the maximum. */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 32) == CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_GetPoolBuf", "Pool buffer size exceeds maximum (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp1, PoolID1, 32), CFE_ES_ERR_MEM_BLOCK_SIZE); /* * Test allocating a pool buffer where the memory block doesn't fit within @@ -5241,18 +4714,15 @@ void TestESMempool(void) } } - UT_Report(__FILE__, __LINE__, i >= 1 && i <= 20, "CFE_ES_GetPoolBuf", "Pool fully allocated"); + UtAssert_NONZERO(i); + CFE_UtAssert_ATMOST(i, 20); /* Test getting the size of a pool buffer that is not in the pool */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBufInfo(PoolID1, CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp1 + 400)) == - CFE_ES_BUFFER_NOT_IN_POOL, - "CFE_ES_GetPoolBufInfo", "Invalid pool buffer"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID1, CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp1 + 400)), + CFE_ES_BUFFER_NOT_IN_POOL); /* Test getting the size of a pool buffer with an invalid memory handle */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(CFE_ES_MEMHANDLE_UNDEFINED, addressp1) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_PutPoolBuf", "Invalid memory handle"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(CFE_ES_MEMHANDLE_UNDEFINED, addressp1), CFE_ES_ERR_RESOURCEID_NOT_VALID); } /* Tests to fill gaps in coverage in SysLog */ @@ -5276,26 +4746,23 @@ void TestSysLog(void) CFE_ES_SysLogReadStart_Unsync(&SysLogBuffer); - UT_Report(__FILE__, __LINE__, - SysLogBuffer.EndIdx == sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1 && - SysLogBuffer.LastOffset == sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1 && - SysLogBuffer.BlockSize == 0 && SysLogBuffer.SizeLeft == 0, - "CFE_ES_SysLogReadStart_Unsync(SysLogBuffer)", "ResetDataPtr pointing to an old fragment of a message"); + CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.EndIdx, sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1); + CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.LastOffset, sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1); + UtAssert_ZERO(SysLogBuffer.BlockSize); + UtAssert_ZERO(SysLogBuffer.SizeLeft); /* Test truncation of a sys log message that is over half * the size of the total log */ ES_ResetUnitTest(); memset(LogString, 'a', (CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2) + 1); LogString[(CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2) + 1] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_ES_SysLogAppend_Unsync(LogString) == CFE_ES_ERR_SYS_LOG_TRUNCATED, - "CFE_ES_SysLogAppend_Unsync", "Truncated sys log message"); + UtAssert_INT32_EQ(CFE_ES_SysLogAppend_Unsync(LogString), CFE_ES_ERR_SYS_LOG_TRUNCATED); /* Test code that skips writing an empty string to the sys log */ ES_ResetUnitTest(); memset(LogString, 'a', (CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2) + 1); LogString[0] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_ES_SysLogAppend_Unsync(LogString) == CFE_SUCCESS, "CFE_ES_SysLogAppend_Unsync", - "Don't log an empty string"); + CFE_UtAssert_SUCCESS(CFE_ES_SysLogAppend_Unsync(LogString)); /* Test Reading space between the current read offset and end of the log buffer */ ES_ResetUnitTest(); @@ -5306,10 +4773,10 @@ void TestSysLog(void) CFE_ES_SysLogReadData(&SysLogBuffer); - UT_Report(__FILE__, __LINE__, - SysLogBuffer.EndIdx == 3 && SysLogBuffer.LastOffset == 1 && SysLogBuffer.BlockSize == 1 && - SysLogBuffer.SizeLeft == 0, - "CFE_ES_SysLogReadData", "Read space between current offset and end of log buffer"); + UtAssert_UINT32_EQ(SysLogBuffer.EndIdx, 3); + CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.LastOffset, 1); + CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.BlockSize, 1); + UtAssert_ZERO(SysLogBuffer.SizeLeft); /* Test nominal flow through CFE_ES_SysLogDump * with multiple reads and writes */ @@ -5317,30 +4784,23 @@ void TestSysLog(void) CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx = 0; CFE_ES_Global.ResetDataPtr->SystemLogEndIdx = sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1; - CFE_ES_SysLogDump("fakefilename"); - - UT_Report(__FILE__, __LINE__, true, "CFE_ES_SysLogDump", "Multiple reads and writes to sys log"); + CFE_UtAssert_VOIDCALL(CFE_ES_SysLogDump("fakefilename")); /* Test "message got truncated" */ ES_ResetUnitTest(); memset(TmpString, 'a', CFE_ES_MAX_SYSLOG_MSG_SIZE); TmpString[CFE_ES_MAX_SYSLOG_MSG_SIZE] = '\0'; - CFE_ES_WriteToSysLog("%s", TmpString); - UT_Report(__FILE__, __LINE__, true, "CFE_ES_WriteToSysLog", "Truncate message"); + CFE_UtAssert_SUCCESS(CFE_ES_WriteToSysLog("%s", TmpString)); } void TestBackground(void) { - int32 status; - /* CFE_ES_BackgroundInit() with default setup * causes CFE_ES_CreateChildTask to fail. */ ES_ResetUnitTest(); - status = CFE_ES_BackgroundInit(); - UtAssert_True(status == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_BackgroundInit - CFE_ES_CreateChildTask failure (%08x)", (unsigned int)status); + UtAssert_INT32_EQ(CFE_ES_BackgroundInit(), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* The CFE_ES_BackgroundCleanup() function has no conditionals - * it just needs to be executed as part of this routine, @@ -5349,7 +4809,7 @@ void TestBackground(void) ES_ResetUnitTest(); OS_BinSemCreate(&CFE_ES_Global.BackgroundTask.WorkSem, "UT", 0, 0); CFE_ES_BackgroundCleanup(); - UtAssert_True(UT_GetStubCount(UT_KEY(OS_BinSemDelete)) == 1, "CFE_ES_BackgroundCleanup - OS_BinSemDelete called"); + UtAssert_STUB_COUNT(OS_BinSemDelete, 1); /* * When testing the background task loop, it is normally an infinite loop, @@ -5364,10 +4824,8 @@ void TestBackground(void) CFE_ES_Global.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_INIT; UT_SetDeferredRetcode(UT_KEY(OS_BinSemTimedWait), 3, -4); CFE_ES_BackgroundTask(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_BACKGROUND_TAKE]), - "CFE_ES_BackgroundTask", "Failed to take background sem"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_BACKGROUND_TAKE]); + /* The number of jobs running should be 1 (perf log dump) */ - UtAssert_True(CFE_ES_Global.BackgroundTask.NumJobsRunning == 1, - "CFE_ES_BackgroundTask - Nominal, CFE_ES_Global.BackgroundTask.NumJobsRunning (%u) == 1", - (unsigned int)CFE_ES_Global.BackgroundTask.NumJobsRunning); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundTask.NumJobsRunning, 1); } diff --git a/modules/evs/ut-coverage/evs_UT.c b/modules/evs/ut-coverage/evs_UT.c index 2d0ccaf67..9bedb5003 100644 --- a/modules/evs/ut-coverage/evs_UT.c +++ b/modules/evs/ut-coverage/evs_UT.c @@ -232,8 +232,7 @@ void Test_Init(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[4]), "CFE_EVS_EarlyInit", - "Early initialization successful"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[4]); /* Test TaskMain with a command pipe read failure due to an * invalid command packet @@ -245,22 +244,21 @@ void Test_Init(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &msgid, sizeof(msgid), false); UT_EVS_DoGenericCheckEvents(CFE_EVS_TaskMain, &UT_EVS_EventBuf); - CFE_UtAssert_TRUE(UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[8])); - CFE_UtAssert_EQUAL(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_MSGID_EID); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[8]); + UtAssert_INT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_MSGID_EID); /* Test early initialization with a get reset area failure */ UT_InitData(); UT_SetStatusBSPResetArea(-1, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_EVS_EarlyInit(); UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_PRIMARY); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[1]), "CFE_EVS_EarlyInit", - "CFE_PSP_GetResetArea call failure"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[1]); /* Test early initialization, restoring the event log */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, -1); CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[6]), "CFE_EVS_EarlyInit", "Event log restored"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[6]); /* Test early initialization, clearing the event log (log mode path) */ UT_InitData(); @@ -269,8 +267,7 @@ void Test_Init(void) CFE_EVS_Global.EVS_LogPtr->LogFullFlag = false; CFE_EVS_Global.EVS_LogPtr->Next = CFE_PLATFORM_EVS_LOG_MAX - 1; CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[5]), "CFE_EVS_EarlyInit", - "Event log cleared (log mode path)"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[5]); /* Test early initialization, clearing the event log (log full path) */ UT_InitData(); @@ -279,8 +276,7 @@ void Test_Init(void) CFE_EVS_Global.EVS_LogPtr->LogFullFlag = 2; CFE_EVS_Global.EVS_LogPtr->Next = CFE_PLATFORM_EVS_LOG_MAX - 1; CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[5]), "CFE_EVS_EarlyInit", - "Event log cleared (log full path)"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[5]); /* Test early initialization, clearing the event log (next log path) */ UT_InitData(); @@ -289,15 +285,13 @@ void Test_Init(void) CFE_EVS_Global.EVS_LogPtr->LogFullFlag = true; CFE_EVS_Global.EVS_LogPtr->Next = CFE_PLATFORM_EVS_LOG_MAX; CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[5]), "CFE_EVS_EarlyInit", - "Event log cleared (next log path)"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[5]); /* Test early initialization with a mutex creation failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, -1); CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[3]), "CFE_EVS_EarlyInit", - "Mutex create failure"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[3]); /* Test early initialization with an unexpected size returned * by CFE_PSP_GetResetArea @@ -305,8 +299,7 @@ void Test_Init(void) UT_InitData(); UT_SetSizeofESResetArea(0); CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[2]), "CFE_EVS_EarlyInit", - "Unexpected size returned by CFE_PSP_GetResetArea"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[2]); /* Repeat sucessful initialization to configure log for later references */ UT_InitData(); @@ -314,65 +307,56 @@ void Test_Init(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); CFE_EVS_EarlyInit(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[4]), "CFE_EVS_EarlyInit", - "Early initialization successful"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[4]); /* Test task initialization where event services fails */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 2, -1); /* Set Failure in CFE_EVS_Register -> EVS_GetApp_ID */ CFE_EVS_TaskInit(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[11]), "CFE_EVS_TaskInit", - "Call to CFE_EVS_Register failure"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[11]); /* Test task initialization where the pipe creation fails */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, -1); CFE_EVS_TaskInit(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[12]), "CFE_EVS_TaskInit", - "Call to CFE_SB_CreatePipe failure"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[12]); /* Test task initialization where command subscription fails */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 1, -1); CFE_EVS_TaskInit(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[13]), "CFE_EVS_TaskInit", - "Subscribing to commands failure"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[13]); /* Test task initialization where HK request subscription fails */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 2, -1); CFE_EVS_TaskInit(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[14]), "CFE_EVS_TaskInit", - "Subscribing to HK request failure"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[14]); /* Test task initialization where getting the application ID fails */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppID), -1); CFE_EVS_TaskInit(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(EVS_SYSLOG_MSGS[10]), "CFE_EVS_TaskInit", - "Call to CFE_ES_GetAppID Failed"); + CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[10]); /* Test successful task initialization */ UT_InitData(); CFE_EVS_TaskInit(); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 0, "CFE_EVS_TaskInit", - "Normal init (WARM)"); + UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 0); /* Enable DEBUG message output */ UT_InitData(); appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, - "CFE_EVS_EnableAppEventTypesCmd", "Enable debug message output"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Disable ports */ UT_InitData(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DISPORT_EID, "CFE_EVS_DisablePortsCmd", - "Disable ports"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DISPORT_EID); } /* @@ -389,50 +373,42 @@ void Test_IllegalAppID(void) UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test registering an event using an illegal application ID */ - UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, 0) == CFE_EVS_APP_ILLEGAL_APP_ID, "CFE_EVS_Register", - "Illegal app ID"); + UtAssert_INT32_EQ(CFE_EVS_Register(NULL, 0, 0), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test sending an event using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, 0, "NULL") == CFE_EVS_APP_ILLEGAL_APP_ID, "CFE_EVS_SendEvent", - "Illegal app ID"); + UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, 0, "NULL"), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test sending an event using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, EVS_SendEvent(0, 0, "NULL") == CFE_SUCCESS, "EVS_SendEvent", "Illegal app ID"); + CFE_UtAssert_SUCCESS(EVS_SendEvent(0, 0, "NULL")); /* Test sending a timed event using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, CFE_EVS_SendTimedEvent(time, 0, 0, "NULL") == CFE_EVS_APP_ILLEGAL_APP_ID, - "CFE_EVS_SendTimedEvent", "Illegal app ID"); + UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(time, 0, 0, "NULL"), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test sending an event with app ID using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEventWithAppID(0, 0, CFE_ES_APPID_UNDEFINED, "NULL") == CFE_EVS_APP_ILLEGAL_APP_ID, - "CFE_EVS_SendEventWithAppID", "Illegal app ID"); + UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, 0, CFE_ES_APPID_UNDEFINED, "NULL"), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test resetting a filter using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, CFE_EVS_ResetFilter(0) == CFE_EVS_APP_ILLEGAL_APP_ID, "CFE_EVS_ResetFilter", - "Illegal app ID"); + UtAssert_INT32_EQ(CFE_EVS_ResetFilter(0), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test resetting all filters using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, CFE_EVS_ResetAllFilters() == CFE_EVS_APP_ILLEGAL_APP_ID, "CFE_EVS_ResetAllFilters", - "Illegal app ID"); + UtAssert_INT32_EQ(CFE_EVS_ResetAllFilters(), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test application cleanup using an illegal application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UT_Report(__FILE__, __LINE__, CFE_EVS_CleanUpApp(CFE_ES_APPID_UNDEFINED) == CFE_EVS_APP_ILLEGAL_APP_ID, - "CFE_EVS_CleanUpApp", "Illegal app ID"); + UtAssert_INT32_EQ(CFE_EVS_CleanUpApp(CFE_ES_APPID_UNDEFINED), CFE_EVS_APP_ILLEGAL_APP_ID); } /* @@ -456,39 +432,33 @@ void Test_UnregisteredApp(void) /* Test sending an event to an unregistered application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, 0, "NULL") == CFE_EVS_APP_NOT_REGISTERED, "CFE_EVS_SendEvent", - "App not registered"); + UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, 0, "NULL"), CFE_EVS_APP_NOT_REGISTERED); /* Test resetting a filter using an unregistered application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_ResetFilter(0) == CFE_EVS_APP_NOT_REGISTERED, "CFE_EVS_ResetFilter", - "App not registered"); + UtAssert_INT32_EQ(CFE_EVS_ResetFilter(0), CFE_EVS_APP_NOT_REGISTERED); /* Test resetting all filters using an unregistered application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_ResetAllFilters() == CFE_EVS_APP_NOT_REGISTERED, "CFE_EVS_ResetAllFilters", - "App not registered"); + UtAssert_INT32_EQ(CFE_EVS_ResetAllFilters(), CFE_EVS_APP_NOT_REGISTERED); /* Test sending an event with app ID to an unregistered application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "NULL") == CFE_EVS_APP_NOT_REGISTERED, - "CFE_EVS_SendEventWithAppID", "App not registered"); + UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "NULL"), + CFE_EVS_APP_NOT_REGISTERED); /* Test sending a timed event to an unregistered application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendTimedEvent(time, CFE_EVS_EventType_INFORMATION, 0, "NULL") == CFE_EVS_APP_NOT_REGISTERED, - "CFE_EVS_SendTimedEvent", "App not registered"); + UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(time, CFE_EVS_EventType_INFORMATION, 0, "NULL"), + CFE_EVS_APP_NOT_REGISTERED); /* Test application cleanup using an unregistered application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_CleanUpApp(AppID) == CFE_SUCCESS, "CFE_EVS_CleanUpApp", "App not registered"); + CFE_UtAssert_SUCCESS(CFE_EVS_CleanUpApp(AppID)); /* Re-register the application for subsequent tests */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", "Register app - successful"); + CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); } /* @@ -514,29 +484,25 @@ void Test_FilterRegistration(void) /* Test filter registration using an invalid filter option */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY + 1) == CFE_EVS_UNKNOWN_FILTER, - "CFE_EVS_Register", "Illegal filter option"); + UtAssert_INT32_EQ(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY + 1), CFE_EVS_UNKNOWN_FILTER); /* Test successful filter registration with no filters */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", "Valid w/ no filters"); + CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); /* Re-register to test valid unregistration */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", "Valid with no filters (re-registration)"); + CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); /* Test successful app cleanup */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_CleanUpApp(AppID) == CFE_SUCCESS, "CFE_EVS_CleanUpApp", "Valid cleanup"); + CFE_UtAssert_SUCCESS(CFE_EVS_CleanUpApp(AppID)); /* Test successful filter registration with a valid filter */ UT_InitData(); filter[0].EventID = 0; filter[0].Mask = 0x0001; - UT_Report(__FILE__, __LINE__, CFE_EVS_Register(filter, 1, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", "Valid w/ filter"); + CFE_UtAssert_SUCCESS(CFE_EVS_Register(filter, 1, CFE_EVS_EventFilter_BINARY)); /* Test successful multiple filter registration with valid filters */ UT_InitData(); @@ -547,42 +513,33 @@ void Test_FilterRegistration(void) filter[i].Mask = 1; } - UT_Report(__FILE__, __LINE__, - CFE_EVS_Register(filter, CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1, CFE_EVS_EventFilter_BINARY) == - CFE_SUCCESS, - "CFE_EVS_Register", "Valid over max filters"); + CFE_UtAssert_SUCCESS(CFE_EVS_Register(filter, CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1, CFE_EVS_EventFilter_BINARY)); /* Send 1st information message, should get through */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "OK") == CFE_SUCCESS, - "CFE_EVS_SendEvent", "1st info message should go through"); + CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "OK")); /* Send 2nd information message, should be filtered */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED") == CFE_SUCCESS, - "CFE_EVS_SendEvent", "2nd info message should be filtered"); + CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED")); /* Send last information message, which should cause filtering to lock */ UT_InitData(); FilterPtr = EVS_FindEventID(0, (EVS_BinFilter_t *)AppDataPtr->BinFilters); FilterPtr->Count = CFE_EVS_MAX_FILTER_COUNT - 1; - UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "OK") == CFE_SUCCESS, - "CFE_EVS_SendEvent", "Last info message should go through"); + CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "OK")); /* Test that filter lock is applied */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED") == CFE_SUCCESS, - "CFE_EVS_SendEvent", "Locked info message should be filtered"); + CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED")); /* Test that filter lock is (still) applied */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED") == CFE_SUCCESS, - "CFE_EVS_SendEvent", "Locked info message should still be filtered"); + CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED")); /* Return application to original state: re-register application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "FE_EVS_Register", "Re-register application"); + CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); /* Test sending an event with app ID to a registered, filtered * application @@ -590,16 +547,13 @@ void Test_FilterRegistration(void) UT_InitData(); AppDataPtr->AppID = AppID; AppDataPtr->ActiveFlag = false; - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "NULL") == CFE_SUCCESS, - "CFE_EVS_SendEventWithAppID", "Application registered and filtered"); + CFE_UtAssert_SUCCESS(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "NULL")); /* Test sending a timed event to a registered, filtered application */ UT_InitData(); AppDataPtr->AppID = AppID; AppDataPtr->ActiveFlag = false; - UT_Report(__FILE__, __LINE__, CFE_EVS_SendTimedEvent(time, CFE_EVS_EventType_INFORMATION, 0, "NULL") == CFE_SUCCESS, - "CFE_EVS_SendTimedEvent", "Application registered and filtered"); + CFE_UtAssert_SUCCESS(CFE_EVS_SendTimedEvent(time, CFE_EVS_EventType_INFORMATION, 0, "NULL")); } /* @@ -615,33 +569,27 @@ void Test_FilterReset(void) UT_InitData(); filter.EventID = 1; filter.Mask = 0x0001; - UT_Report(__FILE__, __LINE__, CFE_EVS_Register(&filter, 1, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", "Register filter - successful"); + CFE_UtAssert_SUCCESS(CFE_EVS_Register(&filter, 1, CFE_EVS_EventFilter_BINARY)); /* Test filter reset using an invalid event ID */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_EVS_ResetFilter(CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1) == CFE_EVS_EVT_NOT_REGISTERED, - "CFE_EVS_ResetFilter", "Invalid event ID"); + UtAssert_INT32_EQ(CFE_EVS_ResetFilter(CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1), CFE_EVS_EVT_NOT_REGISTERED); /* Test filter reset using an unregistered event ID */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_ResetFilter(-1) == CFE_SUCCESS, "CFE_EVS_ResetFilter", - "Unregistered event ID"); + CFE_UtAssert_SUCCESS(CFE_EVS_ResetFilter(-1)); /* Test successful filter reset */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_ResetFilter(1) == CFE_SUCCESS, "CFE_EVS_ResetFilter", "Valid reset filter"); + CFE_UtAssert_SUCCESS(CFE_EVS_ResetFilter(1)); /* Test successful reset of all filters */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_ResetAllFilters() == CFE_SUCCESS, "CFE_EVS_ResetAllFilters", - "Valid reset all filters"); + CFE_UtAssert_SUCCESS(CFE_EVS_ResetAllFilters()); /* Return application to original state: re-register application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", "Re-register app"); + CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); } /* @@ -688,16 +636,14 @@ void Test_Format(void) appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, - "CFE_EVS_EnableAppEventTypesCmd", "Enable debug message output"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Test set event format mode command using an invalid mode */ UT_InitData(); modecmd.Payload.MsgFormat = 0xff; UT_EVS_DoDispatchCheckEvents(&modecmd, sizeof(modecmd), UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLEGALFMTMOD_EID, - "CFE_EVS_SetEventFormatModeCmd", "Set event format mode command: invalid event format mode = 0xff"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLEGALFMTMOD_EID); /* Test set event format mode command using a valid command to set short * format, reports implicitly via event @@ -706,8 +652,7 @@ void Test_Format(void) modecmd.Payload.MsgFormat = CFE_EVS_MsgFormat_SHORT; UT_EVS_DoDispatchCheckEventsShort(&modecmd, sizeof(modecmd), UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_SETEVTFMTMOD_EID, "CFE_EVS_SetEventFormatModeCmd", - "Set event format mode command: short format"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_SETEVTFMTMOD_EID); UtPrintf("Test for short event sent when configured to do so "); UT_InitData(); @@ -716,13 +661,13 @@ void Test_Format(void) CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Short format check 1"); /* Note implementation initializes both short and long message */ - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_Init)), 2); - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)), 1); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(CFE_MSG_Init)), 2); + UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)), 1); CFE_UtAssert_TRUE(CFE_SB_MsgId_Equal(MsgData.MsgId, ShortFmtSnapshotData.MsgId)); - CFE_UtAssert_TRUE(!CFE_SB_MsgId_Equal(MsgData.MsgId, LongFmtSnapshotData.MsgId)); + CFE_UtAssert_FALSE(CFE_SB_MsgId_Equal(MsgData.MsgId, LongFmtSnapshotData.MsgId)); /* Confirm the right message was sent */ - CFE_UtAssert_TRUE(MsgSend == MsgData.MsgPtr); + UtAssert_ADDRESS_EQ(MsgSend, MsgData.MsgPtr); /* Test set event format mode command using a valid command to set long * format, reports implicitly via event @@ -731,8 +676,7 @@ void Test_Format(void) modecmd.Payload.MsgFormat = CFE_EVS_MsgFormat_LONG; UT_EVS_DoDispatchCheckEvents(&modecmd, sizeof(modecmd), UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_SETEVTFMTMOD_EID, "CFE_EVS_SetEventFormatModeCmd", - "Set event format mode command: long format"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_SETEVTFMTMOD_EID); /* Test event long format mode command was successful (the following * messages are output if long format selection is successful) @@ -747,8 +691,9 @@ void Test_Format(void) EventID[1] = CapturedMsg.EventID; memset(&CapturedMsg, 0xFF, sizeof(CapturedMsg)); CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "Long format check (SendEventWithAppID)"); - UT_Report(__FILE__, __LINE__, EventID[0] == 0 && EventID[1] == 0 && CapturedMsg.EventID == 0, - "CFE_EVS_SetEventFormatModeCmd", "Long event format mode verification"); + UtAssert_ZERO(EventID[0]); + UtAssert_ZERO(EventID[1]); + UtAssert_ZERO(CapturedMsg.EventID); /* Test sending an event using a string length greater than * the maximum allowed @@ -761,22 +706,17 @@ void Test_Format(void) } long_msg[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH + 1] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "%s", long_msg) == CFE_SUCCESS, - "CFE_EVS_SendEvent", "Sent info message with > maximum string length"); + CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "%s", long_msg)); /* Test sending an event with application ID using a string length * greater than the maximum allowed */ - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "%s", long_msg) == CFE_SUCCESS, - "CFE_EVS_SendEventWithAppID", "Sent info message with > maximum string length"); + CFE_UtAssert_SUCCESS(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "%s", long_msg)); /* Test sending a timed event using a string length greater than * the maximum allowed */ - UT_Report(__FILE__, __LINE__, - CFE_EVS_SendTimedEvent(time, 0, CFE_EVS_EventType_INFORMATION, "%s", long_msg) == CFE_SUCCESS, - "CFE_EVS_SendTimedEvent", "Sent info message with > maximum string length"); + CFE_UtAssert_SUCCESS(CFE_EVS_SendTimedEvent(time, 0, CFE_EVS_EventType_INFORMATION, "%s", long_msg)); } /* @@ -796,85 +736,75 @@ void Test_Ports(void) bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAPORT_EID, "CFE_EVS_EnablePortsCmd", - "Enable ports command received with port bit mask = 0x0f"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAPORT_EID); /* Test that ports are enabled by sending a message */ UT_InitData(); UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Test ports message"); - UT_Report(__FILE__, __LINE__, LocalSnapshotData.Count == 1, "CFE_EVS_EnablePortsCmd", "Test ports output"); + UtAssert_UINT32_EQ(LocalSnapshotData.Count, 1); /* Disable all ports to cut down on unneeded output */ UT_InitData(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DISPORT_EID, "CFE_EVS_DisablePortsCmd", - "Disable ports command received with port bit mask = 0x0f"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DISPORT_EID); /* Test enabling a port using a bitmask that is out of range (high) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, "CFE_EVS_EnablePortsCmd", - "Bit mask out of range (high)"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test disabling a port using a bitmask that is out of range */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, "CFE_EVS_DisablePortsCmd", - "Bit mask = 0x000000ff out of range: CC = 12"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling a port using a bitmask that is out of range (low) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, "CFE_EVS_EnablePortsCmd", - "Bit mask out of range (low)"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling a port 1 and 2, but not 3 and 4 (branch path coverage) */ UT_InitData(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAPORT_EID, "CFE_EVS_EnablePortsCmd", - "Enable ports 1 and 2; disable ports 3 and 4"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAPORT_EID); /* Test enabling a port 3 and 4, but not 1 and 2 (branch path coverage) */ UT_InitData(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAPORT_EID, "CFE_EVS_EnablePortsCmd", - "Enable ports 3 and 4; disable ports 1 and 2"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAPORT_EID); /* Test disabling a port using a bitmask that is out of range (low) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, "CFE_EVS_DisablePortsCmd", - "Bit mask out of range (low)"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test disabling a port 1 and 2, but not 3 and 4 (branch path coverage) */ UT_InitData(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DISPORT_EID, "CFE_EVS_DisablePortsCmd", - "Enable ports 1 and 2; disable ports 3 and 4"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DISPORT_EID); /* Test disabling a port 3 and 4, but not 1 and 2 (branch path coverage) */ UT_InitData(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DISPORT_EID, "CFE_EVS_DisablePortsCmd", - "Enable ports 3 and 4; disable ports 1 and 2"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DISPORT_EID); } /* @@ -916,16 +846,14 @@ void Test_Logging(void) CmdBuf.modecmd.Payload.LogMode = 0xff; UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_LOGMODE_EID, "CFE_EVS_SetLogModeCmd", - "Set log mode to an invalid mode"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_LOGMODE_EID); /* Test setting the logging mode to discard */ UT_InitData(); CmdBuf.modecmd.Payload.LogMode = CFE_EVS_LogMode_DISCARD; UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LOGMODE_EID, "CFE_EVS_SetLogModeCmd", - "Set log mode to discard mode"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LOGMODE_EID); /* Test overfilling the log in discard mode */ UT_InitData(); @@ -940,10 +868,8 @@ void Test_Logging(void) } CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Log overfill event discard"); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Global.EVS_LogPtr->LogFullFlag == true && - CFE_EVS_Global.EVS_LogPtr->LogMode == CFE_EVS_LogMode_DISCARD, - "CFE_EVS_SendEvent", "Log overfill event (discard mode)"); + CFE_UtAssert_TRUE(CFE_EVS_Global.EVS_LogPtr->LogFullFlag); + UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_LogPtr->LogMode, CFE_EVS_LogMode_DISCARD); /* Test setting the logging mode to overwrite */ UT_InitData(); @@ -951,23 +877,20 @@ void Test_Logging(void) UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Log overfill event overwrite"); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Global.EVS_LogPtr->LogFullFlag == true && - CFE_EVS_Global.EVS_LogPtr->LogMode == CFE_EVS_LogMode_OVERWRITE, - "CFE_EVS_SetLogModeCmd", "Log overfill event (overwrite mode)"); + CFE_UtAssert_TRUE(CFE_EVS_Global.EVS_LogPtr->LogFullFlag); + UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_LogPtr->LogMode, CFE_EVS_LogMode_OVERWRITE); /* Test sending a no op command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_EVS_DoDispatchCheckEvents(&CmdBuf.cmd, sizeof(CmdBuf.cmd), UT_TPID_CFE_EVS_CMD_NOOP_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_NOOP_EID, "CFE_EVS_ProcessGroundCommand", - "No-op command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_NOOP_EID); /* Clear log for next test */ UT_InitData(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; UT_EVS_DoDispatchCheckEvents(&CmdBuf.cmd, sizeof(CmdBuf.cmd), UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, CFE_EVS_Global.EVS_LogPtr->LogFullFlag == false, "EVS_ClearLog", "Clear log"); + CFE_UtAssert_FALSE(CFE_EVS_Global.EVS_LogPtr->LogFullFlag); /* Test setting the logging mode to overwrite */ UT_InitData(); @@ -979,8 +902,7 @@ void Test_Logging(void) CFE_EVS_ResetDataPtr = (CFE_ES_ResetData_t *)TempAddr; CFE_EVS_Global.EVS_LogPtr = &CFE_EVS_ResetDataPtr->EVS_Log; CmdBuf.modecmd.Payload.LogMode = CFE_EVS_LogMode_OVERWRITE; - UT_Report(__FILE__, __LINE__, CFE_EVS_SetLogModeCmd(&CmdBuf.modecmd) == CFE_SUCCESS, "CFE_EVS_SetLogModeCmd", - "Set log mode to overwrite mode"); + CFE_UtAssert_SUCCESS(CFE_EVS_SetLogModeCmd(&CmdBuf.modecmd)); /* Test successfully writing a single event log entry using the default * log name @@ -989,36 +911,31 @@ void Test_Logging(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); CmdBuf.logfilecmd.Payload.LogFilename[0] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) == CFE_SUCCESS, - "CFE_EVS_WriteLogDataFileCmd", "Write single event log entry - successful (default log name)"); + CFE_UtAssert_SUCCESS(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd)); /* Test writing a log entry with a file name failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); - UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) != CFE_SUCCESS, - "CFE_EVS_WriteLogDataFileCmd", "FS parse filename failure"); + UtAssert_INT32_EQ(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd), CFE_FS_INVALID_PATH); /* Test writing a log entry with a create failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) != CFE_SUCCESS, - "CFE_EVS_WriteLogDataFileCmd", "OS create fail"); + UtAssert_INT32_EQ(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd), OS_ERROR); /* Test successfully writing all log entries */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); CFE_EVS_Global.EVS_LogPtr->LogCount = CFE_PLATFORM_EVS_LOG_MAX; - UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) == CFE_SUCCESS, - "CFE_EVS_WriteLogDataFileCmd", "Write all event log entries"); + CFE_UtAssert_SUCCESS(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd)); /* Test writing a log entry with a write failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); CFE_EVS_Global.EVS_LogPtr->LogCount = CFE_PLATFORM_EVS_LOG_MAX; - UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) != CFE_SUCCESS, - "CFE_EVS_WriteLogDataFileCmd", "OS write fail"); + UtAssert_INT32_EQ(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd), CFE_EVS_FILE_WRITE_ERROR); /* Test successfully writing a single event log entry using a specified * log name @@ -1027,8 +944,7 @@ void Test_Logging(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); strncpy(CmdBuf.logfilecmd.Payload.LogFilename, "LogFile", sizeof(CmdBuf.logfilecmd.Payload.LogFilename) - 1); CmdBuf.logfilecmd.Payload.LogFilename[sizeof(CmdBuf.logfilecmd.Payload.LogFilename) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) == CFE_SUCCESS, - "CFE_EVS_WriteLogDataFileCmd", "Write single event log entry - successful (log name specified)"); + CFE_UtAssert_SUCCESS(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd)); /* Test successfully writing a single event log entry with a failure * writing the header @@ -1036,8 +952,7 @@ void Test_Logging(void) UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, sizeof(CFE_FS_Header_t) + 1); CmdBuf.logfilecmd.Payload.LogFilename[0] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd) != CFE_SUCCESS, - "CFE_EVS_WriteLogDataFileCmd", "Write single event log entry - write header failed"); + UtAssert_INT32_EQ(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd), CFE_EVS_FILE_WRITE_ERROR); } /* @@ -1065,15 +980,13 @@ void Test_WriteApp(void) CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; UT_EVS_DoDispatchCheckEvents(&CmdBuf.appbitcmd, sizeof(CmdBuf.appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, - "CFE_EVS_EnableAppEventTypesCmd", "Enable debug message output"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Test resetting counters */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&CmdBuf.cmd, sizeof(CmdBuf.cmd), UT_TPID_CFE_EVS_CMD_RESET_COUNTERS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_RSTCNT_EID, "CFE_EVS_ResetCountersCmd", - "Reset counters - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTCNT_EID); /* Test writing application data with a create failure using default * file name @@ -1085,16 +998,14 @@ void Test_WriteApp(void) UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_CRDATFILE_EID, "CFE_EVS_WriteAppDataFileCmd", - "OS create fail (default file name)"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_CRDATFILE_EID); /* Test writing application data with bad file name */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_CRDATFILE_EID, "CFE_EVS_WriteAppDataFileCmd", - "parse filename failure"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_CRDATFILE_EID); /* Test writing application data with a write/close failure */ UT_InitData(); @@ -1102,15 +1013,13 @@ void Test_WriteApp(void) UT_SetDefaultReturnValue(UT_KEY(OS_close), OS_ERROR); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_WRDATFILE_EID, "CFE_EVS_WriteAppDataFileCmd", - "OS write fail"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_WRDATFILE_EID); /* Test successfully writing application data */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_WRDAT_EID, "CFE_EVS_WriteAppDataFileCmd", - "Write application data - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_WRDAT_EID); /* Test writing application data with a create failure using specified * file name @@ -1122,15 +1031,13 @@ void Test_WriteApp(void) UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_CRDATFILE_EID, "CFE_EVS_WriteAppDataFileCmd", - "OS create fail (specified file name)"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_CRDATFILE_EID); /* Test writing application data with a failure writing the header */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, sizeof(CFE_FS_Header_t) + 1); CmdBuf.AppDataCmd.Payload.AppDataFilename[0] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_EVS_WriteAppDataFileCmd(&CmdBuf.AppDataCmd) != CFE_SUCCESS, - "CFE_EVS_WriteAppDataFileCmd", "Write application data - write header failed"); + UtAssert_INT32_EQ(CFE_EVS_WriteAppDataFileCmd(&CmdBuf.AppDataCmd), CFE_EVS_FILE_WRITE_ERROR); } /* @@ -1169,32 +1076,28 @@ void Test_BadAppCmd(void) UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_DisableAppEventTypesCmd", "Unable to retrieve application ID while disabling event types"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test enabling application event types with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_EnableAppEventTypesCmd", "Unable to retrieve application ID while enabling event types"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test disabling application events with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_DisableAppEventsCmd", "Unable to retrieve application ID while disabling events"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test enabling application events with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, "CFE_EVS_EnableAppEventsCmd", - "Unable to retrieve application ID while enabling events"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test resetting the application event counter with an unknown * application ID @@ -1203,50 +1106,40 @@ void Test_BadAppCmd(void) UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_ResetAppEventCounterCmd", "Unable to retrieve application ID while resetting events"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test modifying event filters with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, "CFE_EVS_AddEventFilterCmd", - "Unable to retrieve application ID while modifying event " - "filters"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test deleting event filters with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, - "CFE_EVS_DeleteEventFilterCmd", - "Unable to retrieve application ID while deleting event " - "filters"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test setting the event filter mask with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, "CFE_EVS_SetFilterMaskCmd", - "Unable to retrieve application ID while setting the event " - "filter mask"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test resetting the filter with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, "CFE_EVS_ResetFilterCmd", - "Unable to retrieve application ID while resetting the filter"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test resetting all filters with an unknown application ID */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_NOAPPIDFOUND_EID, "CFE_EVS_ResetAllFiltersCmd", - "Unable to retrieve application ID while resetting all filters"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test disabling application event types with an illegal application ID */ UT_InitData(); @@ -1266,34 +1159,28 @@ void Test_BadAppCmd(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_DisableAppEventTypesCmd", - "Illegal application ID while disabling application event " - "types"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test enabling application event types with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_EnableAppEventTypesCmd", "Illegal application ID while enabling application event types"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test disabling application events with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_DisableAppEventsCmd", "Illegal application ID while disabling application events"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test enabling application events with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_EnableAppEventsCmd", "Illegal application ID while enabling application events"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test resetting the application event counter with an illegal * application ID @@ -1302,48 +1189,40 @@ void Test_BadAppCmd(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_ResetAppEventCounterCmd", - "Illegal application ID while resetting the application event " - "counter"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test adding the event filter with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, "CFE_EVS_AddEventFilterCmd", - "Illegal application ID while adding the event filter"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test deleting the event filter with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_DeleteEventFilterCmd", "Illegal application ID while deleting the event filter"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test setting the filter mask with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, "CFE_EVS_SetFilterMaskCmd", - "Illegal application ID while setting the filter mask"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test resetting the filter with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, "CFE_EVS_ResetFilterCmd", - "Illegal application ID while resetting the filter"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test resetting all filters with an illegal application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_ILLAPPIDRANGE_EID, - "CFE_EVS_ResetAllFiltersCmd", "Illegal application ID while resetting all filters"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test disabling application event types with an unregistered * application ID @@ -1361,10 +1240,7 @@ void Test_BadAppCmd(void) appcmdcmd.Payload.AppName[sizeof(appcmdcmd.Payload.AppName) - 1] = '\0'; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, - "CFE_EVS_DisableAppEventTypesCmd", - "Application not registered while disabling application event " - "types"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test enabling application event types with an unregistered * application ID @@ -1373,26 +1249,21 @@ void Test_BadAppCmd(void) UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, - "CFE_EVS_EnableAppEventTypesCmd", - "Application not registered while enabling application event " - "types"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test disabling application events with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_DisableAppEventsCmd", - "Application not registered while disabling application events"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test enabling application events with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_EnableAppEventsCmd", - "Application not registered while enabling application events"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test resetting the application event counter with an unregistered * application ID @@ -1401,48 +1272,40 @@ void Test_BadAppCmd(void) UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, - "CFE_EVS_ResetAppEventCounterCmd", - "Application not registered while resetting the application " - "event counter"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test adding the event filter with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_AddEventFilterCmd", - "Application not registered while adding the event filter"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test deleting the event filter with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_DeleteEventFilterCmd", - "Application not registered while deleting the event filter"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test setting the filter mask with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_SetFilterMaskCmd", - "Application not registered while setting the filter mask"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test resetting the filter with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_ResetFilterCmd", - "Application not registered while resetting the filter"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test resetting all filters with an unregistered application ID */ UT_InitData(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_APPNOREGS_EID, "CFE_EVS_ResetAllFiltersCmd", - "Application not registered while resetting all filters"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); } /* @@ -1483,10 +1346,11 @@ void Test_EventCmd(void) EventCount[2] = LocalSnapshotData.Count; CFE_EVS_SendEvent(0, CFE_EVS_EventType_CRITICAL, "FAIL : Critical message disabled"); EventCount[3] = LocalSnapshotData.Count; - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == 0xFFFF && EventCount[0] == 0 && EventCount[1] == 0 && EventCount[2] == 0 && - EventCount[3] == 0, - "CFE_EVS_SendEvent", "Disable all events"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, 0xFFFF); + UtAssert_ZERO(EventCount[0]); + UtAssert_ZERO(EventCount[1]); + UtAssert_ZERO(EventCount[2]); + UtAssert_ZERO(EventCount[3]); /* Test enabling of all events */ UT_InitData(); @@ -1502,10 +1366,11 @@ void Test_EventCmd(void) EventCount[2] = LocalSnapshotData.Count; CFE_EVS_SendEvent(0, CFE_EVS_EventType_CRITICAL, "Critical message enabled"); EventCount[3] = LocalSnapshotData.Count; - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID && EventCount[0] == 1 && EventCount[1] == 2 && - EventCount[2] == 3 && EventCount[3] == 4, - "CFE_EVS_SendEvent", "Enable all event types"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); + UtAssert_UINT32_EQ(EventCount[0], 1); + UtAssert_UINT32_EQ(EventCount[1], 2); + UtAssert_UINT32_EQ(EventCount[2], 3); + UtAssert_UINT32_EQ(EventCount[3], 4); /* Test disabling event type using an illegal type */ UT_InitData(); @@ -1513,67 +1378,58 @@ void Test_EventCmd(void) UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); CFE_EVS_SendEvent(0, 0xffff, "FAIL : Illegal type disabled"); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_DisableAppEventTypesCmd", "Disable events using an illegal event type"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling event type using an illegal type */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_EnableAppEventTypesCmd", "Enable events using an illegal event type"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test successful disabling of application events */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == 0xFFFF, "CFE_EVS_DisableAppEventsCmd", - "Disable application events - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, 0xFFFF); /* Test successful enabling of application events */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVT_EID, "CFE_EVS_EnableAppEventsCmd", - "Enable application events - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVT_EID); /* Test disabling event types (leave debug enabled) */ UT_InitData(); bitmaskcmd.Payload.BitMask = CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DISEVTTYPE_EID, "CFE_EVS_DisableEventTypesCmd", - "Disable event types except debug"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DISEVTTYPE_EID); /* Test enabling all event types (debug already enabled) */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAEVTTYPE_EID, "CFE_EVS_EnableEventTypesCmd", - "Enable all event types"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAEVTTYPE_EID); /* Test successfully resetting the application event counter */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_RSTEVTCNT_EID, "CFE_EVS_ResetAppEventCounterCmd", - "Reset event application counter - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTEVTCNT_EID); /* Test disabling an event type using an out of range bit mask (high) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_DisableEventTypesCmd", "Disable event types - bit mask out of range (high)"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling an event type using an out of range bit mask (high) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_EnableEventTypesCmd", "Enable event types - bit mask out of range (high)"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test disabling an application event type using an out of * range bit mask (high) @@ -1582,10 +1438,7 @@ void Test_EventCmd(void) appbitcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_DisableAppEventTypesCmd", - "Disable application event types - bit mask out of range " - "(high)"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling an application event type using an out of * range bit mask (high) @@ -1594,24 +1447,21 @@ void Test_EventCmd(void) appbitcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_EnableAppEventTypesCmd", "Enable application event types - bit mask out of range (high)"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test disabling an event type using an out of range bit mask (low) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_DisableEventTypesCmd", "Disable event types - bit mask out of range (low)"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling an event type using an out of range bit mask (low) */ UT_InitData(); bitmaskcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_EnableEventTypesCmd", "Enable event types - bit mask out of range (low)"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test disabling an application event type using an out of * range bit mask (low) @@ -1620,8 +1470,7 @@ void Test_EventCmd(void) appbitcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_DisableAppEventTypesCmd", "Disable application event types - bit mask out of range (low)"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling an application event type using an out of * range bit mask (low) @@ -1630,8 +1479,7 @@ void Test_EventCmd(void) appbitcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_INVALID_BITMASK_EID, - "CFE_EVS_EnableAppEventTypesCmd", "Enable application event types - bit mask out of range (low)"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); } /* @@ -1670,45 +1518,39 @@ void Test_FilterCmd(void) appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, - "CFE_EVS_EnableAppEventTypesCmd", "Enable all application event types - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Ensure there is no filter for the next tests */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_EVTIDNOREGS_EID, - "CFE_EVS_DeleteEventFilterCmd", "Delete event filter - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_EVTIDNOREGS_EID); /* Test setting a filter with an application that is not registered * for filtering */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_EVTIDNOREGS_EID, "CFE_EVS_SetFilterMaskCmd", - "Set filter - application is not registered for filtering"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_EVTIDNOREGS_EID); /* Test resetting a filter with an application that is not registered * for filtering */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_EVTIDNOREGS_EID, "CFE_EVS_ResetFilterCmd", - "Reset filter - application is not registered for filtering"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_EVTIDNOREGS_EID); /* Test resetting all filters */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_RSTALLFILTER_EID, "CFE_EVS_ResetAllFiltersCmd", - "Reset all filters - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTALLFILTER_EID); /* Test successfully adding an event filter */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ADDFILTER_EID, "CFE_EVS_AddEventFilterCmd", - "Add event filter - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ADDFILTER_EID); /* Test adding an event filter to an event already registered * for filtering @@ -1716,34 +1558,29 @@ void Test_FilterCmd(void) UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_EVT_FILTERED_EID, "CFE_EVS_AddEventFilterCmd", - "Add event filter - event already registered for filtering"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_EVT_FILTERED_EID); /* Test successfully setting a filter mask */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_SETFILTERMSK_EID, "CFE_EVS_SetFilterMaskCmd", - "Set filter mask - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_SETFILTERMSK_EID); /* Test successfully resetting a filter mask */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_RSTFILTER_EID, "CFE_EVS_ResetFilterCmd", - "Reset filter mask - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTFILTER_EID); /* Test successfully resetting all filters */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_RSTALLFILTER_EID, "CFE_EVS_ResetAllFiltersCmd", - "Reset all filters - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTALLFILTER_EID); /* Test successfully deleting an event filter */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DELFILTER_EID, "CFE_EVS_DeleteEventFilterCmd", - "Delete event filter - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DELFILTER_EID); /* Test filling the event filters */ UT_InitData(); @@ -1756,57 +1593,48 @@ void Test_FilterCmd(void) appmaskcmd.Payload.EventID++; } - UT_Report(__FILE__, __LINE__, - UT_EVS_EventBuf.EventID == CFE_EVS_ADDFILTER_EID && - UT_EVS_EventBuf.Count == CFE_PLATFORM_EVS_MAX_EVENT_FILTERS, - "CFE_EVS_AddEventFilterCmd", "Maximum event filters added"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ADDFILTER_EID); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.Count, CFE_PLATFORM_EVS_MAX_EVENT_FILTERS); /* Test overfilling the event filters */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_MAXREGSFILTER_EID, "CFE_EVS_AddEventFilterCmd", - "Maximum event filters exceeded"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_MAXREGSFILTER_EID); /* Return application to original state, re-register application */ UT_InitData(); appmaskcmd.Payload.EventID = 0; - UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", "Register application - successful"); + CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); /* Enable all application event message output */ UT_InitData(); appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ENAAPPEVTTYPE_EID, - "CFE_EVS_EnableAppEventTypesCmd", "Enable all application event message output"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Set-up to test filtering the same event twice */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ADDFILTER_EID, "CFE_EVS_AddEventFilterCmd", - "Add event filter - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ADDFILTER_EID); /* Test filtering the same event again */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_EVT_FILTERED_EID, "CFE_EVS_AddEventFilterCmd", - "Add event filter - event is already registered for filtering"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_EVT_FILTERED_EID); /* Test successful event filer deletion */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_DELFILTER_EID, "CFE_EVS_DeleteEventFilterCmd", - "Delete filter - successful"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DELFILTER_EID); /* Return application to original state, re-register application */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY) == CFE_SUCCESS, - "CFE_EVS_Register", "Register application - successful"); + CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); } /* @@ -1821,147 +1649,122 @@ void Test_InvalidCmd(void) /* Test invalid msg id event */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, sizeof(cmd), UT_TPID_CFE_EVS_INVALID_MID, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_MSGID_EID, "CFE_EVS_ProcessGroundCommand", - "Invalid command packet"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_MSGID_EID); /* Test invalid command code event */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, sizeof(cmd), UT_TPID_CFE_EVS_CMD_INVALID_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_ERR_CC_EID, "CFE_EVS_ProcessGroundCommand", - "Invalid command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_CC_EID); /* Test invalid command length event */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_NOOP_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with no op command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with reset counters command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_COUNTERS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with reset counters command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with enable event type command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with enable event type command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with disable event type command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with disable event type command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with set event format mode command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with set event format mode command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with enable application event * type command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with enable application event type " - "command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with disable application event * type command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with disable application event type " - "command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with enable application events command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with enable application events command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with disable application events command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with disable application events command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with reset application counter command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with reset application counter command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with set filter command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with set filter command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with enable ports command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with enable ports command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with disable ports command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with disable ports command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with reset filter command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with reset filter command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with reset all filters command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with reset all filters command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with add event filter command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with add event filter command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with delete event filter command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with delete event filter command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with write application data command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with write application data command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with write log data command */ UT_InitData(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_WRITE_LOG_DATA_FILE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with write log data command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with set log mode command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with set log mode command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with clear log command */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, UT_EVS_EventBuf.EventID == CFE_EVS_LEN_ERR_EID, "CFE_EVS_VerifyCmdLength", - "Invalid command length with clear log command"); + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); } /* @@ -1991,20 +1794,37 @@ void Test_Misc(void) CFE_EVS_Global.EVS_AppID = AppID; CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; + /* + * NOTE - events in the following tests depend on whether the debug events are enabled. + * If debug is disabled, then no event will be sent (0xFFFF). If enabled, then the event ID + * must be the expected one. + */ + /* Test successful log data file write */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&PktBuf.writelogdatacmd, sizeof(PktBuf.writelogdatacmd), UT_TPID_CFE_EVS_CMD_WRITE_LOG_DATA_FILE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, (UT_EVS_EventBuf.EventID == 0xFFFF) || (UT_EVS_EventBuf.EventID == CFE_EVS_WRLOG_EID), - "CFE_EVS_WriteLogDataFileCmd", "Write log data - successful"); + if (UT_EVS_EventBuf.EventID == 0xFFFF) + { + UtAssert_NA("No event from WRITE_LOG_DATA_FILE_CC, debug events disabled"); + } + else + { + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_WRLOG_EID); + } /* Test successfully setting the logging mode */ UT_InitData(); UT_EVS_DoDispatchCheckEvents(&PktBuf.modecmd, sizeof(PktBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); - UT_Report(__FILE__, __LINE__, - (UT_EVS_EventBuf.EventID == 0xFFFF) || (UT_EVS_EventBuf.EventID == CFE_EVS_LOGMODE_EID), - "CFE_EVS_SetLogModeCmd", "Set logging mode - successful"); + if (UT_EVS_EventBuf.EventID == 0xFFFF) + { + UtAssert_NA("No event from SET_LOG_MODE_CC, debug events disabled"); + } + else + { + UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LOGMODE_EID); + } /* Test housekeeping report with log enabled */ UT_InitData(); @@ -2012,18 +1832,15 @@ void Test_Misc(void) HK_SnapshotData.Count = 0; UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &HK_SnapshotData); UT_CallTaskPipe(CFE_EVS_ProcessCommandPacket, &PktBuf.msg, sizeof(PktBuf.cmd), UT_TPID_CFE_EVS_SEND_HK); - UT_Report(__FILE__, __LINE__, HK_SnapshotData.Count == 1, "CFE_EVS_ReportHousekeepingCmd", - "Housekeeping report - successful (log enabled)"); + UtAssert_UINT32_EQ(HK_SnapshotData.Count, 1); /* Test successful application cleanup */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_CleanUpApp(CFE_ES_APPID_UNDEFINED) == CFE_SUCCESS, "CFE_EVS_CleanUpApp", - "Application cleanup - successful"); + CFE_UtAssert_SUCCESS(CFE_EVS_CleanUpApp(CFE_ES_APPID_UNDEFINED)); /* Test registering an application with invalid filter argument */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_EVS_Register(NULL, 1, 0) == CFE_ES_BAD_ARGUMENT, "CFE_EVS_Register", - "Register application with invalid arguments"); + UtAssert_INT32_EQ(CFE_EVS_Register(NULL, 1, 0), CFE_ES_BAD_ARGUMENT); /* Test housekeeping report with log disabled */ UT_InitData(); @@ -2031,8 +1848,7 @@ void Test_Misc(void) HK_SnapshotData.Count = 0; UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &HK_SnapshotData); UT_CallTaskPipe(CFE_EVS_ProcessCommandPacket, &PktBuf.msg, sizeof(PktBuf.cmd), UT_TPID_CFE_EVS_SEND_HK); - UT_Report(__FILE__, __LINE__, HK_SnapshotData.Count == 1, "CFE_EVS_ReportHousekeepingCmd", - "Housekeeping report - successful (log disabled)"); + UtAssert_UINT32_EQ(HK_SnapshotData.Count, 1); /* Test sending a packet with the message counter and the event counter * at their maximum allowed values @@ -2041,10 +1857,8 @@ void Test_Misc(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter = CFE_EVS_MAX_EVENT_SEND_COUNT; AppDataPtr->EventCount = CFE_EVS_MAX_EVENT_SEND_COUNT; EVS_SendEvent(0, 0, "Max Event Count"); - UT_Report(__FILE__, __LINE__, - CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter == CFE_EVS_MAX_EVENT_SEND_COUNT && - AppDataPtr->EventCount == CFE_EVS_MAX_EVENT_SEND_COUNT, - "EVS_SendEvent", "Maximum message count and event count"); + UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter, CFE_EVS_MAX_EVENT_SEND_COUNT); + UtAssert_UINT32_EQ(AppDataPtr->EventCount, CFE_EVS_MAX_EVENT_SEND_COUNT); /* Test sending a message with the message length greater than the * maximum allowed value @@ -2062,6 +1876,5 @@ void Test_Misc(void) AppDataPtr->ActiveFlag = true; AppDataPtr->EventTypesActiveFlag |= CFE_EVS_INFORMATION_BIT; EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, msg); - UT_Report(__FILE__, __LINE__, CFE_EVS_Global.EVS_TlmPkt.Payload.MessageTruncCounter == 1, "EVS_SendEvent", - "Maximum message length exceeded"); + UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_TlmPkt.Payload.MessageTruncCounter, 1); } diff --git a/modules/fs/ut-coverage/fs_UT.c b/modules/fs/ut-coverage/fs_UT.c index 6d138926b..19d6f6e19 100644 --- a/modules/fs/ut-coverage/fs_UT.c +++ b/modules/fs/ut-coverage/fs_UT.c @@ -97,7 +97,11 @@ void Test_CFE_FS_InitHeader(void) /* Test initializing the header */ UT_InitData(); CFE_FS_InitHeader(&Hdr, "description", 123); - UT_Report(__FILE__, __LINE__, Hdr.SubType == 123, "CFE_FS_InitHeader", "Initialize header - successful"); + UtAssert_INT32_EQ(Hdr.SubType, 123); + + /* Test calling with NULL pointer argument (no return codes) */ + CFE_FS_InitHeader(NULL, "description", 123); + CFE_FS_InitHeader(&Hdr, NULL, 123); } /* @@ -113,15 +117,16 @@ void Test_CFE_FS_ReadHeader(void) /* Test reading the header with a lseek failure */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_lseek), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_FS_ReadHeader(&Hdr, FileDes) == OS_ERROR, "CFE_FS_ReadHeader", - "Header read lseek failed"); + UtAssert_INT32_EQ(CFE_FS_ReadHeader(&Hdr, FileDes), OS_ERROR); /* Test successfully reading the header */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_lseek), 1, OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OS_read), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_FS_ReadHeader(&Hdr, FileDes) != sizeof(CFE_FS_Header_t), "CFE_FS_ReadHeader", - "Header read - successful"); + UtAssert_INT32_EQ(CFE_FS_ReadHeader(&Hdr, FileDes), OS_ERROR); + + /* Test calling with NULL pointer argument */ + UtAssert_INT32_EQ(CFE_FS_ReadHeader(NULL, FileDes), CFE_FS_BAD_ARGUMENT); } /* @@ -137,15 +142,16 @@ void Test_CFE_FS_WriteHeader(void) /* Test writing the header with a lseek failure */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_lseek), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_FS_WriteHeader(FileDes, &Hdr) == OS_ERROR, "CFE_FS_WriteHeader", - "Header write lseek failed"); + UtAssert_INT32_EQ(CFE_FS_WriteHeader(FileDes, &Hdr), OS_ERROR); /* Test successfully writing the header */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_lseek), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(OS_write), 1, OS_SUCCESS); - UT_Report(__FILE__, __LINE__, CFE_FS_WriteHeader(FileDes, &Hdr) == OS_SUCCESS, "CFE_FS_WriteHeader", - "Header write - successful"); + UtAssert_INT32_EQ(CFE_FS_WriteHeader(FileDes, &Hdr), OS_SUCCESS); + + /* Test calling with NULL pointer argument */ + UtAssert_INT32_EQ(CFE_FS_WriteHeader(FileDes, NULL), CFE_FS_BAD_ARGUMENT); } /* @@ -161,25 +167,21 @@ void Test_CFE_FS_SetTimestamp(void) /* Test setting the time stamp with a lseek failure */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_lseek), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) == OS_ERROR, "CFE_FS_SetTimestamp", - "Failed to lseek time fields"); + UtAssert_INT32_EQ(CFE_FS_SetTimestamp(FileDes, NewTimestamp), OS_ERROR); /* Test setting the time stamp with a seconds write failure */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) != CFE_SUCCESS, "CFE_FS_SetTimestamp", - "Failed to write seconds"); + UtAssert_INT32_EQ(CFE_FS_SetTimestamp(FileDes, NewTimestamp), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Test setting the time stamp with a subeconds write failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_write), 1, 0); - UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) != CFE_SUCCESS, "CFE_FS_SetTimestamp", - "Failed to write subseconds"); + UtAssert_INT32_EQ(CFE_FS_SetTimestamp(FileDes, NewTimestamp), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Test successfully setting the time stamp */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_FS_SetTimestamp(FileDes, NewTimestamp) == CFE_SUCCESS, "CFE_FS_SetTimestamp", - "Write time stamp - successful"); + CFE_UtAssert_SUCCESS(CFE_FS_SetTimestamp(FileDes, NewTimestamp)); } /* @@ -203,11 +205,15 @@ void Test_CFE_FS_ByteSwapCFEHeader(void) /* Test byte-swapping the header values */ CFE_FS_ByteSwapCFEHeader(&Hdr); - UT_Report(__FILE__, __LINE__, - Hdr.ContentType == 0x44332211 && Hdr.SubType == 0x55443322 && Hdr.Length == 0x66554433 && - Hdr.SpacecraftID == 0x77665544 && Hdr.ProcessorID == 0x88776655 && Hdr.ApplicationID == 0x99887766 && - Hdr.TimeSeconds == 0xaa998877 && Hdr.TimeSubSeconds == 0xbbaa9988, - "CFE_FS_ByteSwapUint32", "Byte swap header - successful"); + + UtAssert_UINT32_EQ(Hdr.ContentType, 0x44332211); + UtAssert_UINT32_EQ(Hdr.SubType, 0x55443322); + UtAssert_UINT32_EQ(Hdr.Length, 0x66554433); + UtAssert_UINT32_EQ(Hdr.SpacecraftID, 0x77665544); + UtAssert_UINT32_EQ(Hdr.ProcessorID, 0x88776655); + UtAssert_UINT32_EQ(Hdr.ApplicationID, 0x99887766); + UtAssert_UINT32_EQ(Hdr.TimeSeconds, 0xaa998877); + UtAssert_UINT32_EQ(Hdr.TimeSubSeconds, 0xbbaa9988); } /* @@ -223,7 +229,7 @@ void Test_CFE_FS_ByteSwapUint32(void) /* Test byte-swapping a uint32 value */ UT_InitData(); CFE_FS_ByteSwapUint32(testptr); - UT_Report(__FILE__, __LINE__, test == 0x44332211, "CFE_FS_ByteSwapUint32", "Byte swap - successful"); + UtAssert_UINT32_EQ(test, 0x44332211); } /* @@ -242,6 +248,7 @@ void Test_CFE_FS_ParseInputFileNameEx(void) const char TEST_INPUT_NO_EXTENSION[] = "/path/to/file"; const char TEST_INPUT_BASENAME[] = "file"; const char TEST_XTRA_SEPARATOR_PATH[] = "//xtra//sep///file.log"; + const char TEST_XTRA_SEPARATOR_EXT[] = "/xtra/sep/file..log"; const char TEST_NO_SEPARATOR[] = "nosep"; const char TEST_DEFAULT_INPUT[] = "/dpath_in/dfile_in.dext_in"; const char TEST_DEFAULT_PATH[] = "/dflpath"; @@ -251,56 +258,62 @@ void Test_CFE_FS_ParseInputFileNameEx(void) /* nominal with fully-qualified input */ memset(OutBuffer, 0x7F, sizeof(OutBuffer)); - UtAssert_INT32_EQ(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_FULLY_QUALIFIED, sizeof(OutBuffer), - sizeof(TEST_INPUT_FULLY_QUALIFIED), TEST_DEFAULT_INPUT, - TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_FULLY_QUALIFIED, sizeof(OutBuffer), + sizeof(TEST_INPUT_FULLY_QUALIFIED), TEST_DEFAULT_INPUT, + TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION)); UtAssert_StrCmp(OutBuffer, TEST_INPUT_FULLY_QUALIFIED, "Fully-qualified pass thru -> %s", OutBuffer); + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_XTRA_SEPARATOR_EXT, sizeof(OutBuffer), + sizeof(TEST_XTRA_SEPARATOR_EXT) - 5, TEST_DEFAULT_INPUT, + TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION)); + CFE_UtAssert_STRINGBUF_EQ(OutBuffer, sizeof(OutBuffer), TEST_XTRA_SEPARATOR_EXT, + sizeof(TEST_XTRA_SEPARATOR_EXT) - 5); + /* Same but as a default input, rather than in the buffer */ - UtAssert_INT32_EQ(CFE_FS_ParseInputFileNameEx(OutBuffer, NULL, sizeof(OutBuffer), 0, TEST_DEFAULT_INPUT, - TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION), - CFE_SUCCESS); + /* tests 3 variations of "no input" - null ptr, zero size, empty string */ + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, NULL, sizeof(OutBuffer), 1, TEST_DEFAULT_INPUT, + TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION)); + UtAssert_StrCmp(OutBuffer, TEST_DEFAULT_INPUT, "Fully-qualified pass thru -> %s", OutBuffer); + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, "", sizeof(OutBuffer), 0, TEST_DEFAULT_INPUT, + TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION)); + UtAssert_StrCmp(OutBuffer, TEST_DEFAULT_INPUT, "Fully-qualified pass thru -> %s", OutBuffer); + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, "", sizeof(OutBuffer), 1, TEST_DEFAULT_INPUT, + TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION)); UtAssert_StrCmp(OutBuffer, TEST_DEFAULT_INPUT, "Fully-qualified pass thru -> %s", OutBuffer); /* nominal with no path input */ memset(OutBuffer, 0x7F, sizeof(OutBuffer)); - UtAssert_INT32_EQ(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_NO_PATH, sizeof(OutBuffer), - sizeof(TEST_INPUT_NO_PATH), TEST_DEFAULT_INPUT, TEST_DEFAULT_PATH, - TEST_DEFAULT_EXTENSION), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_NO_PATH, sizeof(OutBuffer), + sizeof(TEST_INPUT_NO_PATH), TEST_DEFAULT_INPUT, TEST_DEFAULT_PATH, + TEST_DEFAULT_EXTENSION)); UtAssert_StrCmp(OutBuffer, "/dflpath/file.log", "No Path input -> %s", OutBuffer); /* nominal with no path input - should remove duplicate path separators */ memset(OutBuffer, 0x7F, sizeof(OutBuffer)); - UtAssert_INT32_EQ(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_XTRA_SEPARATOR_PATH, sizeof(OutBuffer), - sizeof(TEST_XTRA_SEPARATOR_PATH), TEST_DEFAULT_INPUT, - TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_XTRA_SEPARATOR_PATH, sizeof(OutBuffer), + sizeof(TEST_XTRA_SEPARATOR_PATH), TEST_DEFAULT_INPUT, + TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION)); UtAssert_StrCmp(OutBuffer, "/xtra/sep/file.log", "No Path input, extra separators -> %s", OutBuffer); /* nominal with no extension input */ memset(OutBuffer, 0x7F, sizeof(OutBuffer)); - UtAssert_INT32_EQ(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_NO_EXTENSION, sizeof(OutBuffer), - sizeof(TEST_INPUT_NO_EXTENSION), TEST_DEFAULT_INPUT, - TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_NO_EXTENSION, sizeof(OutBuffer), + sizeof(TEST_INPUT_NO_EXTENSION), TEST_DEFAULT_INPUT, + TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION)); UtAssert_StrCmp(OutBuffer, "/path/to/file.dflext", "No Extension input -> %s", OutBuffer); /* nominal with no extension input, no separator (should be added) */ memset(OutBuffer, 0x7F, sizeof(OutBuffer)); - UtAssert_INT32_EQ(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_NO_EXTENSION, sizeof(OutBuffer), - sizeof(TEST_INPUT_NO_EXTENSION), TEST_DEFAULT_INPUT, - TEST_DEFAULT_PATH, TEST_NO_SEPARATOR), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_NO_EXTENSION, sizeof(OutBuffer), + sizeof(TEST_INPUT_NO_EXTENSION), TEST_DEFAULT_INPUT, + TEST_DEFAULT_PATH, TEST_NO_SEPARATOR)); UtAssert_StrCmp(OutBuffer, "/path/to/file.nosep", "No Extension input, no separator -> %s", OutBuffer); /* nominal with neither path nor extension input */ memset(OutBuffer, 0x7F, sizeof(OutBuffer)); - UtAssert_INT32_EQ(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_BASENAME, sizeof(OutBuffer), - sizeof(TEST_INPUT_BASENAME), TEST_DEFAULT_INPUT, TEST_DEFAULT_PATH, - TEST_DEFAULT_EXTENSION), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_BASENAME, sizeof(OutBuffer), + sizeof(TEST_INPUT_BASENAME), TEST_DEFAULT_INPUT, TEST_DEFAULT_PATH, + TEST_DEFAULT_EXTENSION)); UtAssert_StrCmp(OutBuffer, "/dflpath/file.dflext", "No Path nor Extension input -> %s", OutBuffer); /* Bad arguments for buffer pointer/size */ @@ -326,21 +339,18 @@ void Test_CFE_FS_ParseInputFileNameEx(void) /* if the default path/extension is null it is just ignored, not an error. */ memset(OutBuffer, 0x7F, sizeof(OutBuffer)); - UtAssert_INT32_EQ(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_BASENAME, sizeof(OutBuffer), - sizeof(TEST_INPUT_BASENAME), NULL, NULL, TEST_DEFAULT_EXTENSION), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_BASENAME, sizeof(OutBuffer), + sizeof(TEST_INPUT_BASENAME), NULL, NULL, TEST_DEFAULT_EXTENSION)); /* If no path this still adds a leading / */ UtAssert_StrCmp(OutBuffer, "/file.dflext", "No Path nor default -> %s", OutBuffer); - UtAssert_INT32_EQ(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_BASENAME, sizeof(OutBuffer), - sizeof(TEST_INPUT_BASENAME), NULL, TEST_DEFAULT_PATH, NULL), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_BASENAME, sizeof(OutBuffer), + sizeof(TEST_INPUT_BASENAME), NULL, TEST_DEFAULT_PATH, NULL)); UtAssert_StrCmp(OutBuffer, "/dflpath/file", "No Extension nor default -> %s", OutBuffer); /* test corner case for termination where result fits exactly, including NUL (should work) */ memset(OutBuffer, 0x7F, sizeof(OutBuffer)); - UtAssert_INT32_EQ(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_NO_PATH, 18, sizeof(TEST_INPUT_NO_PATH), NULL, - TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_NO_PATH, 18, sizeof(TEST_INPUT_NO_PATH), + NULL, TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION)); UtAssert_StrCmp(OutBuffer, "/dflpath/file.log", "Exact Length input -> %s", OutBuffer); UtAssert_INT32_EQ(OutBuffer[18], 0x7F); /* Confirm character after buffer was not touched */ @@ -360,18 +370,22 @@ void Test_CFE_FS_ParseInputFileNameEx(void) UtAssert_INT32_EQ(OutBuffer[1], 0x7F); /* test case for where input is not terminated */ + /* Test w/input truncated via size argument (not null char) */ + UtAssert_INT32_EQ(CFE_FS_ParseInputFileNameEx(OutBuffer, TEST_INPUT_FULLY_QUALIFIED, sizeof(OutBuffer), + sizeof(TEST_INPUT_FULLY_QUALIFIED) - 9, TEST_DEFAULT_INPUT, + TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION), + CFE_FS_INVALID_PATH); + /* only the specified number of chars should be used from input */ memset(OutBuffer, 0x7F, sizeof(OutBuffer)); - UtAssert_INT32_EQ(CFE_FS_ParseInputFileNameEx(OutBuffer, "abcdefgh", sizeof(OutBuffer), 4, NULL, TEST_DEFAULT_PATH, - TEST_DEFAULT_EXTENSION), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_FS_ParseInputFileNameEx(OutBuffer, "abcdefgh", sizeof(OutBuffer), 4, NULL, + TEST_DEFAULT_PATH, TEST_DEFAULT_EXTENSION)); UtAssert_StrCmp(OutBuffer, "/dflpath/abcd.dflext", "Non terminated input -> %s", OutBuffer); /* For coverage, also invoke the simplified CFE_FS_ParseInputFileName() */ /* no more error paths here, as all real logic is in CFE_FS_ParseInputFileNameEx() */ - UtAssert_INT32_EQ( - CFE_FS_ParseInputFileName(OutBuffer, TEST_INPUT_NO_EXTENSION, sizeof(OutBuffer), CFE_FS_FileCategory_TEXT_LOG), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS( + CFE_FS_ParseInputFileName(OutBuffer, TEST_INPUT_NO_EXTENSION, sizeof(OutBuffer), CFE_FS_FileCategory_TEXT_LOG)); UtAssert_StrCmp(OutBuffer, "/path/to/file.log", "Simplified API -> %s", OutBuffer); } @@ -390,55 +404,26 @@ void Test_CFE_FS_DefaultFileStrings(void) * that the returned pointer address, not the actual string content. */ - const char *Result; - - Result = CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_UNKNOWN); - UtAssert_NULL(Result); - - Result = CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_DYNAMIC_MODULE); - UtAssert_True(Result == GLOBAL_CONFIGDATA.Default_ModuleExtension, "Result (%lx) matches config (%lx)", - (unsigned long)Result, (unsigned long)GLOBAL_CONFIGDATA.Default_ModuleExtension); - - Result = CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_BINARY_DATA_DUMP); - UtAssert_NOT_NULL(Result); - - Result = CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_TEXT_LOG); - UtAssert_NOT_NULL(Result); - - Result = CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_SCRIPT); - UtAssert_NOT_NULL(Result); - - Result = CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_TEMP); - UtAssert_NOT_NULL(Result); - - Result = CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_MAX); - UtAssert_NULL(Result); - - Result = CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_UNKNOWN); - UtAssert_NULL(Result); - - Result = CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_DYNAMIC_MODULE); - UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.NonvolMountPoint, "Result (%lx) matches config (%lx)", - (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.NonvolMountPoint); - - Result = CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_BINARY_DATA_DUMP); - UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint, "Result (%lx) matches config (%lx)", - (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint); - - Result = CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_TEXT_LOG); - UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint, "Result (%lx) matches config (%lx)", - (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint); - - Result = CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_SCRIPT); - UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.NonvolMountPoint, "Result (%lx) matches config (%lx)", - (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.NonvolMountPoint); - - Result = CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_TEMP); - UtAssert_True(Result == GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint, "Result (%lx) matches config (%lx)", - (unsigned long)Result, (unsigned long)GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint); - - Result = CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_MAX); - UtAssert_NULL(Result); + UtAssert_NULL(CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_UNKNOWN)); + UtAssert_ADDRESS_EQ(CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_DYNAMIC_MODULE), + GLOBAL_CONFIGDATA.Default_ModuleExtension); + UtAssert_NOT_NULL(CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_BINARY_DATA_DUMP)); + UtAssert_NOT_NULL(CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_TEXT_LOG)); + UtAssert_NOT_NULL(CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_SCRIPT)); + UtAssert_NOT_NULL(CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_TEMP)); + UtAssert_NULL(CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_MAX)); + + UtAssert_NULL(CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_UNKNOWN)); + UtAssert_ADDRESS_EQ(CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_DYNAMIC_MODULE), + GLOBAL_CFE_CONFIGDATA.NonvolMountPoint); + UtAssert_ADDRESS_EQ(CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_BINARY_DATA_DUMP), + GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint); + UtAssert_ADDRESS_EQ(CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_TEXT_LOG), + GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint); + UtAssert_ADDRESS_EQ(CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_SCRIPT), + GLOBAL_CFE_CONFIGDATA.NonvolMountPoint); + UtAssert_ADDRESS_EQ(CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_TEMP), GLOBAL_CFE_CONFIGDATA.RamdiskMountPoint); + UtAssert_NULL(CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_MAX)); } /* @@ -459,13 +444,11 @@ void Test_CFE_FS_ExtractFileNameFromPath(void) UT_InitData(); strncpy(Original, "/cf/appslibrary.gz", sizeof(Original) - 1); Original[sizeof(Original) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_FS_ExtractFilenameFromPath("name", FileName) == CFE_FS_INVALID_PATH, - "CFE_FS_ExtractFilenameFromPath", "Missing file path"); + UtAssert_INT32_EQ(CFE_FS_ExtractFilenameFromPath("name", FileName), CFE_FS_INVALID_PATH); /* Test extracting the file name from a path that's null */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_FS_ExtractFilenameFromPath(NULL, FileName) == CFE_FS_BAD_ARGUMENT, - "CFE_FS_ExtractFilenameFromPath", "Null name"); + UtAssert_INT32_EQ(CFE_FS_ExtractFilenameFromPath(NULL, FileName), CFE_FS_BAD_ARGUMENT); /* Test extracting the file name from a path/file name that's too long */ UT_InitData(); @@ -478,18 +461,15 @@ void Test_CFE_FS_ExtractFileNameFromPath(void) strcat(LongFileName, ".gz"); - UT_Report(__FILE__, __LINE__, CFE_FS_ExtractFilenameFromPath(LongFileName, FileName) == CFE_FS_FNAME_TOO_LONG, - "CFE_FS_ExtractFilenameFromPath", "Path/file name too long"); + UtAssert_INT32_EQ(CFE_FS_ExtractFilenameFromPath(LongFileName, FileName), CFE_FS_FNAME_TOO_LONG); /* Test successfully extracting the file name from a path/file name */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_FS_ExtractFilenameFromPath(Original, FileName) == CFE_SUCCESS, - "CFE_FS_ExtractFilenameFromPath", "Extract path name - successful"); + CFE_UtAssert_SUCCESS(CFE_FS_ExtractFilenameFromPath(Original, FileName)); /* Test extracting the file name from a file name that's null */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_FS_ExtractFilenameFromPath(Original, NULL) == CFE_FS_BAD_ARGUMENT, - "CFE_FS_ExtractFilenameFromPath", "Null file name"); + UtAssert_INT32_EQ(CFE_FS_ExtractFilenameFromPath(Original, NULL), CFE_FS_BAD_ARGUMENT); } /* @@ -501,41 +481,36 @@ void Test_CFE_FS_Private(void) /* Test successful FS initialization */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_FS_EarlyInit() == CFE_SUCCESS, "CFE_FS_EarlyInit", - "FS initialization - successful"); + CFE_UtAssert_SUCCESS(CFE_FS_EarlyInit()); /* Test FS initialization with a mutex creation failure */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_MutSemCreate), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_FS_EarlyInit() == -1, "CFE_FS_EarlyInit", "Mutex creation failure"); + UtAssert_INT32_EQ(CFE_FS_EarlyInit(), OS_ERROR); /* Test successful locking of shared data */ UT_InitData(); CFE_FS_LockSharedData("FunctionName"); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 0, "CFE_FS_LockSharedData", - "Lock shared data - successful"); + UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 0); /* Test locking of shared data with a mutex take error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, -1); CFE_FS_LockSharedData("FunctionName"); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(FS_SYSLOG_MSGS[1]) && UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1, - "CFE_FS_LockSharedData", "Shared data mutex take error"); + CFE_UtAssert_SYSLOG(FS_SYSLOG_MSGS[1]); + UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1); /* Test successful unlocking of shared data */ UT_InitData(); CFE_FS_UnlockSharedData("FunctionName"); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 0, "CFE_FS_UnlockSharedData", - "Unlock shared data - successful"); + UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 0); /* Test unlocking of shared data with a mutex give error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemGive), 1, -1); CFE_FS_UnlockSharedData("FunctionName"); - UT_Report(__FILE__, __LINE__, - UT_SyslogIsInHistory(FS_SYSLOG_MSGS[2]) && UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1, - "CFE_FS_UnlockSharedData", "SharedData mutex give error"); + CFE_UtAssert_SYSLOG(FS_SYSLOG_MSGS[2]); + UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1); UtPrintf("End Test Private\n"); } @@ -548,52 +523,48 @@ void Test_CFE_FS_BackgroundFileDump(void) */ CFE_FS_FileWriteMetaData_t State; uint32 MyBuffer[2]; - int32 Status; + uint32 i; memset(UT_FS_FileWriteEventCount, 0, sizeof(UT_FS_FileWriteEventCount)); memset(&State, 0, sizeof(State)); memset(&CFE_FS_Global.FileDump, 0, sizeof(CFE_FS_Global.FileDump)); /* Nominal with nothing pending - should accumulate credit */ - UtAssert_True(!CFE_FS_RunBackgroundFileDump(1, NULL), - "CFE_FS_RunBackgroundFileDump() nothing pending, short delay"); - UtAssert_True(CFE_FS_Global.FileDump.Current.Credit > 0, "Credit accumulating (%lu)", - (unsigned long)CFE_FS_Global.FileDump.Current.Credit); - UtAssert_True(CFE_FS_Global.FileDump.Current.Credit < CFE_FS_BACKGROUND_MAX_CREDIT, "Credit not max (%lu)", - (unsigned long)CFE_FS_Global.FileDump.Current.Credit); - - UtAssert_True(!CFE_FS_RunBackgroundFileDump(100000, NULL), - "CFE_FS_RunBackgroundFileDump() nothing pending, long delay"); - UtAssert_True(CFE_FS_Global.FileDump.Current.Credit == CFE_FS_BACKGROUND_MAX_CREDIT, "Credit at max (%lu)", - (unsigned long)CFE_FS_Global.FileDump.Current.Credit); - - Status = CFE_FS_BackgroundFileDumpRequest(NULL); - UtAssert_True(Status == CFE_FS_BAD_ARGUMENT, "CFE_FS_BackgroundFileDumpRequest(NULL) (%lu) == CFE_FS_BAD_ARGUMENT", - (unsigned long)Status); - Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_FS_BAD_ARGUMENT, - "CFE_FS_BackgroundFileDumpRequest(&State) (%lu) == CFE_FS_BAD_ARGUMENT", (unsigned long)Status); - UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(&State), "!CFE_FS_BackgroundFileDumpIsPending(&State)"); + CFE_UtAssert_FALSE(CFE_FS_RunBackgroundFileDump(1, NULL)); + CFE_UtAssert_ATLEAST(CFE_FS_Global.FileDump.Current.Credit, 1); + CFE_UtAssert_ATMOST(CFE_FS_Global.FileDump.Current.Credit, CFE_FS_BACKGROUND_MAX_CREDIT); + + CFE_UtAssert_FALSE(CFE_FS_RunBackgroundFileDump(100000, NULL)); + UtAssert_INT32_EQ(CFE_FS_Global.FileDump.Current.Credit, CFE_FS_BACKGROUND_MAX_CREDIT); + + UtAssert_INT32_EQ(CFE_FS_BackgroundFileDumpRequest(NULL), CFE_FS_BAD_ARGUMENT); + + /* Set each of the callback args individually NULL */ + State.GetData = UT_FS_DataGetter; + State.OnEvent = NULL; + UtAssert_INT32_EQ(CFE_FS_BackgroundFileDumpRequest(&State), CFE_FS_BAD_ARGUMENT); + + State.GetData = NULL; + State.OnEvent = UT_FS_OnEvent; + UtAssert_INT32_EQ(CFE_FS_BackgroundFileDumpRequest(&State), CFE_FS_BAD_ARGUMENT); + + CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); UtAssert_STUB_COUNT(CFE_ES_BackgroundWakeup, 0); /* confirm CFE_ES_BackgroundWakeup() was not invoked */ /* Set the data except file name and description */ State.FileSubType = 2; State.GetData = UT_FS_DataGetter; State.OnEvent = UT_FS_OnEvent; - Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_FS_INVALID_PATH, - "CFE_FS_BackgroundFileDumpRequest(&State) (%lu) == CFE_FS_INVALID_PATH", (unsigned long)Status); - UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(&State), "!CFE_FS_BackgroundFileDumpIsPending(&State)"); + UtAssert_INT32_EQ(CFE_FS_BackgroundFileDumpRequest(&State), CFE_FS_INVALID_PATH); + CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); UtAssert_STUB_COUNT(CFE_ES_BackgroundWakeup, 0); /* confirm CFE_ES_BackgroundWakeup() was not invoked */ /* Set up remainder of fields, so entry is valid */ strncpy(State.FileName, "/ram/UT.bin", sizeof(State.FileName)); strncpy(State.Description, "UT", sizeof(State.Description)); - Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", - (unsigned long)Status); - UtAssert_True(CFE_FS_BackgroundFileDumpIsPending(&State), "CFE_FS_BackgroundFileDumpIsPending(&State)"); + CFE_UtAssert_SUCCESS(CFE_FS_BackgroundFileDumpRequest(&State)); + CFE_UtAssert_TRUE(CFE_FS_BackgroundFileDumpIsPending(&State)); UtAssert_STUB_COUNT(CFE_ES_BackgroundWakeup, 1); /* confirm CFE_ES_BackgroundWakeup() was invoked */ /* @@ -603,88 +574,83 @@ void Test_CFE_FS_BackgroundFileDump(void) MyBuffer[0] = 10; MyBuffer[1] = 20; UT_SetDataBuffer(UT_KEY(UT_FS_DataGetter), MyBuffer, sizeof(MyBuffer), false); - UtAssert_True(CFE_FS_RunBackgroundFileDump(1, NULL), "CFE_FS_RunBackgroundFileDump() request pending nominal"); + CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(1, NULL)); UtAssert_STUB_COUNT(OS_OpenCreate, 1); /* confirm OS_open() was invoked */ - UtAssert_True(CFE_FS_Global.FileDump.Current.Credit <= 0, "Credit exhausted (%lu)", - (unsigned long)CFE_FS_Global.FileDump.Current.Credit); + CFE_UtAssert_ATMOST(CFE_FS_Global.FileDump.Current.Credit, 0); UtAssert_STUB_COUNT(OS_close, 0); /* confirm OS_close() was not invoked */ UT_SetDeferredRetcode(UT_KEY(UT_FS_DataGetter), 2, true); /* return EOF */ - UtAssert_True(!CFE_FS_RunBackgroundFileDump(100, NULL), "CFE_FS_RunBackgroundFileDump() request pending EOF"); + CFE_UtAssert_FALSE(CFE_FS_RunBackgroundFileDump(100, NULL)); UtAssert_STUB_COUNT(OS_OpenCreate, 1); /* confirm OS_open() was not invoked again */ UtAssert_STUB_COUNT(OS_close, 1); /* confirm OS_close() was invoked */ - UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, - CFE_FS_Global.FileDump.RequestCount); /* request was completed */ - UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_COMPLETE], 1); /* complete event was sent */ - UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(&State), "!CFE_FS_BackgroundFileDumpIsPending(&State)"); + /* No more pending requests */ + UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, CFE_FS_Global.FileDump.RequestCount); + /* complete event was sent */ + UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_COMPLETE], 1); + CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); UT_ResetState(UT_KEY(UT_FS_DataGetter)); /* Error opening file */ - Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", - (unsigned long)Status); + CFE_UtAssert_SETUP(CFE_FS_BackgroundFileDumpRequest(&State)); UT_SetDeferredRetcode(UT_KEY(OS_OpenCreate), 1, OS_ERROR); - UtAssert_True(CFE_FS_RunBackgroundFileDump(100, NULL), - "CFE_FS_RunBackgroundFileDump() request pending, file open error"); + CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_CREATE_ERROR], 1); /* create error event was sent */ - UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(&State), "!CFE_FS_BackgroundFileDumpIsPending(&State)"); - UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, - CFE_FS_Global.FileDump.RequestCount); /* request was completed */ + CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); + /* No more pending requests */ + UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, CFE_FS_Global.FileDump.RequestCount); /* Error writing header */ - Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", - (unsigned long)Status); + CFE_UtAssert_SETUP(CFE_FS_BackgroundFileDumpRequest(&State)); UT_SetDeferredRetcode(UT_KEY(OS_write), 1, OS_ERROR); - UtAssert_True(CFE_FS_RunBackgroundFileDump(100, NULL), - "CFE_FS_RunBackgroundFileDump() request pending, file write header error"); + CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR], 1); /* header error event was sent */ - UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(&State), "!CFE_FS_BackgroundFileDumpIsPending(&State)"); - UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, - CFE_FS_Global.FileDump.RequestCount); /* request was completed */ + CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); + /* No more pending requests */ + UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, CFE_FS_Global.FileDump.RequestCount); /* Error writing data */ - Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", - (unsigned long)Status); + CFE_UtAssert_SETUP(CFE_FS_BackgroundFileDumpRequest(&State)); UT_SetDeferredRetcode(UT_KEY(OS_write), 2, OS_ERROR); UT_SetDataBuffer(UT_KEY(UT_FS_DataGetter), MyBuffer, sizeof(MyBuffer), false); - UtAssert_True(CFE_FS_RunBackgroundFileDump(100, NULL), - "CFE_FS_RunBackgroundFileDump() request pending, file write data error"); - UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR], - 1); /* record error event was sent */ - UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(&State), "!CFE_FS_BackgroundFileDumpIsPending(&State)"); - UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, - CFE_FS_Global.FileDump.RequestCount); /* request was completed */ + CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); + /* record error event was sent */ + UtAssert_UINT32_EQ(UT_FS_FileWriteEventCount[CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR], 1); + CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(&State)); + /* No more pending requests */ + UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.CompleteCount, CFE_FS_Global.FileDump.RequestCount); UT_ResetState(UT_KEY(UT_FS_DataGetter)); /* Request multiple file dumps, check queing logic */ - Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_SUCCESS, "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_SUCCESS", - (unsigned long)Status); - Status = CFE_FS_BackgroundFileDumpRequest(&State); - UtAssert_True(Status == CFE_STATUS_REQUEST_ALREADY_PENDING, - "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_STATUS_REQUEST_ALREADY_PENDING", - (unsigned long)Status); - - do + CFE_UtAssert_SETUP(CFE_FS_BackgroundFileDumpRequest(&State)); + UtAssert_INT32_EQ(CFE_FS_BackgroundFileDumpRequest(&State), CFE_STATUS_REQUEST_ALREADY_PENDING); + + for (i = 0; i < (CFE_FS_MAX_BACKGROUND_FILE_WRITES - 2); ++i) { State.IsPending = false; /* UT hack to fill queue - Force not pending. Real code should not do this. */ - Status = CFE_FS_BackgroundFileDumpRequest(&State); - } while (Status == CFE_SUCCESS); + CFE_UtAssert_SETUP(CFE_FS_BackgroundFileDumpRequest(&State)); + } - UtAssert_True(Status == CFE_STATUS_REQUEST_ALREADY_PENDING, - "CFE_FS_BackgroundFileDumpRequest() (%lu) == CFE_STATUS_REQUEST_ALREADY_PENDING", - (unsigned long)Status); + State.IsPending = false; + UtAssert_INT32_EQ(CFE_FS_BackgroundFileDumpRequest(&State), CFE_STATUS_REQUEST_ALREADY_PENDING); UtAssert_UINT32_EQ(CFE_FS_Global.FileDump.RequestCount, (CFE_FS_Global.FileDump.CompleteCount + CFE_FS_MAX_BACKGROUND_FILE_WRITES - 1)); /* Confirm null arg handling in CFE_FS_BackgroundFileDumpIsPending() */ - UtAssert_True(!CFE_FS_BackgroundFileDumpIsPending(NULL), "!CFE_FS_BackgroundFileDumpIsPending(NULL)"); + CFE_UtAssert_FALSE(CFE_FS_BackgroundFileDumpIsPending(NULL)); + + /* this catches the branch where Meta->IsPending is false */ + CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); + CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); + CFE_UtAssert_TRUE(CFE_FS_RunBackgroundFileDump(100, NULL)); + CFE_UtAssert_FALSE(CFE_FS_RunBackgroundFileDump(100, NULL)); + + CFE_UtAssert_SETUP(CFE_FS_BackgroundFileDumpRequest(&State)); + UT_SetDeferredRetcode(UT_KEY(UT_FS_DataGetter), 2, true); /* avoid infinite loop */ + CFE_UtAssert_FALSE(CFE_FS_RunBackgroundFileDump(100, NULL)); } diff --git a/modules/fs/ut-coverage/fs_UT.h b/modules/fs/ut-coverage/fs_UT.h index e7f1fd747..fe823aeca 100644 --- a/modules/fs/ut-coverage/fs_UT.h +++ b/modules/fs/ut-coverage/fs_UT.h @@ -77,7 +77,7 @@ void Test_CFE_FS_API(void); ** \returns ** This function does not return a value. ** -** \sa #UT_Report, #CFE_FS_InitHeader +** \sa #CFE_FS_InitHeader ** ******************************************************************************/ void Test_CFE_FS_InitHeader(void); @@ -95,7 +95,7 @@ void Test_CFE_FS_InitHeader(void); ** \returns ** This function does not return a value. ** -** \sa #UT_InitData, #UT_SetOSFail, #UT_Report, #CFE_FS_ReadHeader, +** \sa #UT_InitData, #UT_SetOSFail, #CFE_FS_ReadHeader, ** \sa #UT_SetRtnCode ** ******************************************************************************/ @@ -114,7 +114,7 @@ void Test_CFE_FS_ReadHeader(void); ** \returns ** This function does not return a value. ** -** \sa #UT_InitData, #UT_SetOSFail, #UT_Report, #CFE_FS_WriteHeader, +** \sa #UT_InitData, #UT_SetOSFail, #CFE_FS_WriteHeader, ** \sa #UT_SetRtnCode ** ******************************************************************************/ @@ -149,7 +149,7 @@ void Test_CFE_FS_DefaultFileStrings(void); ** \returns ** This function does not return a value. ** -** \sa #UT_InitData, #UT_SetOSFail, #UT_Report, #CFE_FS_SetTimestamp, +** \sa #UT_InitData, #UT_SetOSFail, #CFE_FS_SetTimestamp, ** \sa #UT_SetRtnCode ** ******************************************************************************/ @@ -168,7 +168,7 @@ void Test_CFE_FS_SetTimestamp(void); ** \returns ** This function does not return a value. ** -** \sa #UT_InitData, #CFE_FS_ByteSwapCFEHeader, #UT_Report +** \sa #UT_InitData, #CFE_FS_ByteSwapCFEHeader ** ******************************************************************************/ void Test_CFE_FS_ByteSwapCFEHeader(void); @@ -186,7 +186,7 @@ void Test_CFE_FS_ByteSwapCFEHeader(void); ** \returns ** This function does not return a value. ** -** \sa #UT_InitData, #CFE_FS_ByteSwapUint32, #UT_Report +** \sa #UT_InitData, #CFE_FS_ByteSwapUint32 ** ******************************************************************************/ void Test_CFE_FS_ByteSwapUint32(void); @@ -204,7 +204,7 @@ void Test_CFE_FS_ByteSwapUint32(void); ** \returns ** This function does not return a value. ** -** \sa #UT_InitData, #UT_Report, #CFE_FS_IsGzFile +** \sa #UT_InitData, #CFE_FS_IsGzFile ** ******************************************************************************/ void Test_CFE_FS_IsGzFile(void); @@ -222,7 +222,7 @@ void Test_CFE_FS_IsGzFile(void); ** \returns ** This function does not return a value. ** -** \sa #UT_InitData, #UT_Report, #CFE_FS_ParseInputFileName +** \sa #UT_InitData, #CFE_FS_ParseInputFileName ** ******************************************************************************/ void Test_CFE_FS_ParseInputFileNameEx(void); @@ -240,7 +240,7 @@ void Test_CFE_FS_ParseInputFileNameEx(void); ** \returns ** This function does not return a value. ** -** \sa #UT_InitData, #UT_Report, #CFE_FS_ExtractFilenameFromPath +** \sa #UT_InitData, #CFE_FS_ExtractFilenameFromPath ** ******************************************************************************/ void Test_CFE_FS_ExtractFileNameFromPath(void); @@ -258,7 +258,7 @@ void Test_CFE_FS_ExtractFileNameFromPath(void); ** \returns ** This function does not return a value. ** -** \sa #UT_InitData, #UT_Report, #CFE_FS_EarlyInit, +** \sa #UT_InitData, #CFE_FS_EarlyInit, ** \sa #CFE_FS_LockSharedData, #UT_SetRtnCode, #CFE_FS_UnlockSharedData ** ******************************************************************************/ @@ -278,7 +278,7 @@ void Test_CFE_FS_Private(void); ** \returns ** This function does not return a value. ** -** \sa #UT_InitData, #UT_SetOSFail, #UT_Report, #CFE_FS_Decompress, +** \sa #UT_InitData, #UT_SetOSFail, #CFE_FS_Decompress, ** \sa #UT_SetReadBuffer, #FS_gz_inflate_fixed, #FS_gz_inflate_stored, ** \sa #FS_gz_fill_inbuf, #FS_gz_flush_window ** diff --git a/modules/msg/ut-coverage/test_cfe_msg_ccsdsext.c b/modules/msg/ut-coverage/test_cfe_msg_ccsdsext.c index 5a2ff4d45..146b34cab 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_ccsdsext.c +++ b/modules/msg/ut-coverage/test_cfe_msg_ccsdsext.c @@ -61,8 +61,8 @@ void Test_MSG_Init_Ext(void) /* Get msgid version by checking if msgid sets "has secondary" field*/ memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0)), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetHasSecondaryHeader(&msg, &hassec), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0))); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &hassec)); is_v1 = !hassec; /* Set up return */ @@ -71,67 +71,67 @@ void Test_MSG_Init_Ext(void) UtPrintf("Set to all F's, msgid value = 0"); memset(&msg, 0xFF, sizeof(msg)); msgidval_exp = 0; - CFE_UtAssert_EQUAL(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg)), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg))); UT_DisplayPkt(&msg, 0); /* Default EDS version check */ - CFE_UtAssert_EQUAL(CFE_MSG_GetEDSVersion(&msg, &edsver), CFE_SUCCESS); - CFE_UtAssert_EQUAL(edsver, CFE_PLATFORM_EDSVER); + CFE_UtAssert_SUCCESS(CFE_MSG_GetEDSVersion(&msg, &edsver)); + UtAssert_INT32_EQ(edsver, CFE_PLATFORM_EDSVER); /* Default subsystem check */ - CFE_UtAssert_EQUAL(CFE_MSG_GetSubsystem(&msg, &subsys), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSubsystem(&msg, &subsys)); if (is_v1) - CFE_UtAssert_EQUAL(subsys, CFE_PLATFORM_DEFAULT_SUBSYS); + UtAssert_INT32_EQ(subsys, CFE_PLATFORM_DEFAULT_SUBSYS); else - CFE_UtAssert_EQUAL(subsys, CFE_PLATFORM_DEFAULT_SUBSYS & TEST_DEFAULT_SUBSYS_MASK); + UtAssert_INT32_EQ(subsys, CFE_PLATFORM_DEFAULT_SUBSYS & TEST_DEFAULT_SUBSYS_MASK); /* Default system check */ - CFE_UtAssert_EQUAL(CFE_MSG_GetSystem(&msg, &system), CFE_SUCCESS); - CFE_UtAssert_EQUAL(system, sc_id); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSystem(&msg, &system)); + UtAssert_INT32_EQ(system, sc_id); /* Default endian check */ - CFE_UtAssert_EQUAL(CFE_MSG_GetEndian(&msg, &endian), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetEndian(&msg, &endian)); #if (CFE_PLATFORM_ENDIAN == CCSDS_LITTLE_ENDIAN) - CFE_UtAssert_EQUAL(endian, CFE_MSG_Endian_Little); + UtAssert_INT32_EQ(endian, CFE_MSG_Endian_Little); #else - CFE_UtAssert_EQUAL(endian, CFE_MSG_Endian_Big); + UtAssert_INT32_EQ(endian, CFE_MSG_Endian_Big); #endif /* Confirm the rest of the fields not already explicitly checked */ - CFE_UtAssert_EQUAL( + UtAssert_INT32_EQ( Test_MSG_Ext_NotZero(&msg) & ~(MSG_EDSVER_FLAG | MSG_ENDIAN_FLAG | MSG_SUBSYS_FLAG | MSG_SYSTEM_FLAG), 0); UtPrintf("Set to all 0, max msgid value"); memset(&msg, 0, sizeof(msg)); msgidval_exp = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID; - CFE_UtAssert_EQUAL(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg)), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg))); UT_DisplayPkt(&msg, 0); /* Default EDS version check */ - CFE_UtAssert_EQUAL(CFE_MSG_GetEDSVersion(&msg, &edsver), CFE_SUCCESS); - CFE_UtAssert_EQUAL(edsver, CFE_PLATFORM_EDSVER); + CFE_UtAssert_SUCCESS(CFE_MSG_GetEDSVersion(&msg, &edsver)); + UtAssert_INT32_EQ(edsver, CFE_PLATFORM_EDSVER); /* Default system check */ - CFE_UtAssert_EQUAL(CFE_MSG_GetSystem(&msg, &system), CFE_SUCCESS); - CFE_UtAssert_EQUAL(system, sc_id); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSystem(&msg, &system)); + UtAssert_INT32_EQ(system, sc_id); /* Default endian check */ - CFE_UtAssert_EQUAL(CFE_MSG_GetEndian(&msg, &endian), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetEndian(&msg, &endian)); #if (CFE_PLATFORM_ENDIAN == CCSDS_LITTLE_ENDIAN) - CFE_UtAssert_EQUAL(endian, CFE_MSG_Endian_Little); + UtAssert_INT32_EQ(endian, CFE_MSG_Endian_Little); #else - CFE_UtAssert_EQUAL(endian, CFE_MSG_Endian_Big); + UtAssert_INT32_EQ(endian, CFE_MSG_Endian_Big); #endif /* Default subsystem check */ - CFE_UtAssert_EQUAL(CFE_MSG_GetSubsystem(&msg, &subsys), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSubsystem(&msg, &subsys)); if (is_v1) - CFE_UtAssert_EQUAL(subsys, CFE_PLATFORM_DEFAULT_SUBSYS); + UtAssert_INT32_EQ(subsys, CFE_PLATFORM_DEFAULT_SUBSYS); else - CFE_UtAssert_EQUAL(subsys, CFE_PLATFORM_DEFAULT_SUBSYS | ((msgidval_exp >> 8) & 0xFF)); + UtAssert_INT32_EQ(subsys, CFE_PLATFORM_DEFAULT_SUBSYS | ((msgidval_exp >> 8) & 0xFF)); /* Confirm the rest of the fields not already explicitly checked */ - CFE_UtAssert_EQUAL( + UtAssert_INT32_EQ( Test_MSG_Ext_NotZero(&msg) & ~(MSG_EDSVER_FLAG | MSG_ENDIAN_FLAG | MSG_SUBSYS_FLAG | MSG_SYSTEM_FLAG), 0); } @@ -144,33 +144,33 @@ void Test_MSG_EDSVersion(void) UtPrintf("Bad parameter tests, Null pointers and invalid (max valid + 1, max)"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetEDSVersion(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, TEST_EDSVER_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_GetEDSVersion(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetEDSVersion(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetEDSVersion(&msg, TEST_EDSVER_MAX + 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetEDSVersion(&msg, 0xFFFF), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetEDSVersion(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(actual, TEST_EDSVER_MAX); + UtAssert_INT32_EQ(CFE_MSG_GetEDSVersion(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetEDSVersion(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetEDSVersion(&msg, TEST_EDSVER_MAX + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetEDSVersion(&msg, 0xFFFF), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set to all F's, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetEDSVersion(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, TEST_EDSVER_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_SetEDSVersion(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetEDSVersion(&msg, &actual)); + UtAssert_INT32_EQ(actual, TEST_EDSVER_MAX); + CFE_UtAssert_SUCCESS(CFE_MSG_SetEDSVersion(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetEDSVersion(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetEDSVersion(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == TEST_EDSVER_MAX) { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_EDSVER_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_EDSVER_FLAG); } } @@ -178,19 +178,19 @@ void Test_MSG_EDSVersion(void) for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetEDSVersion(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetEDSVersion(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetEDSVersion(&msg, &actual)); + UtAssert_INT32_EQ(actual, 0); + CFE_UtAssert_SUCCESS(CFE_MSG_SetEDSVersion(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetEDSVersion(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetEDSVersion(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == 0) { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_EDSVER_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_EDSVER_FLAG); } } } @@ -204,33 +204,33 @@ void Test_MSG_Endian(void) UtPrintf("Bad parameter tests, Null pointers and invalid (CFE_MSG_Endian_Invalid, CFE_MSG_Endian_Little + 1"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetEndian(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, 0); - CFE_UtAssert_EQUAL(CFE_MSG_GetEndian(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetEndian(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetEndian(&msg, CFE_MSG_Endian_Invalid), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetEndian(&msg, CFE_MSG_Endian_Little + 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetEndian(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(actual, 0); + UtAssert_INT32_EQ(CFE_MSG_GetEndian(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetEndian(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetEndian(&msg, CFE_MSG_Endian_Invalid), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetEndian(&msg, CFE_MSG_Endian_Little + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set to all F's, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetEndian(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, CFE_MSG_Endian_Little); - CFE_UtAssert_EQUAL(CFE_MSG_SetEndian(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetEndian(&msg, &actual)); + UtAssert_INT32_EQ(actual, CFE_MSG_Endian_Little); + CFE_UtAssert_SUCCESS(CFE_MSG_SetEndian(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetEndian(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetEndian(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == CFE_MSG_Endian_Little) { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_ENDIAN_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_ENDIAN_FLAG); } } @@ -238,19 +238,19 @@ void Test_MSG_Endian(void) for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetEndian(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, CFE_MSG_Endian_Big); - CFE_UtAssert_EQUAL(CFE_MSG_SetEndian(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetEndian(&msg, &actual)); + UtAssert_INT32_EQ(actual, CFE_MSG_Endian_Big); + CFE_UtAssert_SUCCESS(CFE_MSG_SetEndian(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetEndian(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetEndian(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == CFE_MSG_Endian_Big) { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_ENDIAN_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_ENDIAN_FLAG); } } } @@ -264,33 +264,33 @@ void Test_MSG_PlaybackFlag(void) UtPrintf("Bad parameter tests, Null pointers and invalid (CFE_MSG_PlayFlag_Invalid, CFE_MSG_PlayFlag_Playback + 1"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetPlaybackFlag(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, 0); - CFE_UtAssert_EQUAL(CFE_MSG_GetPlaybackFlag(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetPlaybackFlag(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetPlaybackFlag(&msg, CFE_MSG_PlayFlag_Invalid), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetPlaybackFlag(&msg, CFE_MSG_PlayFlag_Playback + 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetPlaybackFlag(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(actual, 0); + UtAssert_INT32_EQ(CFE_MSG_GetPlaybackFlag(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetPlaybackFlag(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetPlaybackFlag(&msg, CFE_MSG_PlayFlag_Invalid), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetPlaybackFlag(&msg, CFE_MSG_PlayFlag_Playback + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set to all F's, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetPlaybackFlag(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, CFE_MSG_PlayFlag_Playback); - CFE_UtAssert_EQUAL(CFE_MSG_SetPlaybackFlag(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetPlaybackFlag(&msg, &actual)); + UtAssert_INT32_EQ(actual, CFE_MSG_PlayFlag_Playback); + CFE_UtAssert_SUCCESS(CFE_MSG_SetPlaybackFlag(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetPlaybackFlag(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetPlaybackFlag(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == CFE_MSG_PlayFlag_Playback) { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_PBACK_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_PBACK_FLAG); } } @@ -298,19 +298,19 @@ void Test_MSG_PlaybackFlag(void) for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetPlaybackFlag(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, CFE_MSG_PlayFlag_Original); - CFE_UtAssert_EQUAL(CFE_MSG_SetPlaybackFlag(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetPlaybackFlag(&msg, &actual)); + UtAssert_INT32_EQ(actual, CFE_MSG_PlayFlag_Original); + CFE_UtAssert_SUCCESS(CFE_MSG_SetPlaybackFlag(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetPlaybackFlag(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetPlaybackFlag(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == CFE_MSG_PlayFlag_Original) { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_PBACK_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_PBACK_FLAG); } } } @@ -324,33 +324,33 @@ void Test_MSG_Subsystem(void) UtPrintf("Bad parameter tests, Null pointers and invalid (max valid + 1, max)"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSubsystem(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, TEST_SUBSYS_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_GetSubsystem(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSubsystem(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetSubsystem(&msg, TEST_SUBSYS_MAX + 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSubsystem(&msg, 0xFFFF), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetSubsystem(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(actual, TEST_SUBSYS_MAX); + UtAssert_INT32_EQ(CFE_MSG_GetSubsystem(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetSubsystem(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetSubsystem(&msg, TEST_SUBSYS_MAX + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetSubsystem(&msg, 0xFFFF), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set to all F's, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSubsystem(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, TEST_SUBSYS_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_SetSubsystem(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSubsystem(&msg, &actual)); + UtAssert_INT32_EQ(actual, TEST_SUBSYS_MAX); + CFE_UtAssert_SUCCESS(CFE_MSG_SetSubsystem(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSubsystem(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSubsystem(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == TEST_SUBSYS_MAX) { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_SUBSYS_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_SUBSYS_FLAG); } } @@ -358,19 +358,19 @@ void Test_MSG_Subsystem(void) for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSubsystem(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSubsystem(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSubsystem(&msg, &actual)); + UtAssert_INT32_EQ(actual, 0); + CFE_UtAssert_SUCCESS(CFE_MSG_SetSubsystem(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSubsystem(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSubsystem(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == 0) { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_SUBSYS_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_SUBSYS_FLAG); } } } @@ -384,30 +384,30 @@ void Test_MSG_System(void) UtPrintf("Bad parameter tests, Null pointers"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSystem(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, TEST_SYSTEM_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_GetSystem(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSystem(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetSystem(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(actual, TEST_SYSTEM_MAX); + UtAssert_INT32_EQ(CFE_MSG_GetSystem(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetSystem(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set to all F's, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSystem(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, TEST_SYSTEM_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_SetSystem(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSystem(&msg, &actual)); + UtAssert_INT32_EQ(actual, TEST_SYSTEM_MAX); + CFE_UtAssert_SUCCESS(CFE_MSG_SetSystem(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSystem(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSystem(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == TEST_SYSTEM_MAX) { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_SYSTEM_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_SYSTEM_FLAG); } } @@ -415,19 +415,19 @@ void Test_MSG_System(void) for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSystem(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSystem(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSystem(&msg, &actual)); + UtAssert_INT32_EQ(actual, 0); + CFE_UtAssert_SUCCESS(CFE_MSG_SetSystem(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSystem(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSystem(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == 0) { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_SYSTEM_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_SYSTEM_FLAG); } } } diff --git a/modules/msg/ut-coverage/test_cfe_msg_ccsdspri.c b/modules/msg/ut-coverage/test_cfe_msg_ccsdspri.c index a98244e45..4bafd46ad 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_ccsdspri.c +++ b/modules/msg/ut-coverage/test_cfe_msg_ccsdspri.c @@ -50,37 +50,37 @@ void Test_MSG_Size(void) UtPrintf("Bad parameter tests, Null pointers and invalid (0, min valid - 1, max valid + 1, max)"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSize(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, 0); - CFE_UtAssert_EQUAL(CFE_MSG_GetSize(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSize(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetSize(&msg, 0), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSize(&msg, TEST_MSG_SIZE_OFFSET - 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSize(&msg, 0xFFFF + TEST_MSG_SIZE_OFFSET + 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSize(&msg, 0xFFFFFFFF), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetSize(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(actual, 0); + UtAssert_INT32_EQ(CFE_MSG_GetSize(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetSize(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetSize(&msg, 0), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetSize(&msg, TEST_MSG_SIZE_OFFSET - 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetSize(&msg, 0xFFFF + TEST_MSG_SIZE_OFFSET + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetSize(&msg, 0xFFFFFFFF), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set to all F's, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSize(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, 0xFFFF + TEST_MSG_SIZE_OFFSET); - CFE_UtAssert_EQUAL(CFE_MSG_SetSize(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSize(&msg, &actual)); + UtAssert_INT32_EQ(actual, 0xFFFF + TEST_MSG_SIZE_OFFSET); + CFE_UtAssert_SUCCESS(CFE_MSG_SetSize(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSize(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSize(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == 0xFFFF + TEST_MSG_SIZE_OFFSET) { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_LENGTH_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_LENGTH_FLAG); } } @@ -88,19 +88,19 @@ void Test_MSG_Size(void) for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSize(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, TEST_MSG_SIZE_OFFSET); - CFE_UtAssert_EQUAL(CFE_MSG_SetSize(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSize(&msg, &actual)); + UtAssert_INT32_EQ(actual, TEST_MSG_SIZE_OFFSET); + CFE_UtAssert_SUCCESS(CFE_MSG_SetSize(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSize(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSize(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == TEST_MSG_SIZE_OFFSET) { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_LENGTH_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_LENGTH_FLAG); } } } @@ -114,33 +114,33 @@ void Test_MSG_Type(void) UtPrintf("Bad parameter tests, Null pointers and invalid (CFE_MSG_Type_Invalid, CFE_MSG_Type_Tlm + 1"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetType(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, 0); - CFE_UtAssert_EQUAL(CFE_MSG_GetType(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(&msg, CFE_MSG_Type_Invalid), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(&msg, CFE_MSG_Type_Tlm + 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetType(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(actual, 0); + UtAssert_INT32_EQ(CFE_MSG_GetType(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetType(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetType(&msg, CFE_MSG_Type_Invalid), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetType(&msg, CFE_MSG_Type_Tlm + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set to all F's, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetType(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, CFE_MSG_Type_Cmd); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetType(&msg, &actual)); + UtAssert_INT32_EQ(actual, CFE_MSG_Type_Cmd); + CFE_UtAssert_SUCCESS(CFE_MSG_SetType(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetType(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetType(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == CFE_MSG_Type_Cmd) { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_TYPE_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_TYPE_FLAG); } } @@ -148,19 +148,19 @@ void Test_MSG_Type(void) for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetType(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, CFE_MSG_Type_Tlm); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetType(&msg, &actual)); + UtAssert_INT32_EQ(actual, CFE_MSG_Type_Tlm); + CFE_UtAssert_SUCCESS(CFE_MSG_SetType(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetType(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetType(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == CFE_MSG_Type_Tlm) { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_TYPE_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_TYPE_FLAG); } } } @@ -174,33 +174,33 @@ void Test_MSG_HeaderVersion(void) UtPrintf("Bad parameter tests, Null pointers and invalid (max valid + 1, max)"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetHeaderVersion(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, TEST_CCSDSVER_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_GetHeaderVersion(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetHeaderVersion(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetHeaderVersion(&msg, TEST_CCSDSVER_MAX + 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetHeaderVersion(&msg, 0xFFFF), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetHeaderVersion(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(actual, TEST_CCSDSVER_MAX); + UtAssert_INT32_EQ(CFE_MSG_GetHeaderVersion(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetHeaderVersion(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetHeaderVersion(&msg, TEST_CCSDSVER_MAX + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetHeaderVersion(&msg, 0xFFFF), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set to all F's, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetHeaderVersion(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, TEST_CCSDSVER_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_SetHeaderVersion(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHeaderVersion(&msg, &actual)); + UtAssert_INT32_EQ(actual, TEST_CCSDSVER_MAX); + CFE_UtAssert_SUCCESS(CFE_MSG_SetHeaderVersion(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetHeaderVersion(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHeaderVersion(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == TEST_CCSDSVER_MAX) { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_HDRVER_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_HDRVER_FLAG); } } @@ -208,19 +208,19 @@ void Test_MSG_HeaderVersion(void) for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetHeaderVersion(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetHeaderVersion(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHeaderVersion(&msg, &actual)); + UtAssert_INT32_EQ(actual, 0); + CFE_UtAssert_SUCCESS(CFE_MSG_SetHeaderVersion(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetHeaderVersion(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHeaderVersion(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == 0) { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_HDRVER_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_HDRVER_FLAG); } } } @@ -232,45 +232,45 @@ void Test_MSG_HasSecondaryHeader(void) UtPrintf("Bad parameter tests, Null pointers"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetHasSecondaryHeader(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, true); - CFE_UtAssert_EQUAL(CFE_MSG_GetHasSecondaryHeader(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetHasSecondaryHeader(NULL, false), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_GetHasSecondaryHeader(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + CFE_UtAssert_TRUE(actual); + UtAssert_INT32_EQ(CFE_MSG_GetHasSecondaryHeader(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(NULL, false), CFE_MSG_BAD_ARGUMENT); UtPrintf("Set to all F's, true and false inputs"); memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetHasSecondaryHeader(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, true); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &actual)); + CFE_UtAssert_TRUE(actual); - CFE_UtAssert_EQUAL(CFE_MSG_SetHasSecondaryHeader(&msg, true), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(&msg, true)); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetHasSecondaryHeader(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, true); - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), 0); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &actual)); + CFE_UtAssert_TRUE(actual); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetHasSecondaryHeader(&msg, false), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(&msg, false)); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetHasSecondaryHeader(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, false); - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_HASSEC_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &actual)); + CFE_UtAssert_FALSE(actual); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_HASSEC_FLAG); UtPrintf("Set to all 0, true and false inputs"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetHasSecondaryHeader(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, false); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &actual)); + CFE_UtAssert_FALSE(actual); - CFE_UtAssert_EQUAL(CFE_MSG_SetHasSecondaryHeader(&msg, false), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(&msg, false)); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetHasSecondaryHeader(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, false); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &actual)); + CFE_UtAssert_FALSE(actual); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetHasSecondaryHeader(&msg, true), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(&msg, true)); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetHasSecondaryHeader(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, true); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_HASSEC_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &actual)); + CFE_UtAssert_TRUE(actual); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_HASSEC_FLAG); } void Test_MSG_ApId(void) @@ -282,33 +282,33 @@ void Test_MSG_ApId(void) UtPrintf("Bad parameter tests, Null pointers and invalid (max valid + 1, max)"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetApId(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, TEST_APID_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_GetApId(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetApId(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetApId(&msg, TEST_APID_MAX + 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetApId(&msg, 0xFFFF), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetApId(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(actual, TEST_APID_MAX); + UtAssert_INT32_EQ(CFE_MSG_GetApId(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetApId(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetApId(&msg, TEST_APID_MAX + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetApId(&msg, 0xFFFF), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set to all F's, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetApId(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, TEST_APID_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_SetApId(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(&msg, &actual)); + UtAssert_INT32_EQ(actual, TEST_APID_MAX); + CFE_UtAssert_SUCCESS(CFE_MSG_SetApId(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetApId(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == TEST_APID_MAX) { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_APID_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_APID_FLAG); } } @@ -316,19 +316,19 @@ void Test_MSG_ApId(void) for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetApId(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetApId(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(&msg, &actual)); + UtAssert_INT32_EQ(actual, 0); + CFE_UtAssert_SUCCESS(CFE_MSG_SetApId(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetApId(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == 0) { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_APID_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_APID_FLAG); } } } @@ -343,33 +343,33 @@ void Test_MSG_SegmentationFlag(void) UtPrintf("Bad parameter tests, Null pointers and invalid (*_Invalid, max valid + 1"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSegmentationFlag(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, CFE_MSG_SegFlag_Invalid); - CFE_UtAssert_EQUAL(CFE_MSG_GetSegmentationFlag(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSegmentationFlag(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetSegmentationFlag(&msg, CFE_MSG_SegFlag_Invalid), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSegmentationFlag(&msg, CFE_MSG_SegFlag_Unsegmented + 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetSegmentationFlag(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(actual, CFE_MSG_SegFlag_Invalid); + UtAssert_INT32_EQ(CFE_MSG_GetSegmentationFlag(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(&msg, CFE_MSG_SegFlag_Invalid), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(&msg, CFE_MSG_SegFlag_Unsegmented + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set to all F's, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSegmentationFlag(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, CFE_MSG_SegFlag_Unsegmented); - CFE_UtAssert_EQUAL(CFE_MSG_SetSegmentationFlag(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSegmentationFlag(&msg, &actual)); + UtAssert_INT32_EQ(actual, CFE_MSG_SegFlag_Unsegmented); + CFE_UtAssert_SUCCESS(CFE_MSG_SetSegmentationFlag(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSegmentationFlag(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSegmentationFlag(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == CFE_MSG_SegFlag_Unsegmented) { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_SEGMENT_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_SEGMENT_FLAG); } } @@ -377,19 +377,19 @@ void Test_MSG_SegmentationFlag(void) for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSegmentationFlag(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, CFE_MSG_SegFlag_Continue); - CFE_UtAssert_EQUAL(CFE_MSG_SetSegmentationFlag(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSegmentationFlag(&msg, &actual)); + UtAssert_INT32_EQ(actual, CFE_MSG_SegFlag_Continue); + CFE_UtAssert_SUCCESS(CFE_MSG_SetSegmentationFlag(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSegmentationFlag(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSegmentationFlag(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == CFE_MSG_SegFlag_Continue) { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_SEGMENT_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_SEGMENT_FLAG); } } } @@ -406,33 +406,33 @@ void Test_MSG_SequenceCount(void) UtPrintf("Bad parameter tests, Null pointers and invalid (max valid + 1, max)"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSequenceCount(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, TEST_SEQUENCE_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_GetSequenceCount(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSequenceCount(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetSequenceCount(&msg, TEST_SEQUENCE_MAX + 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSequenceCount(&msg, maxsc), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(actual, TEST_SEQUENCE_MAX); + UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&msg, TEST_SEQUENCE_MAX + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&msg, maxsc), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set to all F's, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSequenceCount(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, TEST_SEQUENCE_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_SetSequenceCount(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSequenceCount(&msg, &actual)); + UtAssert_INT32_EQ(actual, TEST_SEQUENCE_MAX); + CFE_UtAssert_SUCCESS(CFE_MSG_SetSequenceCount(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSequenceCount(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSequenceCount(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == TEST_SEQUENCE_MAX) { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_SEQUENCE_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_SEQUENCE_FLAG); } } @@ -440,27 +440,27 @@ void Test_MSG_SequenceCount(void) for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSequenceCount(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetSequenceCount(&msg, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSequenceCount(&msg, &actual)); + UtAssert_INT32_EQ(actual, 0); + CFE_UtAssert_SUCCESS(CFE_MSG_SetSequenceCount(&msg, input[i])); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSequenceCount(&msg, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSequenceCount(&msg, &actual)); + UtAssert_INT32_EQ(actual, input[i]); if (input[i] == 0) { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); } else { - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_SEQUENCE_FLAG); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_SEQUENCE_FLAG); } } UtPrintf("Fully exercise getting next sequence count"); - CFE_UtAssert_EQUAL(CFE_MSG_GetNextSequenceCount(0), 1); - CFE_UtAssert_EQUAL(CFE_MSG_GetNextSequenceCount(TEST_SEQUENCE_MAX / 2), (TEST_SEQUENCE_MAX / 2) + 1); - CFE_UtAssert_EQUAL(CFE_MSG_GetNextSequenceCount(TEST_SEQUENCE_MAX), 0); - CFE_UtAssert_EQUAL(CFE_MSG_GetNextSequenceCount(maxsc), 0); + UtAssert_INT32_EQ(CFE_MSG_GetNextSequenceCount(0), 1); + UtAssert_INT32_EQ(CFE_MSG_GetNextSequenceCount(TEST_SEQUENCE_MAX / 2), (TEST_SEQUENCE_MAX / 2) + 1); + UtAssert_INT32_EQ(CFE_MSG_GetNextSequenceCount(TEST_SEQUENCE_MAX), 0); + UtAssert_INT32_EQ(CFE_MSG_GetNextSequenceCount(maxsc), 0); } /* diff --git a/modules/msg/ut-coverage/test_cfe_msg_checksum.c b/modules/msg/ut-coverage/test_cfe_msg_checksum.c index 0ac3f4c5b..e36e94144 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_checksum.c +++ b/modules/msg/ut-coverage/test_cfe_msg_checksum.c @@ -43,48 +43,48 @@ void Test_MSG_Checksum(void) UtPrintf("Bad parameter tests, Null pointers"); memset(&cmd, 0, sizeof(cmd)); actual = true; - CFE_UtAssert_EQUAL(CFE_MSG_GenerateChecksum(NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_ValidateChecksum(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, true); - CFE_UtAssert_EQUAL(CFE_MSG_ValidateChecksum(msgptr, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), 0); + UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + CFE_UtAssert_TRUE(actual); + UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(msgptr, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), 0); UtPrintf("Bad message, no secondary header"); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Cmd), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_EQUAL(actual, true); - CFE_UtAssert_EQUAL(CFE_MSG_GenerateChecksum(msgptr), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), MSG_TYPE_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Cmd)); + UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); + CFE_UtAssert_TRUE(actual); + UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(msgptr), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), MSG_TYPE_FLAG); UtPrintf("Bad message, wrong type (telemetry)"); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Tlm), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_SetHasSecondaryHeader(msgptr, true), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_EQUAL(actual, true); - CFE_UtAssert_EQUAL(CFE_MSG_GenerateChecksum(msgptr), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), MSG_HASSEC_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Tlm)); + CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(msgptr, true)); + UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); + CFE_UtAssert_TRUE(actual); + UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(msgptr), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), MSG_HASSEC_FLAG); UtPrintf("Set to all F's, validate/generate/validate"); memset(&cmd, 0xFF, sizeof(cmd)); - CFE_UtAssert_EQUAL(CFE_MSG_SetSize(msgptr, sizeof(cmd)), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, false); - CFE_UtAssert_EQUAL(CFE_MSG_GenerateChecksum(msgptr), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_SetSize(msgptr, sizeof(cmd))); + CFE_UtAssert_SUCCESS(CFE_MSG_ValidateChecksum(msgptr, &actual)); + CFE_UtAssert_FALSE(actual); + CFE_UtAssert_SUCCESS(CFE_MSG_GenerateChecksum(msgptr)); UT_DisplayPkt(msgptr, sizeof(cmd)); - CFE_UtAssert_EQUAL(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, true); - CFE_UtAssert_EQUAL(Test_MSG_NotF(msgptr), MSG_LENGTH_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_ValidateChecksum(msgptr, &actual)); + CFE_UtAssert_TRUE(actual); + UtAssert_INT32_EQ(Test_MSG_NotF(msgptr), MSG_LENGTH_FLAG); UtPrintf("Set to all 0 except secheader and type, validate/generate/validate"); memset(&cmd, 0, sizeof(cmd)); - CFE_UtAssert_EQUAL(CFE_MSG_SetSize(msgptr, sizeof(cmd)), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Cmd), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_SetHasSecondaryHeader(msgptr, true), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, false); - CFE_UtAssert_EQUAL(CFE_MSG_GenerateChecksum(msgptr), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_SetSize(msgptr, sizeof(cmd))); + CFE_UtAssert_SUCCESS(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Cmd)); + CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(msgptr, true)); + CFE_UtAssert_SUCCESS(CFE_MSG_ValidateChecksum(msgptr, &actual)); + CFE_UtAssert_FALSE(actual); + CFE_UtAssert_SUCCESS(CFE_MSG_GenerateChecksum(msgptr)); UT_DisplayPkt(msgptr, sizeof(cmd)); - CFE_UtAssert_EQUAL(CFE_MSG_ValidateChecksum(msgptr, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, true); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), MSG_LENGTH_FLAG | MSG_HASSEC_FLAG | MSG_TYPE_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_ValidateChecksum(msgptr, &actual)); + CFE_UtAssert_TRUE(actual); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), MSG_LENGTH_FLAG | MSG_HASSEC_FLAG | MSG_TYPE_FLAG); } diff --git a/modules/msg/ut-coverage/test_cfe_msg_fc.c b/modules/msg/ut-coverage/test_cfe_msg_fc.c index 2652804f6..e9763e2c2 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_fc.c +++ b/modules/msg/ut-coverage/test_cfe_msg_fc.c @@ -49,57 +49,57 @@ void Test_MSG_FcnCode(void) UtPrintf("Bad parameter tests, Null pointers, invalid (max valid + 1, max)"); memset(&cmd, 0, sizeof(cmd)); - CFE_UtAssert_EQUAL(CFE_MSG_GetFcnCode(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual, TEST_FCNCODE_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_GetFcnCode(msgptr, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetFcnCode(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetFcnCode(msgptr, TEST_FCNCODE_MAX + 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetFcnCode(msgptr, 0xFFFF), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), 0); + UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(actual, TEST_FCNCODE_MAX); + UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(msgptr, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), 0); + UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(msgptr, TEST_FCNCODE_MAX + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), 0); + UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(msgptr, 0xFFFF), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), 0); UtPrintf("Bad message, no secondary header"); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Cmd), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetFcnCode(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_EQUAL(actual, 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetFcnCode(msgptr, 0), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), MSG_TYPE_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Cmd)); + UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(actual, 0); + UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(msgptr, 0), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), MSG_TYPE_FLAG); UtPrintf("Bad message, wrong type (telemetry)"); memset(&cmd, 0, sizeof(cmd)); actual = TEST_FCNCODE_MAX; - CFE_UtAssert_EQUAL(CFE_MSG_SetHasSecondaryHeader(msgptr, true), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetFcnCode(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_EQUAL(actual, 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetFcnCode(msgptr, 0), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), MSG_HASSEC_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(msgptr, true)); + UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(actual, 0); + UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(msgptr, 0), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), MSG_HASSEC_FLAG); UtPrintf("Set to all F's, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&cmd, 0xFF, sizeof(cmd)); - CFE_UtAssert_EQUAL(CFE_MSG_GetFcnCode(msgptr, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, TEST_FCNCODE_MAX); - CFE_UtAssert_EQUAL(CFE_MSG_SetFcnCode(msgptr, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetFcnCode(msgptr, &actual)); + UtAssert_INT32_EQ(actual, TEST_FCNCODE_MAX); + CFE_UtAssert_SUCCESS(CFE_MSG_SetFcnCode(msgptr, input[i])); UT_DisplayPkt(msgptr, sizeof(cmd)); - CFE_UtAssert_EQUAL(CFE_MSG_GetFcnCode(msgptr, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); - CFE_UtAssert_EQUAL(Test_MSG_NotF(msgptr), 0); + CFE_UtAssert_SUCCESS(CFE_MSG_GetFcnCode(msgptr, &actual)); + UtAssert_INT32_EQ(actual, input[i]); + UtAssert_INT32_EQ(Test_MSG_NotF(msgptr), 0); } UtPrintf("Set to all 0, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&cmd, 0, sizeof(cmd)); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Cmd), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_SetHasSecondaryHeader(msgptr, true), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetFcnCode(msgptr, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetFcnCode(msgptr, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Cmd)); + CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(msgptr, true)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetFcnCode(msgptr, &actual)); + UtAssert_INT32_EQ(actual, 0); + CFE_UtAssert_SUCCESS(CFE_MSG_SetFcnCode(msgptr, input[i])); UT_DisplayPkt(msgptr, sizeof(cmd)); - CFE_UtAssert_EQUAL(CFE_MSG_GetFcnCode(msgptr, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, input[i]); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), MSG_HASSEC_FLAG | MSG_TYPE_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_GetFcnCode(msgptr, &actual)); + UtAssert_INT32_EQ(actual, input[i]); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), MSG_HASSEC_FLAG | MSG_TYPE_FLAG); } } diff --git a/modules/msg/ut-coverage/test_cfe_msg_init.c b/modules/msg/ut-coverage/test_cfe_msg_init.c index 9746ca7e5..2efeee5cf 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_init.c +++ b/modules/msg/ut-coverage/test_cfe_msg_init.c @@ -54,76 +54,75 @@ void Test_MSG_Init(void) bool is_v1; UtPrintf("Bad parameter tests, Null pointer, invalid size, invalid msgid"); - CFE_UtAssert_EQUAL(CFE_MSG_Init(NULL, CFE_SB_ValueToMsgId(0), sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(0), 0), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL( - CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), sizeof(cmd)), - CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(-1), sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_Init(NULL, CFE_SB_ValueToMsgId(0), sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(0), 0), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), sizeof(cmd)), + CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(-1), sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); UtPrintf("Set to all F's, msgid value = 0"); memset(&cmd, 0xFF, sizeof(cmd)); msgidval_exp = 0; - CFE_UtAssert_EQUAL(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(cmd)), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(cmd))); UT_DisplayPkt(&cmd.Msg, 0); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&cmd.Msg, &msgid_act), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); - CFE_UtAssert_EQUAL(CFE_MSG_GetSize(&cmd.Msg, &size), CFE_SUCCESS); - CFE_UtAssert_EQUAL(size, sizeof(cmd)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSegmentationFlag(&cmd.Msg, &segflag), CFE_SUCCESS); - CFE_UtAssert_EQUAL(segflag, CFE_MSG_SegFlag_Unsegmented); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&cmd.Msg, &msgid_act)); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSize(&cmd.Msg, &size)); + CFE_UtAssert_MEMOFFSET_EQ(size, sizeof(cmd)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSegmentationFlag(&cmd.Msg, &segflag)); + UtAssert_INT32_EQ(segflag, CFE_MSG_SegFlag_Unsegmented); - CFE_UtAssert_EQUAL(CFE_MSG_GetApId(&cmd.Msg, &apid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetHeaderVersion(&cmd.Msg, &hdrver), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetHasSecondaryHeader(&cmd.Msg, &hassec), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(&cmd.Msg, &apid)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHeaderVersion(&cmd.Msg, &hdrver)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&cmd.Msg, &hassec)); /* A zero msgid will set hassec to false for v1 */ is_v1 = !hassec; if (!is_v1) { - CFE_UtAssert_EQUAL(apid, CFE_PLATFORM_DEFAULT_APID & TEST_DEFAULT_APID_MASK); - CFE_UtAssert_EQUAL(hdrver, CFE_MISSION_CCSDSVER); + UtAssert_INT32_EQ(apid, CFE_PLATFORM_DEFAULT_APID & TEST_DEFAULT_APID_MASK); + UtAssert_INT32_EQ(hdrver, CFE_MISSION_CCSDSVER); } else { - CFE_UtAssert_EQUAL(apid, 0); - CFE_UtAssert_EQUAL(hdrver, 0); + UtAssert_INT32_EQ(apid, 0); + UtAssert_INT32_EQ(hdrver, 0); } /* Confirm the rest of the fields not already explicitly checked */ - CFE_UtAssert_EQUAL(Test_MSG_Pri_NotZero(&cmd.Msg) & ~(MSG_APID_FLAG | MSG_HDRVER_FLAG | MSG_HASSEC_FLAG), + UtAssert_UINT32_EQ(Test_MSG_Pri_NotZero(&cmd.Msg) & ~(MSG_APID_FLAG | MSG_HDRVER_FLAG | MSG_HASSEC_FLAG), MSG_LENGTH_FLAG | MSG_SEGMENT_FLAG); UtPrintf("Set to all 0, max msgid value"); memset(&cmd, 0, sizeof(cmd)); msgidval_exp = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID; - CFE_UtAssert_EQUAL(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(cmd)), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(cmd))); UT_DisplayPkt(&cmd.Msg, 0); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&cmd.Msg, &msgid_act), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); - CFE_UtAssert_EQUAL(CFE_MSG_GetSize(&cmd.Msg, &size), CFE_SUCCESS); - CFE_UtAssert_EQUAL(size, sizeof(cmd)); - CFE_UtAssert_EQUAL(CFE_MSG_GetSegmentationFlag(&cmd.Msg, &segflag), CFE_SUCCESS); - CFE_UtAssert_EQUAL(segflag, CFE_MSG_SegFlag_Unsegmented); - - CFE_UtAssert_EQUAL(CFE_MSG_GetApId(&cmd.Msg, &apid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetHeaderVersion(&cmd.Msg, &hdrver), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetHasSecondaryHeader(&cmd.Msg, &hassec), CFE_SUCCESS); - CFE_UtAssert_EQUAL(hassec, true); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&cmd.Msg, &msgid_act)); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSize(&cmd.Msg, &size)); + UtAssert_INT32_EQ(size, sizeof(cmd)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSegmentationFlag(&cmd.Msg, &segflag)); + UtAssert_INT32_EQ(segflag, CFE_MSG_SegFlag_Unsegmented); + + CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(&cmd.Msg, &apid)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHeaderVersion(&cmd.Msg, &hdrver)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&cmd.Msg, &hassec)); + CFE_UtAssert_TRUE(hassec); if (!is_v1) { - CFE_UtAssert_EQUAL(apid & TEST_DEFAULT_APID_MASK, CFE_PLATFORM_DEFAULT_APID & TEST_DEFAULT_APID_MASK); - CFE_UtAssert_EQUAL(hdrver, CFE_MISSION_CCSDSVER); + UtAssert_INT32_EQ(apid & TEST_DEFAULT_APID_MASK, CFE_PLATFORM_DEFAULT_APID & TEST_DEFAULT_APID_MASK); + UtAssert_INT32_EQ(hdrver, CFE_MISSION_CCSDSVER); } else { - CFE_UtAssert_EQUAL(apid, 0x7FF); - CFE_UtAssert_EQUAL(hdrver, 0); + UtAssert_INT32_EQ(apid, 0x7FF); + UtAssert_INT32_EQ(hdrver, 0); } - CFE_UtAssert_EQUAL(Test_MSG_Pri_NotZero(&cmd.Msg) & ~MSG_HDRVER_FLAG, + UtAssert_UINT32_EQ(Test_MSG_Pri_NotZero(&cmd.Msg) & ~MSG_HDRVER_FLAG, MSG_APID_FLAG | MSG_HASSEC_FLAG | MSG_TYPE_FLAG | MSG_LENGTH_FLAG | MSG_SEGMENT_FLAG); } diff --git a/modules/msg/ut-coverage/test_cfe_msg_msgid_shared.c b/modules/msg/ut-coverage/test_cfe_msg_msgid_shared.c index 42e4eda4a..c6ae6fede 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_msgid_shared.c +++ b/modules/msg/ut-coverage/test_cfe_msg_msgid_shared.c @@ -42,32 +42,32 @@ void Test_MSG_GetTypeFromMsgId(void) UtPrintf("Bad parameter tests, Null pointer"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetTypeFromMsgId(msgid, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetTypeFromMsgId(msgid, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set to all F's, test cmd and tlm"); memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID)), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(&msg, CFE_MSG_Type_Tlm), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetTypeFromMsgId(msgid, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, CFE_MSG_Type_Tlm); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID))); + CFE_UtAssert_SUCCESS(CFE_MSG_SetType(&msg, CFE_MSG_Type_Tlm)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetTypeFromMsgId(msgid, &actual)); + UtAssert_INT32_EQ(actual, CFE_MSG_Type_Tlm); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(&msg, CFE_MSG_Type_Cmd), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetTypeFromMsgId(msgid, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, CFE_MSG_Type_Cmd); + CFE_UtAssert_SUCCESS(CFE_MSG_SetType(&msg, CFE_MSG_Type_Cmd)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetTypeFromMsgId(msgid, &actual)); + UtAssert_INT32_EQ(actual, CFE_MSG_Type_Cmd); UtPrintf("Set to all 0, test cmd and tlm"); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(&msg, CFE_MSG_Type_Cmd), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetTypeFromMsgId(msgid, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, CFE_MSG_Type_Cmd); + CFE_UtAssert_SUCCESS(CFE_MSG_SetType(&msg, CFE_MSG_Type_Cmd)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetTypeFromMsgId(msgid, &actual)); + UtAssert_INT32_EQ(actual, CFE_MSG_Type_Cmd); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(&msg, CFE_MSG_Type_Tlm), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetTypeFromMsgId(msgid, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual, CFE_MSG_Type_Tlm); + CFE_UtAssert_SUCCESS(CFE_MSG_SetType(&msg, CFE_MSG_Type_Tlm)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetTypeFromMsgId(msgid, &actual)); + UtAssert_INT32_EQ(actual, CFE_MSG_Type_Tlm); } /* diff --git a/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c b/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c index 1b02582a2..8a0a6a5ae 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c +++ b/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c @@ -43,62 +43,62 @@ void Test_MSG_MsgId(void) UtPrintf("Bad parameter tests, Null pointers and invalid (max valid + 1)"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(NULL, &msgid), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(msgid), 1); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(NULL, msgid), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_SB_INVALID_MSG_ID), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, 0xFFFF), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetMsgId(NULL, &msgid), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 1); + UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetMsgId(NULL, msgid), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_SB_INVALID_MSG_ID), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, 0xFFFF), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set msg to all F's, set msgid to 0 and verify"); memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(msgid), 0xFFFF); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, 0), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 0xFFFF); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, 0)); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(msgid), 0); - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_HDRVER_FLAG | MSG_APID_FLAG | MSG_TYPE_FLAG | MSG_HASSEC_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 0); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_HDRVER_FLAG | MSG_APID_FLAG | MSG_TYPE_FLAG | MSG_HASSEC_FLAG); UtPrintf("Set msg to all 0, set msgid to max and verify"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(msgid), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 0); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID)); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(msgid), CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_APID_FLAG | MSG_TYPE_FLAG | MSG_HASSEC_FLAG); - CFE_UtAssert_EQUAL(CFE_MSG_GetApId(&msg, &apid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(apid, TEST_MAX_APID); - CFE_UtAssert_EQUAL(CFE_MSG_GetType(&msg, &type), CFE_SUCCESS); - CFE_UtAssert_EQUAL(type, CFE_MSG_Type_Cmd); - CFE_UtAssert_EQUAL(CFE_MSG_GetHasSecondaryHeader(&msg, &hassec), CFE_SUCCESS); - CFE_UtAssert_EQUAL(hassec, true); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_APID_FLAG | MSG_TYPE_FLAG | MSG_HASSEC_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(&msg, &apid)); + UtAssert_INT32_EQ(apid, TEST_MAX_APID); + CFE_UtAssert_SUCCESS(CFE_MSG_GetType(&msg, &type)); + UtAssert_INT32_EQ(type, CFE_MSG_Type_Cmd); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &hassec)); + CFE_UtAssert_TRUE(hassec); UtPrintf("Set ApId msgid bits only and verify"); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(TEST_MAX_APID)), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_APID_FLAG); - CFE_UtAssert_EQUAL(CFE_MSG_GetApId(&msg, &apid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(apid, TEST_MAX_APID); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(TEST_MAX_APID))); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_APID_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(&msg, &apid)); + UtAssert_INT32_EQ(apid, TEST_MAX_APID); UtPrintf("Set has secondary header bit only and verify"); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0x0800)), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_HASSEC_FLAG); - CFE_UtAssert_EQUAL(CFE_MSG_GetHasSecondaryHeader(&msg, &hassec), CFE_SUCCESS); - CFE_UtAssert_EQUAL(hassec, true); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0x0800))); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_HASSEC_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&msg, &hassec)); + CFE_UtAssert_TRUE(hassec); UtPrintf("Set type msgid bit only and verify"); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0x1000)), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_TYPE_FLAG); - CFE_UtAssert_EQUAL(CFE_MSG_GetType(&msg, &type), CFE_SUCCESS); - CFE_UtAssert_EQUAL(type, CFE_MSG_Type_Cmd); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0x1000))); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_TYPE_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_GetType(&msg, &type)); + UtAssert_INT32_EQ(type, CFE_MSG_Type_Cmd); } diff --git a/modules/msg/ut-coverage/test_cfe_msg_msgid_v2.c b/modules/msg/ut-coverage/test_cfe_msg_msgid_v2.c index 489bf2942..1787fb420 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_msgid_v2.c +++ b/modules/msg/ut-coverage/test_cfe_msg_msgid_v2.c @@ -51,67 +51,66 @@ void Test_MSG_MsgId(void) UtPrintf("Bad parameter tests, Null pointers and invalid (max valid + 1)"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(NULL, &msgid), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(msgid), 1); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(NULL, msgid), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_SB_INVALID_MSG_ID), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, 0xFFFFFFFF), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_GetMsgId(NULL, &msgid), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 1); + UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetMsgId(NULL, msgid), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_SB_INVALID_MSG_ID), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); + UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, 0xFFFFFFFF), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set msg to all F's, set msgid to 0 and verify"); memset(&msg, 0xFF, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(msgid), 0xFFFF); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, 0), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 0xFFFF); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, 0)); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(msgid), 0); - CFE_UtAssert_EQUAL(Test_MSG_NotF(&msg), MSG_APID_FLAG | MSG_TYPE_FLAG | local_subsys_flag); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 0); + UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_APID_FLAG | MSG_TYPE_FLAG | local_subsys_flag); UtPrintf("Set msg to all 0, set msgid to max and verify"); memset(&msg, 0, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(msgid), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 0); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID)); UT_DisplayPkt(&msg, sizeof(msg)); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(msgid), CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_APID_FLAG | MSG_TYPE_FLAG | local_subsys_flag); - CFE_UtAssert_EQUAL(CFE_MSG_GetApId(&msg, &apid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(apid, 0x7F); - CFE_UtAssert_EQUAL(CFE_MSG_GetType(&msg, &type), CFE_SUCCESS); - CFE_UtAssert_EQUAL(type, CFE_MSG_Type_Cmd); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_APID_FLAG | MSG_TYPE_FLAG | local_subsys_flag); + CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(&msg, &apid)); + UtAssert_INT32_EQ(apid, 0x7F); + CFE_UtAssert_SUCCESS(CFE_MSG_GetType(&msg, &type)); + UtAssert_INT32_EQ(type, CFE_MSG_Type_Cmd); if (CFE_MSG_GetSubsystem(&msg, &subsystem) != CFE_MSG_NOT_IMPLEMENTED) { - CFE_UtAssert_EQUAL(subsystem, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID >> 8); + UtAssert_INT32_EQ(subsystem, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID >> 8); } UtPrintf("Set ApId msgid bits only and verify"); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0x007F)), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_APID_FLAG); - CFE_UtAssert_EQUAL(CFE_MSG_GetApId(&msg, &apid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(apid, 0x007F); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0x007F))); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_APID_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(&msg, &apid)); + UtAssert_INT32_EQ(apid, 0x007F); UtPrintf("Set type msgid bit only and verify"); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0x0080)), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), MSG_TYPE_FLAG); - CFE_UtAssert_EQUAL(CFE_MSG_GetType(&msg, &type), CFE_SUCCESS); - CFE_UtAssert_EQUAL(type, CFE_MSG_Type_Cmd); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0x0080))); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), MSG_TYPE_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_GetType(&msg, &type)); + UtAssert_INT32_EQ(type, CFE_MSG_Type_Cmd); UtPrintf("Set subsystem msgid bits only and verify"); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0xFF00 & CFE_PLATFORM_SB_HIGHEST_VALID_MSGID)), - CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(&msg), local_subsys_flag); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0xFF00 & CFE_PLATFORM_SB_HIGHEST_VALID_MSGID))); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); + UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), local_subsys_flag); if (CFE_MSG_GetSubsystem(&msg, &subsystem) != CFE_MSG_NOT_IMPLEMENTED) { - CFE_UtAssert_EQUAL(subsystem, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID >> 8); + UtAssert_INT32_EQ(subsystem, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID >> 8); } } diff --git a/modules/msg/ut-coverage/test_cfe_msg_time.c b/modules/msg/ut-coverage/test_cfe_msg_time.c index aad867738..05d3317a6 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_time.c +++ b/modules/msg/ut-coverage/test_cfe_msg_time.c @@ -44,55 +44,55 @@ void Test_MSG_Time(void) UtPrintf("Bad parameter tests, Null pointers, no secondary header"); memset(&tlm, 0, sizeof(tlm)); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgTime(NULL, &actual), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(actual.Seconds, 0xFFFFFFFF); - CFE_UtAssert_EQUAL(actual.Subseconds, 0xFFFFFFFF); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgTime(msgptr, NULL), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgTime(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgTime(msgptr, actual), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), 0); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgTime(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_EQUAL(actual.Seconds, 0); - CFE_UtAssert_EQUAL(actual.Subseconds, 0); + UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(NULL, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(actual.Seconds, 0xFFFFFFFF); + UtAssert_INT32_EQ(actual.Subseconds, 0xFFFFFFFF); + UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(msgptr, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), 0); + UtAssert_INT32_EQ(CFE_MSG_SetMsgTime(NULL, input[0]), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetMsgTime(msgptr, actual), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), 0); + UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(actual.Seconds, 0); + UtAssert_INT32_EQ(actual.Subseconds, 0); UtPrintf("Bad message, wrong type (command)"); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Cmd), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgTime(msgptr, actual), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), MSG_TYPE_FLAG); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgTime(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); - CFE_UtAssert_EQUAL(actual.Seconds, 0); - CFE_UtAssert_EQUAL(actual.Subseconds, 0); + CFE_UtAssert_SUCCESS(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Cmd)); + UtAssert_INT32_EQ(CFE_MSG_SetMsgTime(msgptr, actual), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), MSG_TYPE_FLAG); + UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(msgptr, &actual), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(actual.Seconds, 0); + UtAssert_INT32_EQ(actual.Subseconds, 0); UtPrintf("Set to all F's, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&tlm, 0xFF, sizeof(tlm)); - CFE_UtAssert_EQUAL(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Tlm), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgTime(msgptr, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual.Seconds, 0xFFFFFFFF); - CFE_UtAssert_EQUAL(actual.Subseconds, 0xFFFF0000); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgTime(msgptr, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_SetType(msgptr, CFE_MSG_Type_Tlm)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgTime(msgptr, &actual)); + UtAssert_INT32_EQ(actual.Seconds, 0xFFFFFFFF); + UtAssert_INT32_EQ(actual.Subseconds, 0xFFFF0000); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgTime(msgptr, input[i])); UT_DisplayPkt(msgptr, sizeof(tlm)); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgTime(msgptr, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual.Seconds, input[i].Seconds); - CFE_UtAssert_EQUAL(actual.Subseconds, input[i].Subseconds & 0xFFFF0000); - CFE_UtAssert_EQUAL(Test_MSG_NotF(msgptr), MSG_TYPE_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgTime(msgptr, &actual)); + UtAssert_INT32_EQ(actual.Seconds, input[i].Seconds); + UtAssert_INT32_EQ(actual.Subseconds, input[i].Subseconds & 0xFFFF0000); + UtAssert_INT32_EQ(Test_MSG_NotF(msgptr), MSG_TYPE_FLAG); } UtPrintf("Set to all 0, various valid inputs"); for (i = 0; i < sizeof(input) / sizeof(input[0]); i++) { memset(&tlm, 0, sizeof(tlm)); - CFE_UtAssert_EQUAL(CFE_MSG_SetHasSecondaryHeader(msgptr, true), CFE_SUCCESS); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgTime(msgptr, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual.Seconds, 0); - CFE_UtAssert_EQUAL(actual.Subseconds, 0); - CFE_UtAssert_EQUAL(CFE_MSG_SetMsgTime(msgptr, input[i]), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_MSG_SetHasSecondaryHeader(msgptr, true)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgTime(msgptr, &actual)); + UtAssert_INT32_EQ(actual.Seconds, 0); + UtAssert_INT32_EQ(actual.Subseconds, 0); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgTime(msgptr, input[i])); UT_DisplayPkt(msgptr, sizeof(tlm)); - CFE_UtAssert_EQUAL(CFE_MSG_GetMsgTime(msgptr, &actual), CFE_SUCCESS); - CFE_UtAssert_EQUAL(actual.Seconds, input[i].Seconds); - CFE_UtAssert_EQUAL(actual.Subseconds, input[i].Subseconds & 0xFFFF0000); - CFE_UtAssert_EQUAL(Test_MSG_NotZero(msgptr), MSG_HASSEC_FLAG); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgTime(msgptr, &actual)); + UtAssert_INT32_EQ(actual.Seconds, input[i].Seconds); + UtAssert_INT32_EQ(actual.Subseconds, input[i].Subseconds & 0xFFFF0000); + UtAssert_INT32_EQ(Test_MSG_NotZero(msgptr), MSG_HASSEC_FLAG); } } diff --git a/modules/sb/ut-coverage/sb_UT.c b/modules/sb/ut-coverage/sb_UT.c index 9a325b62e..bd2d498d0 100644 --- a/modules/sb/ut-coverage/sb_UT.c +++ b/modules/sb/ut-coverage/sb_UT.c @@ -201,7 +201,7 @@ void Test_SB_AppInit_EVSRegFail(void) int32 ForcedRtnVal = -1; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, ForcedRtnVal); - CFE_UtAssert_EQUAL(CFE_SB_AppInit(), ForcedRtnVal); + UtAssert_INT32_EQ(CFE_SB_AppInit(), ForcedRtnVal); CFE_UtAssert_EVENTCOUNT(0); @@ -228,7 +228,7 @@ void Test_SB_AppInit_EVSSendEvtFail(void) * (The others use SendEventWithAppID which is a different counter). */ UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 1, ForcedRtnVal); - CFE_UtAssert_EQUAL(CFE_SB_AppInit(), ForcedRtnVal); + UtAssert_INT32_EQ(CFE_SB_AppInit(), ForcedRtnVal); CFE_UtAssert_EVENTCOUNT(4); @@ -245,7 +245,7 @@ void Test_SB_AppInit_CrPipeFail(void) * type of error code. */ UT_SetDeferredRetcode(UT_KEY(OS_QueueCreate), 1, OS_ERROR); - CFE_UtAssert_EQUAL(CFE_SB_AppInit(), CFE_SB_PIPE_CR_ERR); + UtAssert_INT32_EQ(CFE_SB_AppInit(), CFE_SB_PIPE_CR_ERR); CFE_UtAssert_EVENTCOUNT(1); @@ -259,7 +259,7 @@ void Test_SB_AppInit_CrPipeFail(void) void Test_SB_AppInit_Sub1Fail(void) { UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, -1); - CFE_UtAssert_EQUAL(CFE_SB_AppInit(), CFE_SB_BUF_ALOC_ERR); + UtAssert_INT32_EQ(CFE_SB_AppInit(), CFE_SB_BUF_ALOC_ERR); CFE_UtAssert_EVENTCOUNT(3); @@ -275,7 +275,7 @@ void Test_SB_AppInit_Sub1Fail(void) void Test_SB_AppInit_Sub2Fail(void) { UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 2, -1); - CFE_UtAssert_EQUAL(CFE_SB_AppInit(), CFE_SB_BUF_ALOC_ERR); + UtAssert_INT32_EQ(CFE_SB_AppInit(), CFE_SB_BUF_ALOC_ERR); CFE_UtAssert_EVENTCOUNT(4); @@ -294,7 +294,7 @@ void Test_SB_AppInit_GetPoolFail(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 4, ForcedRtnVal); - CFE_UtAssert_EQUAL(CFE_SB_AppInit(), ForcedRtnVal); + UtAssert_INT32_EQ(CFE_SB_AppInit(), ForcedRtnVal); CFE_UtAssert_EVENTCOUNT(4); @@ -311,7 +311,7 @@ void Test_SB_AppInit_PutPoolFail(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_PutPoolBuf), 1, ForcedRtnVal); - CFE_UtAssert_EQUAL(CFE_SB_AppInit(), ForcedRtnVal); + UtAssert_INT32_EQ(CFE_SB_AppInit(), ForcedRtnVal); CFE_UtAssert_EVENTCOUNT(4); @@ -592,7 +592,7 @@ void Test_SB_Cmds_RoutingInfoDataGetter(void) LocalBuffer = NULL; LocalBufSize = 0; - CFE_UtAssert_TRUE(!CFE_SB_WriteRouteInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); + CFE_UtAssert_FALSE(CFE_SB_WriteRouteInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); UtAssert_NOT_NULL(LocalBuffer); UtAssert_NONZERO(LocalBufSize); @@ -705,10 +705,10 @@ void Test_SB_Cmds_PipeInfoDataGetter(void) LocalBufSize = 0; /* Note that CFE_SB_CreatePipe() fills entry 1 first, so entry 0 is unused */ - CFE_UtAssert_TRUE(!CFE_SB_WritePipeInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); + CFE_UtAssert_FALSE(CFE_SB_WritePipeInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); UtAssert_ZERO(LocalBufSize); - CFE_UtAssert_TRUE(!CFE_SB_WritePipeInfoDataGetter(&State, 1, &LocalBuffer, &LocalBufSize)); + CFE_UtAssert_FALSE(CFE_SB_WritePipeInfoDataGetter(&State, 1, &LocalBuffer, &LocalBufSize)); UtAssert_NOT_NULL(LocalBuffer); UtAssert_NONZERO(LocalBufSize); @@ -789,7 +789,7 @@ void Test_SB_Cmds_MapInfoDataGetter(void) LocalBuffer = NULL; LocalBufSize = 0; - CFE_UtAssert_TRUE(!CFE_SB_WriteMsgMapInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); + CFE_UtAssert_FALSE(CFE_SB_WriteMsgMapInfoDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); UtAssert_NOT_NULL(LocalBuffer); UtAssert_NONZERO(LocalBufSize); @@ -1335,7 +1335,7 @@ void Test_SB_Cmds_SendPrevSubs(void) /* Event count is only exact if there were no collisions */ if (UT_EventIsInHistory(CFE_SB_HASHCOLLISION_EID)) { - CFE_UtAssert_TRUE(UT_GetNumEventsSent() > NumEvts); + CFE_UtAssert_ATLEAST(UT_GetNumEventsSent(), NumEvts + 1); } else { @@ -1377,7 +1377,7 @@ void Test_SB_Cmds_SendPrevSubs(void) /* Event count is only exact if there were no collisions */ if (UT_EventIsInHistory(CFE_SB_HASHCOLLISION_EID)) { - CFE_UtAssert_TRUE(UT_GetNumEventsSent() > NumEvts); + CFE_UtAssert_ATLEAST(UT_GetNumEventsSent(), NumEvts + 1); } else { @@ -1521,8 +1521,7 @@ void Test_SB_EarlyInit(void) void Test_SB_EarlyInit_SemCreateError(void) { UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_ERR_NO_FREE_IDS); - UT_Report(__FILE__, __LINE__, CFE_SB_EarlyInit() == OS_ERR_NO_FREE_IDS, "CFE_SB_EarlyInit", - "Sem Create error logic"); + UtAssert_INT32_EQ(CFE_SB_EarlyInit(), OS_ERR_NO_FREE_IDS); } /* end Test_SB_EarlyInit_SemCreateError */ /* @@ -1531,8 +1530,7 @@ void Test_SB_EarlyInit_SemCreateError(void) void Test_SB_EarlyInit_PoolCreateError(void) { UT_SetDeferredRetcode(UT_KEY(CFE_ES_PoolCreateEx), 1, CFE_ES_BAD_ARGUMENT); - UT_Report(__FILE__, __LINE__, CFE_SB_EarlyInit() == CFE_ES_BAD_ARGUMENT, "CFE_SB_EarlyInit", - "PoolCreateEx error logic"); + UtAssert_INT32_EQ(CFE_SB_EarlyInit(), CFE_ES_BAD_ARGUMENT); } /* end Test_SB_EarlyInit_PoolCreateError */ /* @@ -1541,7 +1539,7 @@ void Test_SB_EarlyInit_PoolCreateError(void) void Test_SB_EarlyInit_NoErrors(void) { CFE_SB_EarlyInit(); - UT_Report(__FILE__, __LINE__, CFE_SB_EarlyInit() == CFE_SUCCESS, "CFE_SB_EarlyInit", "No errors test"); + CFE_UtAssert_SUCCESS(CFE_SB_EarlyInit()); } /* end Test_SB_EarlyInit_NoErrors */ /* @@ -1567,7 +1565,7 @@ void Test_CreatePipe_NullPtr(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetTaskInfo), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_SetDeferredRetcode(UT_KEY(OS_QueueCreate), 1, OS_SUCCESS); /* Avoids creating socket */ - CFE_UtAssert_EQUAL(CFE_SB_CreatePipe(NULL, PipeDepth, "TestPipe"), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_CreatePipe(NULL, PipeDepth, "TestPipe"), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(1); @@ -1602,12 +1600,12 @@ void Test_CreatePipe_InvalPipeDepth(void) CFE_SB_PipeId_t PipeIdReturned[3]; UT_SetDeferredRetcode(UT_KEY(OS_QueueCreate), 1, OS_SUCCESS); /* Avoid creating socket */ - CFE_UtAssert_EQUAL(CFE_SB_CreatePipe(&PipeIdReturned[0], 0, "TestPipe1"), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeIdReturned[0], 0, "TestPipe1"), CFE_SB_BAD_ARGUMENT); UT_SetDeferredRetcode(UT_KEY(OS_QueueCreate), 1, OS_SUCCESS); - CFE_UtAssert_EQUAL(CFE_SB_CreatePipe(&PipeIdReturned[1], OS_QUEUE_MAX_DEPTH + 1, "TestPipeMaxDepPlus1"), - CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeIdReturned[1], OS_QUEUE_MAX_DEPTH + 1, "TestPipeMaxDepPlus1"), + CFE_SB_BAD_ARGUMENT); UT_SetDeferredRetcode(UT_KEY(OS_QueueCreate), 1, OS_SUCCESS); - CFE_UtAssert_EQUAL(CFE_SB_CreatePipe(&PipeIdReturned[2], 0xffff, "TestPipeffff"), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeIdReturned[2], 0xffff, "TestPipeffff"), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(3); @@ -1639,7 +1637,7 @@ void Test_CreatePipe_MaxPipes(void) } else { - CFE_UtAssert_EQUAL(CFE_SB_CreatePipe(&PipeIdReturned[i], PipeDepth, PipeName), CFE_SB_MAX_PIPES_MET); + UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeIdReturned[i], PipeDepth, PipeName), CFE_SB_MAX_PIPES_MET); } } @@ -1658,7 +1656,7 @@ void Test_CreatePipe_MaxPipes(void) CFE_SB_Global.PipeTbl[1].PipeId = CFE_SB_PIPEID_C(UT_SB_MakePipeIdForIndex(1)); CFE_SB_Global.PipeTbl[2].PipeId = CFE_SB_INVALID_PIPE; CFE_UtAssert_TRUE(CFE_SB_CheckPipeDescSlotUsed(UT_SB_MakePipeIdForIndex(1))); - CFE_UtAssert_TRUE(!CFE_SB_CheckPipeDescSlotUsed(UT_SB_MakePipeIdForIndex(2))); + CFE_UtAssert_FALSE(CFE_SB_CheckPipeDescSlotUsed(UT_SB_MakePipeIdForIndex(2))); } /* end Test_CreatePipe_MaxPipes */ @@ -1682,9 +1680,9 @@ void Test_CreatePipe_SamePipeName(void) FirstPipeId = PipeId; /* Second call to CFE_SB_CreatePipe with same PipeName should fail */ - CFE_UtAssert_EQUAL(CFE_SB_CreatePipe(&PipeId, PipeDepth, PipeName), CFE_SB_PIPE_CR_ERR); + UtAssert_INT32_EQ(CFE_SB_CreatePipe(&PipeId, PipeDepth, PipeName), CFE_SB_PIPE_CR_ERR); - CFE_UtAssert_TRUE(CFE_RESOURCEID_TEST_EQUAL(PipeId, FirstPipeId)); + CFE_UtAssert_RESOURCEID_EQ(PipeId, FirstPipeId); CFE_UtAssert_EVENTCOUNT(2); @@ -1757,7 +1755,7 @@ void Test_DeletePipe_InvalidPipeId(void) { CFE_SB_PipeId_t PipeId = SB_UT_ALTERNATE_INVALID_PIPEID; - CFE_UtAssert_EQUAL(CFE_SB_DeletePipe(PipeId), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_DeletePipe(PipeId), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(1); @@ -1783,7 +1781,7 @@ void Test_DeletePipe_InvalidPipeOwner(void) /* Choose a value that is sure not to be owner */ PipeDscPtr->AppId = UT_SB_AppID_Modify(RealOwner, 1); - CFE_UtAssert_EQUAL(CFE_SB_DeletePipe(PipedId), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_DeletePipe(PipedId), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(2); @@ -1848,7 +1846,7 @@ void Test_GetPipeName_NullPtr(void) CFE_SB_PipeId_t PipeId; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, 4, "TestPipe")); - CFE_UtAssert_EQUAL(CFE_SB_GetPipeName(NULL, OS_MAX_API_NAME, PipeId), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_GetPipeName(NULL, OS_MAX_API_NAME, PipeId), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTSENT(CFE_SB_GETPIPENAME_NULL_PTR_EID); @@ -1867,7 +1865,7 @@ void Test_GetPipeName_InvalidId(void) CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, 4, "TestPipe")); UT_SetDeferredRetcode(UT_KEY(OS_GetResourceName), 1, OS_ERROR); - CFE_UtAssert_EQUAL(CFE_SB_GetPipeName(PipeName, sizeof(PipeName), PipeId), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_GetPipeName(PipeName, sizeof(PipeName), PipeId), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTSENT(CFE_SB_GETPIPENAME_ID_ERR_EID); @@ -1914,11 +1912,11 @@ void Test_GetPipeIdByName_NullPtrs(void) { CFE_SB_PipeId_t PipeIDOut; - CFE_UtAssert_EQUAL(CFE_SB_GetPipeIdByName(&PipeIDOut, NULL), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_GetPipeIdByName(&PipeIDOut, NULL), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTSENT(CFE_SB_GETPIPEIDBYNAME_NULL_ERR_EID); - CFE_UtAssert_EQUAL(CFE_SB_GetPipeIdByName(NULL, "invalid"), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_GetPipeIdByName(NULL, "invalid"), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTSENT(CFE_SB_GETPIPEIDBYNAME_NULL_ERR_EID); @@ -1932,7 +1930,7 @@ void Test_GetPipeIdByName_InvalidName(void) CFE_SB_PipeId_t PipeIdOut; UT_SetDeferredRetcode(UT_KEY(OS_QueueGetIdByName), 1, OS_ERR_NAME_NOT_FOUND); - CFE_UtAssert_EQUAL(CFE_SB_GetPipeIdByName(&PipeIdOut, "invalid"), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_GetPipeIdByName(&PipeIdOut, "invalid"), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTSENT(CFE_SB_GETPIPEIDBYNAME_NAME_ERR_EID); @@ -1964,7 +1962,7 @@ void Test_GetPipeIdByName(void) */ void Test_SetPipeOpts_BadID(void) { - CFE_UtAssert_EQUAL(CFE_SB_SetPipeOpts(SB_UT_ALTERNATE_INVALID_PIPEID, 0), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_SetPipeOpts(SB_UT_ALTERNATE_INVALID_PIPEID, 0), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTSENT(CFE_SB_SETPIPEOPTS_ID_ERR_EID); @@ -1986,7 +1984,7 @@ void Test_SetPipeOpts_NotOwner(void) OrigOwner = PipeDscPtr->AppId; PipeDscPtr->AppId = UT_SB_AppID_Modify(OrigOwner, 1); - CFE_UtAssert_EQUAL(CFE_SB_SetPipeOpts(PipeID, 0), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_SetPipeOpts(PipeID, 0), CFE_SB_BAD_ARGUMENT); PipeDscPtr->AppId = OrigOwner; @@ -2020,7 +2018,7 @@ void Test_GetPipeOpts_BadID(void) { uint8 Opts = 0; - CFE_UtAssert_EQUAL(CFE_SB_GetPipeOpts(SB_UT_ALTERNATE_INVALID_PIPEID, &Opts), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_GetPipeOpts(SB_UT_ALTERNATE_INVALID_PIPEID, &Opts), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTSENT(CFE_SB_GETPIPEOPTS_ID_ERR_EID); @@ -2035,7 +2033,7 @@ void Test_GetPipeOpts_BadPtr(void) CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeID, 4, "TestPipe1")); - CFE_UtAssert_EQUAL(CFE_SB_GetPipeOpts(PipeID, NULL), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_GetPipeOpts(PipeID, NULL), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTSENT(CFE_SB_GETPIPEOPTS_PTR_ERR_EID); @@ -2112,7 +2110,7 @@ void Test_Subscribe_InvalidPipeId(void) CFE_SB_PipeId_t PipeId = SB_UT_PIPEID_2; CFE_SB_MsgId_t MsgId = SB_UT_ALTERNATE_INVALID_MID; - CFE_UtAssert_EQUAL(CFE_SB_Subscribe(MsgId, PipeId), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_Subscribe(MsgId, PipeId), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(2); @@ -2131,7 +2129,7 @@ void Test_Subscribe_InvalidMsgId(void) CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); - CFE_UtAssert_EQUAL(CFE_SB_Subscribe(MsgId, PipeId), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_Subscribe(MsgId, PipeId), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(3); @@ -2238,7 +2236,7 @@ void Test_Subscribe_MaxDestCount(void) } else { - CFE_UtAssert_EQUAL(CFE_SB_Subscribe(MsgId, PipeId[i]), CFE_SB_MAX_DESTS_MET); + UtAssert_INT32_EQ(CFE_SB_Subscribe(MsgId, PipeId[i]), CFE_SB_MAX_DESTS_MET); } } @@ -2278,7 +2276,7 @@ void Test_Subscribe_MaxMsgIdCount(void) } else { - CFE_UtAssert_EQUAL(CFE_SB_Subscribe(CFE_SB_ValueToMsgId(i), PipeId2), CFE_SB_MAX_MSGS_MET); + UtAssert_INT32_EQ(CFE_SB_Subscribe(CFE_SB_ValueToMsgId(i), PipeId2), CFE_SB_MAX_MSGS_MET); } } @@ -2347,7 +2345,7 @@ void Test_Subscribe_PipeNonexistent(void) CFE_SB_MsgId_t MsgId = SB_UT_CMD_MID; CFE_SB_PipeId_t PipeId = SB_UT_ALTERNATE_INVALID_PIPEID; - CFE_UtAssert_EQUAL(CFE_SB_Subscribe(MsgId, PipeId), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_Subscribe(MsgId, PipeId), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(2); @@ -2510,14 +2508,14 @@ void Test_Unsubscribe_InvalParam(void) CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&TestPipe, PipeDepth, "TestPipe")); /* Perform test using a bad message ID */ - CFE_UtAssert_EQUAL(CFE_SB_Unsubscribe(SB_UT_ALTERNATE_INVALID_MID, TestPipe), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_Unsubscribe(SB_UT_ALTERNATE_INVALID_MID, TestPipe), CFE_SB_BAD_ARGUMENT); /* Get the caller's Application ID */ CFE_UtAssert_SUCCESS(CFE_ES_GetAppID(&CallerId)); /* Perform test using a bad scope value */ - CFE_UtAssert_EQUAL(CFE_SB_UnsubscribeFull(SB_UT_FIRST_VALID_MID, TestPipe, CFE_SB_MSG_LOCAL + 1, CallerId), - CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_UnsubscribeFull(SB_UT_FIRST_VALID_MID, TestPipe, CFE_SB_MSG_LOCAL + 1, CallerId), + CFE_SB_BAD_ARGUMENT); /* Perform test using an invalid pipe ID for branch path coverage. * This situation cannot happen in normal circumstances since the @@ -2527,7 +2525,7 @@ void Test_Unsubscribe_InvalParam(void) PipeDscPtr = CFE_SB_LocatePipeDescByID(TestPipe); SavedPipeId = CFE_SB_PipeDescGetID(PipeDscPtr); PipeDscPtr->PipeId = SB_UT_ALTERNATE_INVALID_PIPEID; - CFE_UtAssert_EQUAL(CFE_SB_Unsubscribe(SB_UT_FIRST_VALID_MID, TestPipe), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_Unsubscribe(SB_UT_FIRST_VALID_MID, TestPipe), CFE_SB_BAD_ARGUMENT); /* We must restore the old value so CFE_SB_DeletePipe() works */ PipeDscPtr->PipeId = SavedPipeId; @@ -2581,7 +2579,7 @@ void Test_Unsubscribe_InvalidPipe(void) CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&TestPipe, PipeDepth, "TestPipe")); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, TestPipe)); - CFE_UtAssert_EQUAL(CFE_SB_Unsubscribe(MsgId, SB_UT_ALTERNATE_INVALID_PIPEID), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_Unsubscribe(MsgId, SB_UT_ALTERNATE_INVALID_PIPEID), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(3); @@ -2612,7 +2610,7 @@ void Test_Unsubscribe_InvalidPipeOwner(void) /* Choose a value that is sure not be owner */ PipeDscPtr->AppId = UT_SB_AppID_Modify(RealOwner, 1); - CFE_UtAssert_EQUAL(CFE_SB_Unsubscribe(MsgId, PipeId), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_Unsubscribe(MsgId, PipeId), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(3); @@ -2708,7 +2706,7 @@ void Test_Unsubscribe_GetDestPtr(void) /* For now just get route id and use it, will need update when stubbed */ RouteId = CFE_SBR_GetRouteId(MsgId); - CFE_UtAssert_TRUE(CFE_SB_GetDestPtr(RouteId, TestPipe2) == NULL); + UtAssert_NULL(CFE_SB_GetDestPtr(RouteId, TestPipe2)); CFE_UtAssert_EVENTCOUNT(5); @@ -2750,7 +2748,7 @@ void Test_TransmitMsg_API(void) */ void Test_TransmitMsg_NullPtr(void) { - CFE_UtAssert_EQUAL(CFE_SB_TransmitMsg(NULL, true), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(NULL, true), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(1); @@ -2790,7 +2788,7 @@ void Test_TransmitMsg_MaxMsgSizePlusOne(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - CFE_UtAssert_EQUAL(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true), CFE_SB_MSG_TOO_BIG); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true), CFE_SB_MSG_TOO_BIG); CFE_UtAssert_EVENTCOUNT(1); @@ -2863,18 +2861,18 @@ void Test_TransmitMsg_SequenceCount(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); CFE_UtAssert_SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_SetSequenceCount)), 1); - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_GetNextSequenceCount)), 1); - CFE_UtAssert_EQUAL(SeqCnt, SeqCntExpected); + UtAssert_STUB_COUNT(CFE_MSG_SetSequenceCount, 1); + UtAssert_STUB_COUNT(CFE_MSG_GetNextSequenceCount, 1); + UtAssert_INT32_EQ(SeqCnt, SeqCntExpected); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, false)); - /* CFE_UtAssert_SUCCESS sequence count wasn't set */ - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_GetNextSequenceCount)), 1); - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_SetSequenceCount)), 1); + /* Assert sequence count wasn't set */ + UtAssert_STUB_COUNT(CFE_MSG_GetNextSequenceCount, 1); + UtAssert_STUB_COUNT(CFE_MSG_SetSequenceCount, 1); SeqCntExpected = 2; UT_SetDefaultReturnValue(UT_KEY(CFE_MSG_GetNextSequenceCount), SeqCntExpected); @@ -2882,9 +2880,9 @@ void Test_TransmitMsg_SequenceCount(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); - CFE_UtAssert_EQUAL(SeqCnt, SeqCntExpected); - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_SetSequenceCount)), 2); - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_GetNextSequenceCount)), 2); + UtAssert_INT32_EQ(SeqCnt, SeqCntExpected); + UtAssert_STUB_COUNT(CFE_MSG_SetSequenceCount, 2); + UtAssert_STUB_COUNT(CFE_MSG_GetNextSequenceCount, 2); CFE_UtAssert_EVENTCOUNT(2); CFE_UtAssert_EVENTSENT(CFE_SB_SUBSCRIPTION_RCVD_EID); @@ -2897,8 +2895,8 @@ void Test_TransmitMsg_SequenceCount(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); CFE_UtAssert_SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); /* increment to 3 */ - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_SetSequenceCount)), 3); - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_GetNextSequenceCount)), 3); + UtAssert_STUB_COUNT(CFE_MSG_SetSequenceCount, 3); + UtAssert_STUB_COUNT(CFE_MSG_GetNextSequenceCount, 3); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId)); /* resubscribe so we can receive a msg */ @@ -2908,9 +2906,9 @@ void Test_TransmitMsg_SequenceCount(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); CFE_UtAssert_SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); /* increment to 4 */ - CFE_UtAssert_EQUAL(SeqCnt, SeqCntExpected); - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_SetSequenceCount)), 4); - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_GetNextSequenceCount)), 4); + UtAssert_INT32_EQ(SeqCnt, SeqCntExpected); + UtAssert_STUB_COUNT(CFE_MSG_SetSequenceCount, 4); + UtAssert_STUB_COUNT(CFE_MSG_GetNextSequenceCount, 4); CFE_UtAssert_TEARDOWN(CFE_SB_DeletePipe(PipeId)); @@ -3046,7 +3044,7 @@ void Test_TransmitMsg_GetPoolBufErr(void) * allocation failed) */ UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_MEM_BLOCK_SIZE); - CFE_UtAssert_EQUAL(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true), CFE_SB_BUF_ALOC_ERR); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true), CFE_SB_BUF_ALOC_ERR); CFE_UtAssert_EVENTCOUNT(3); @@ -3069,7 +3067,7 @@ void Test_AllocateMessageBuffer(void) * allocation failed) */ UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_MEM_BLOCK_SIZE); - CFE_UtAssert_TRUE(CFE_SB_AllocateMessageBuffer(MsgSize) == NULL); + UtAssert_NULL(CFE_SB_AllocateMessageBuffer(MsgSize)); CFE_UtAssert_EVENTCOUNT(0); @@ -3082,13 +3080,13 @@ void Test_AllocateMessageBuffer(void) CFE_SB_Global.StatTlmMsg.Payload.MemInUse = 0; CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse = MemUse + 10; CFE_SB_Global.StatTlmMsg.Payload.PeakSBBuffersInUse = CFE_SB_Global.StatTlmMsg.Payload.SBBuffersInUse + 2; - CFE_UtAssert_TRUE(CFE_SB_AllocateMessageBuffer(MsgSize) != NULL); + UtAssert_NOT_NULL(CFE_SB_AllocateMessageBuffer(MsgSize)); - CFE_UtAssert_EQUAL(CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse, MemUse + 10); /* unchanged */ - CFE_UtAssert_EQUAL(CFE_SB_Global.StatTlmMsg.Payload.MemInUse, MemUse); /* predicted value */ + UtAssert_INT32_EQ(CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse, MemUse + 10); /* unchanged */ + UtAssert_INT32_EQ(CFE_SB_Global.StatTlmMsg.Payload.MemInUse, MemUse); /* predicted value */ - CFE_UtAssert_EQUAL(CFE_SB_Global.StatTlmMsg.Payload.PeakSBBuffersInUse, - CFE_SB_Global.StatTlmMsg.Payload.SBBuffersInUse + 1); + UtAssert_INT32_EQ(CFE_SB_Global.StatTlmMsg.Payload.PeakSBBuffersInUse, + CFE_SB_Global.StatTlmMsg.Payload.SBBuffersInUse + 1); CFE_UtAssert_EVENTCOUNT(0); @@ -3112,16 +3110,16 @@ void Test_TransmitMsg_ZeroCopyBufferValidate(void) memset(&BadZeroCpyBuf, 0, sizeof(BadZeroCpyBuf)); /* Null Buffer => BAD_ARGUMENT */ - CFE_UtAssert_EQUAL(CFE_SB_ZeroCopyBufferValidate(NULL, &BufDscPtr), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_ZeroCopyBufferValidate(NULL, &BufDscPtr), CFE_SB_BAD_ARGUMENT); /* Non-null buffer pointer but Non Zero-Copy => CFE_SB_BUFFER_INVALID */ - CFE_UtAssert_EQUAL(CFE_SB_ZeroCopyBufferValidate(&BadZeroCpyBuf.Content, &BufDscPtr), CFE_SB_BUFFER_INVALID); + UtAssert_INT32_EQ(CFE_SB_ZeroCopyBufferValidate(&BadZeroCpyBuf.Content, &BufDscPtr), CFE_SB_BUFFER_INVALID); /* Good buffer pointer + Good Handle => SUCCESS */ - CFE_UtAssert_EQUAL(CFE_SB_ZeroCopyBufferValidate(SendPtr, &BufDscPtr), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_SB_ZeroCopyBufferValidate(SendPtr, &BufDscPtr)); /* Confirm that the computed pointer was correct */ - CFE_UtAssert_TRUE(&BufDscPtr->Content == SendPtr); + UtAssert_ADDRESS_EQ(&BufDscPtr->Content, SendPtr); /* Clean-up */ CFE_SB_ReleaseMessageBuffer(SendPtr); @@ -3166,9 +3164,9 @@ void Test_TransmitBuffer_IncrementSeqCnt(void) CFE_UtAssert_SUCCESS(CFE_SB_ReceiveBuffer(&ReceivePtr, PipeId, CFE_SB_PEND_FOREVER)); - CFE_UtAssert_TRUE(SendPtr == ReceivePtr); + UtAssert_ADDRESS_EQ(SendPtr, ReceivePtr); - CFE_UtAssert_EQUAL(SeqCnt, 1); + UtAssert_INT32_EQ(SeqCnt, 1); CFE_UtAssert_EVENTCOUNT(2); @@ -3213,8 +3211,8 @@ void Test_TransmitBuffer_NoIncrement(void) CFE_UtAssert_SUCCESS(CFE_SB_TransmitBuffer(SendPtr, false)); CFE_UtAssert_SUCCESS(CFE_SB_ReceiveBuffer(&ReceivePtr, PipeId, CFE_SB_PEND_FOREVER)); - CFE_UtAssert_TRUE(SendPtr == ReceivePtr); - CFE_UtAssert_EQUAL(SeqCnt, 22); + UtAssert_ADDRESS_EQ(SendPtr, ReceivePtr); + UtAssert_INT32_EQ(SeqCnt, 22); CFE_UtAssert_EVENTCOUNT(2); @@ -3240,14 +3238,14 @@ void Test_ReleaseMessageBuffer(void) CFE_UtAssert_SETUP(CFE_SB_ReleaseMessageBuffer(ZeroCpyMsgPtr2)); /* Test response to an invalid buffer (has been released already) */ - CFE_UtAssert_EQUAL(CFE_SB_ReleaseMessageBuffer(ZeroCpyMsgPtr2), CFE_SB_BUFFER_INVALID); + UtAssert_INT32_EQ(CFE_SB_ReleaseMessageBuffer(ZeroCpyMsgPtr2), CFE_SB_BUFFER_INVALID); /* Test response to a null message pointer */ - CFE_UtAssert_EQUAL(CFE_SB_ReleaseMessageBuffer(NULL), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_ReleaseMessageBuffer(NULL), CFE_SB_BAD_ARGUMENT); /* Test response to an invalid message pointer */ memset(&BadBufferDesc, 0, sizeof(BadBufferDesc)); - CFE_UtAssert_EQUAL(CFE_SB_ReleaseMessageBuffer(&BadBufferDesc.Content), CFE_SB_BUFFER_INVALID); + UtAssert_INT32_EQ(CFE_SB_ReleaseMessageBuffer(&BadBufferDesc.Content), CFE_SB_BUFFER_INVALID); /* Test successful release of the second buffer */ CFE_UtAssert_SUCCESS(CFE_SB_ReleaseMessageBuffer(ZeroCpyMsgPtr3)); @@ -3341,10 +3339,10 @@ void Test_TransmitMsgValidate_MaxMsgSizePlusOne(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - CFE_UtAssert_EQUAL(CFE_SB_TransmitMsgValidate(&TlmPkt.Hdr.Msg, &MsgIdRtn, &SizeRtn, &RouteIdRtn), - CFE_SB_MSG_TOO_BIG); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(MsgIdRtn), CFE_SB_MsgIdToValue(MsgId)); - CFE_UtAssert_EQUAL(SizeRtn, Size); + UtAssert_INT32_EQ(CFE_SB_TransmitMsgValidate(&TlmPkt.Hdr.Msg, &MsgIdRtn, &SizeRtn, &RouteIdRtn), + CFE_SB_MSG_TOO_BIG); + CFE_UtAssert_MSGID_EQ(MsgIdRtn, MsgId); + UtAssert_INT32_EQ(SizeRtn, Size); CFE_UtAssert_EVENTCOUNT(1); @@ -3367,9 +3365,9 @@ void Test_TransmitMsgValidate_NoSubscribers(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsgValidate(&TlmPkt.Hdr.Msg, &MsgIdRtn, &SizeRtn, &RouteIdRtn)); - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(MsgIdRtn), CFE_SB_MsgIdToValue(MsgId)); - CFE_UtAssert_EQUAL(SizeRtn, Size); - CFE_UtAssert_TRUE(!CFE_SBR_IsValidRouteId(RouteIdRtn)); + CFE_UtAssert_MSGID_EQ(MsgIdRtn, MsgId); + UtAssert_INT32_EQ(SizeRtn, Size); + CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(RouteIdRtn)); CFE_UtAssert_EVENTCOUNT(1); @@ -3398,7 +3396,7 @@ void Test_ReceiveBuffer_InvalidPipeId(void) CFE_SB_Buffer_t *SBBufPtr; CFE_SB_PipeId_t InvalidPipeId = SB_UT_ALTERNATE_INVALID_PIPEID; - CFE_UtAssert_EQUAL(CFE_SB_ReceiveBuffer(&SBBufPtr, InvalidPipeId, CFE_SB_POLL), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&SBBufPtr, InvalidPipeId, CFE_SB_POLL), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(1); @@ -3418,7 +3416,7 @@ void Test_ReceiveBuffer_InvalidTimeout(void) CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); - CFE_UtAssert_EQUAL(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, TimeOut), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, TimeOut), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(2); @@ -3439,7 +3437,7 @@ void Test_ReceiveBuffer_Poll(void) CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); - CFE_UtAssert_EQUAL(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, CFE_SB_POLL), CFE_SB_NO_MESSAGE); + UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, CFE_SB_POLL), CFE_SB_NO_MESSAGE); CFE_UtAssert_EVENTCOUNT(1); @@ -3462,7 +3460,7 @@ void Test_ReceiveBuffer_Timeout(void) CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); UT_SetDeferredRetcode(UT_KEY(OS_QueueGet), 1, OS_QUEUE_TIMEOUT); - CFE_UtAssert_EQUAL(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, TimeOut), CFE_SB_TIME_OUT); + UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, TimeOut), CFE_SB_TIME_OUT); CFE_UtAssert_EVENTCOUNT(1); @@ -3483,7 +3481,7 @@ void Test_ReceiveBuffer_PipeReadError(void) CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); UT_SetDeferredRetcode(UT_KEY(OS_QueueGet), 1, OS_ERROR); - CFE_UtAssert_EQUAL(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, CFE_SB_PEND_FOREVER), CFE_SB_PIPE_RD_ERR); + UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, CFE_SB_PEND_FOREVER), CFE_SB_PIPE_RD_ERR); CFE_UtAssert_EVENTCOUNT(2); @@ -3515,7 +3513,7 @@ void Test_ReceiveBuffer_PendForever(void) CFE_UtAssert_SUCCESS(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, CFE_SB_PEND_FOREVER)); - CFE_UtAssert_TRUE(SBBufPtr != NULL); + UtAssert_NOT_NULL(SBBufPtr); CFE_UtAssert_EVENTCOUNT(2); @@ -3597,7 +3595,7 @@ void Test_ReceiveBuffer_InvalidBufferPtr(void) CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvTestPipe")); - CFE_UtAssert_EQUAL(CFE_SB_ReceiveBuffer(NULL, PipeId, CFE_SB_PEND_FOREVER), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(NULL, PipeId, CFE_SB_PEND_FOREVER), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(2); @@ -3632,26 +3630,26 @@ void Test_CFE_SB_MsgHdrSize(void) type = CFE_MSG_Type_Invalid; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - CFE_UtAssert_EQUAL(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_Message_t)); + CFE_UtAssert_MEMOFFSET_EQ(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_Message_t)); /* Has secondary, tlm type */ hassec = true; type = CFE_MSG_Type_Tlm; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - CFE_UtAssert_EQUAL(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_TelemetryHeader_t)); + CFE_UtAssert_MEMOFFSET_EQ(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_TelemetryHeader_t)); /* Has secondary, cmd type */ type = CFE_MSG_Type_Cmd; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - CFE_UtAssert_EQUAL(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_CommandHeader_t)); + CFE_UtAssert_MEMOFFSET_EQ(CFE_SB_MsgHdrSize(&msg), sizeof(CFE_MSG_CommandHeader_t)); /* Has secondary, invalid type */ type = CFE_MSG_Type_Invalid; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - CFE_UtAssert_EQUAL(CFE_SB_MsgHdrSize(&msg), 0); + CFE_UtAssert_MEMOFFSET_EQ(CFE_SB_MsgHdrSize(&msg), 0); } /* end Test_CFE_SB_MsgHdrSize */ @@ -3761,7 +3759,7 @@ void Test_CFE_SB_SetGetUserDataLength(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &size, sizeof(size), false); - CFE_UtAssert_EQUAL(CFE_SB_GetUserDataLength(&msg), size - sizeof(CCSDS_SpacePacket_t)); + UtAssert_INT32_EQ(CFE_SB_GetUserDataLength(&msg), size - sizeof(CCSDS_SpacePacket_t)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); @@ -3778,11 +3776,11 @@ void Test_CFE_SB_ValidateMsgId(void) /* Validate Msg Id */ MsgId = SB_UT_LAST_VALID_MID; - CFE_UtAssert_EQUAL(CFE_SB_ValidateMsgId(MsgId), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_SB_ValidateMsgId(MsgId)); /* Test for invalid msg id */ MsgId = SB_UT_ALTERNATE_INVALID_MID; - CFE_UtAssert_EQUAL(CFE_SB_ValidateMsgId(MsgId), CFE_SB_FAILED); + UtAssert_INT32_EQ(CFE_SB_ValidateMsgId(MsgId), CFE_SB_FAILED); } /* @@ -3841,12 +3839,12 @@ void Test_ReqToSendEvent_ErrLogic(void) */ CFE_ES_GetTaskID(&TaskId); CFE_SB_Global.StopRecurseFlags[0] = 0x0000; - CFE_UtAssert_EQUAL(CFE_SB_RequestToSendEvent(TaskId, Bit), CFE_SB_GRANTED); + UtAssert_INT32_EQ(CFE_SB_RequestToSendEvent(TaskId, Bit), CFE_SB_GRANTED); /* Call the function a second time; the result should indicate that the * bit is already set */ - CFE_UtAssert_EQUAL(CFE_SB_RequestToSendEvent(TaskId, Bit), CFE_SB_DENIED); + UtAssert_INT32_EQ(CFE_SB_RequestToSendEvent(TaskId, Bit), CFE_SB_DENIED); CFE_UtAssert_EVENTCOUNT(0); @@ -3858,7 +3856,7 @@ void Test_ReqToSendEvent_ErrLogic(void) */ void Test_PutDestBlk_ErrLogic(void) { - CFE_UtAssert_EQUAL(CFE_SB_PutDestinationBlk(NULL), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_PutDestinationBlk(NULL), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(0); @@ -3877,7 +3875,7 @@ void Test_CFE_SB_Buffers(void) CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse = sizeof(CFE_SB_BufferD_t) * 4; bd = CFE_SB_GetBufferFromPool(0); - CFE_UtAssert_EQUAL(CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse, sizeof(CFE_SB_BufferD_t) * 4); + UtAssert_INT32_EQ(CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse, sizeof(CFE_SB_BufferD_t) * 4); CFE_UtAssert_EVENTCOUNT(0); @@ -3888,13 +3886,13 @@ void Test_CFE_SB_Buffers(void) ExpRtn = CFE_SB_Global.StatTlmMsg.Payload.SBBuffersInUse - 1; UT_SetDeferredRetcode(UT_KEY(CFE_ES_PutPoolBuf), 1, -1); CFE_SB_ReturnBufferToPool(bd); - CFE_UtAssert_EQUAL(CFE_SB_Global.StatTlmMsg.Payload.SBBuffersInUse, ExpRtn); + UtAssert_INT32_EQ(CFE_SB_Global.StatTlmMsg.Payload.SBBuffersInUse, ExpRtn); CFE_UtAssert_EVENTCOUNT(0); bd->UseCount = 0; CFE_SB_DecrBufUseCnt(bd); - CFE_UtAssert_EQUAL(bd->UseCount, 0); + UtAssert_INT32_EQ(bd->UseCount, 0); CFE_UtAssert_EVENTCOUNT(0); @@ -3902,7 +3900,7 @@ void Test_CFE_SB_Buffers(void) CFE_SB_Global.StatTlmMsg.Payload.MemInUse = 0; CFE_SB_PutDestinationBlk((CFE_SB_DestinationD_t *)bd); - CFE_UtAssert_EQUAL(CFE_SB_Global.StatTlmMsg.Payload.MemInUse, 0); + UtAssert_INT32_EQ(CFE_SB_Global.StatTlmMsg.Payload.MemInUse, 0); CFE_UtAssert_EVENTCOUNT(0); @@ -3924,14 +3922,14 @@ void Test_CFE_SB_BadPipeInfo(void) PipeDscPtr = CFE_SB_LocatePipeDescByID(PipeId); PipeDscPtr->PipeId = SB_UT_PIPEID_1; CFE_ES_GetAppID(&AppID); - CFE_UtAssert_EQUAL(CFE_SB_DeletePipeFull(SB_UT_PIPEID_0, AppID), CFE_SB_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_SB_DeletePipeFull(SB_UT_PIPEID_0, AppID), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(2); /* Reset the pipe ID and delete the pipe */ PipeDscPtr->PipeId = PipeId; - CFE_UtAssert_EQUAL( + UtAssert_INT32_EQ( CFE_SB_SubscribeFull(SB_UT_FIRST_VALID_MID, PipeId, CFE_SB_DEFAULT_QOS, CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT, 2), CFE_SB_BAD_ARGUMENT); @@ -3974,8 +3972,8 @@ void Test_SB_TransmitMsgPaths_Nominal(void) CFE_SB_ProcessCmdPipePkt(&Housekeeping.SBBuf); /* The no subs event should not be in history but count should increment */ - CFE_UtAssert_TRUE(!UT_EventIsInHistory(CFE_SB_SEND_NO_SUBS_EID)); - CFE_UtAssert_EQUAL(CFE_SB_Global.HKTlmMsg.Payload.NoSubscribersCounter, 1); + CFE_UtAssert_EVENTNOTSENT(CFE_SB_SEND_NO_SUBS_EID); + UtAssert_INT32_EQ(CFE_SB_Global.HKTlmMsg.Payload.NoSubscribersCounter, 1); /* Repress get buffer error */ CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter = 0; @@ -3993,9 +3991,9 @@ void Test_SB_TransmitMsgPaths_Nominal(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_MEM_BLOCK_SIZE); CFE_SB_ProcessCmdPipePkt(&Housekeeping.SBBuf); - CFE_UtAssert_EQUAL(CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter, 0); + UtAssert_INT32_EQ(CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter, 0); - CFE_UtAssert_TRUE(!UT_EventIsInHistory(CFE_SB_GET_BUF_ERR_EID)); + CFE_UtAssert_EVENTNOTSENT(CFE_SB_GET_BUF_ERR_EID); CFE_UtAssert_EVENTCOUNT(0); @@ -4008,7 +4006,7 @@ void Test_SB_TransmitMsgPaths_Nominal(void) CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe")); /* Will fail because of deferred CFE_ES_GetPoolBuf failure return */ - CFE_UtAssert_EQUAL(CFE_SB_Subscribe(MsgId, PipeId), CFE_SB_BUF_ALOC_ERR); + UtAssert_INT32_EQ(CFE_SB_Subscribe(MsgId, PipeId), CFE_SB_BUF_ALOC_ERR); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -4052,7 +4050,7 @@ void Test_SB_TransmitMsgPaths_LimitErr(void) CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); CFE_SB_Global.StopRecurseFlags[1] = 0; - CFE_UtAssert_TRUE(!UT_EventIsInHistory(CFE_SB_MSGID_LIM_ERR_EID)); + CFE_UtAssert_EVENTNOTSENT(CFE_SB_MSGID_LIM_ERR_EID); CFE_UtAssert_TEARDOWN(CFE_SB_DeletePipe(PipeId)); @@ -4089,7 +4087,7 @@ void Test_SB_TransmitMsgPaths_FullErr(void) CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); CFE_SB_Global.StopRecurseFlags[1] = 0; - CFE_UtAssert_TRUE(!UT_EventIsInHistory(CFE_SB_Q_FULL_ERR_EID_BIT)); + CFE_UtAssert_EVENTNOTSENT(CFE_SB_Q_FULL_ERR_EID_BIT); CFE_UtAssert_EVENTCOUNT(2); @@ -4127,7 +4125,7 @@ void Test_SB_TransmitMsgPaths_WriteErr(void) CFE_UtAssert_EVENTCOUNT(2); - CFE_UtAssert_TRUE(!UT_EventIsInHistory(CFE_SB_Q_WR_ERR_EID)); + CFE_UtAssert_EVENTNOTSENT(CFE_SB_Q_WR_ERR_EID); CFE_UtAssert_TEARDOWN(CFE_SB_DeletePipe(PipeId)); @@ -4185,7 +4183,7 @@ void Test_ReceiveBuffer_UnsubResubPath(void) CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId)); CFE_UtAssert_SUCCESS(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, CFE_SB_PEND_FOREVER)); - CFE_UtAssert_TRUE(SBBufPtr != NULL); + UtAssert_NOT_NULL(SBBufPtr); CFE_UtAssert_EVENTCOUNT(4); @@ -4201,49 +4199,54 @@ void Test_ReceiveBuffer_UnsubResubPath(void) */ void Test_MessageString(void) { - const char *SrcString = "abcdefg"; - char DestString[20]; - char * DestStringPtr = DestString; - const char *DefString = "default"; + char SrcString[12]; + char DestString[12]; + const char DefString[] = "default"; + + strcpy(SrcString, "abcdefg"); + memset(DestString, 'q', sizeof(DestString)); /* Test setting string where the destination size > source string size */ - CFE_SB_MessageStringSet(DestStringPtr, SrcString, sizeof(DestString), strlen(SrcString)); - UT_Report(__FILE__, __LINE__, strcmp(DestString, SrcString) == 0, "CFE_SB_MessageStringSet", - "Destination size > source string size"); + CFE_SB_MessageStringSet(DestString, SrcString, sizeof(DestString), sizeof(SrcString)); + CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, sizeof(SrcString)); /* Test setting string where the source string is empty */ - CFE_SB_MessageStringSet(DestStringPtr, "", sizeof(DestString), strlen(SrcString)); - UT_Report(__FILE__, __LINE__, strcmp(DestString, SrcString) != 0, "CFE_SB_MessageStringSet", "Empty source string"); + memset(SrcString, 0, sizeof(SrcString)); + memset(DestString, 'q', sizeof(DestString)); + CFE_SB_MessageStringSet(DestString, SrcString, sizeof(DestString), sizeof(SrcString)); + CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, sizeof(SrcString)); /* Test setting string where the destination size < source string size */ - CFE_SB_MessageStringSet(DestStringPtr, SrcString, strlen(SrcString) - 1, strlen(SrcString)); - UT_Report(__FILE__, __LINE__, strncmp(DestString, SrcString, strlen(SrcString) - 1) == 0, "CFE_SB_MessageStringSet", - "Destination size < source string size"); + strcpy(SrcString, "abcdefg"); + memset(DestString, 'q', sizeof(DestString)); + CFE_SB_MessageStringSet(DestString, SrcString, 4, sizeof(SrcString)); + CFE_UtAssert_STRINGBUF_EQ(DestString, 4, SrcString, 4); /* Test getting string where the destination size > source string size */ - CFE_SB_MessageStringGet(DestStringPtr, SrcString, DefString, sizeof(DestString), strlen(SrcString)); - UT_Report(__FILE__, __LINE__, strcmp(DestString, SrcString) == 0, "CFE_SB_MessageStringGet", - "Destination size > source string size"); + strcpy(SrcString, "abcdefg"); + memset(DestString, 'q', sizeof(DestString)); + CFE_SB_MessageStringGet(DestString, SrcString, DefString, sizeof(DestString), 5); + CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, 5); /* Test getting string where the destination size is zero */ - DestString[0] = '\0'; - CFE_SB_MessageStringGet(DestStringPtr, SrcString, DefString, 0, strlen(SrcString)); - UT_Report(__FILE__, __LINE__, strcmp(DestString, SrcString) != 0, "CFE_SB_MessageStringGet", - "Destination size = 0"); + memset(DestString, 'q', sizeof(DestString)); + memset(SrcString, 'k', sizeof(SrcString)); + CFE_SB_MessageStringGet(DestString, SrcString, DefString, 0, sizeof(SrcString)); + memset(SrcString, 'q', sizeof(SrcString)); + CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), SrcString, sizeof(SrcString)); /* Test getting string where the default string is NULL */ - CFE_SB_MessageStringGet(DestStringPtr, SrcString, NULL, sizeof(DestString), 0); - UT_Report(__FILE__, __LINE__, strcmp(DefString, SrcString) != 0, "CFE_SB_MessageStringGet", - "Default string = NULL"); + memset(DestString, 'q', sizeof(DestString)); + CFE_SB_MessageStringGet(DestString, SrcString, NULL, sizeof(DestString), 0); + CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), "", 0); /* Test getting string where the source string size is zero */ - CFE_SB_MessageStringGet(DestStringPtr, SrcString, DefString, sizeof(DestString), 0); - UT_Report(__FILE__, __LINE__, strcmp(DestString, SrcString) != 0, "CFE_SB_MessageStringGet", - "Source string size = 0"); + CFE_SB_MessageStringGet(DestString, SrcString, DefString, sizeof(DestString), 0); + CFE_UtAssert_STRINGBUF_EQ(DestString, sizeof(DestString), DefString, sizeof(DefString)); /* Test getting string where the destination size < source string size */ - DestString[0] = '\0'; - CFE_SB_MessageStringGet(DestStringPtr, SrcString, DefString, strlen(SrcString) - 1, strlen(SrcString)); - UT_Report(__FILE__, __LINE__, strncmp(DestString, SrcString, strlen(DestString)) == 0, "CFE_SB_MessageStringGet", - "Destination size < source string size"); + strcpy(SrcString, "abcdefg"); + memset(DestString, 'q', sizeof(DestString)); + CFE_SB_MessageStringGet(DestString, SrcString, DefString, 4, sizeof(SrcString)); + CFE_UtAssert_STRINGBUF_EQ(DestString, 4, SrcString, 3); } /* end Test_MessageString */ diff --git a/modules/sbr/ut-coverage/test_cfe_sbr_map_direct.c b/modules/sbr/ut-coverage/test_cfe_sbr_map_direct.c index d9c673abd..38800a178 100644 --- a/modules/sbr/ut-coverage/test_cfe_sbr_map_direct.c +++ b/modules/sbr/ut-coverage/test_cfe_sbr_map_direct.c @@ -41,8 +41,8 @@ void Test_SBR_Map_Direct(void) uint32 i; UtPrintf("Invalid msg checks"); - CFE_UtAssert_EQUAL(CFE_SBR_SetRouteId(CFE_SB_ValueToMsgId(0), CFE_SBR_ValueToRouteId(0)), 0); - CFE_UtAssert_EQUAL(CFE_SBR_IsValidRouteId(CFE_SBR_GetRouteId(CFE_SB_ValueToMsgId(0))), false); + UtAssert_INT32_EQ(CFE_SBR_SetRouteId(CFE_SB_ValueToMsgId(0), CFE_SBR_ValueToRouteId(0)), 0); + CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_GetRouteId(CFE_SB_ValueToMsgId(0)))); UtPrintf("Initialize map"); CFE_SBR_Init_Map(); @@ -59,18 +59,18 @@ void Test_SBR_Map_Direct(void) count++; } } - CFE_UtAssert_EQUAL(count, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1); + UtAssert_INT32_EQ(count, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1); UtPrintf("Set/Get a range of ids "); routeid = CFE_SBR_ValueToRouteId(CFE_PLATFORM_SB_MAX_MSG_IDS + 1); msgid = CFE_SB_ValueToMsgId(0); - CFE_UtAssert_EQUAL(CFE_SBR_SetRouteId(msgid, routeid), 0); - CFE_UtAssert_EQUAL(CFE_SBR_GetRouteId(msgid).RouteId, routeid.RouteId); + UtAssert_INT32_EQ(CFE_SBR_SetRouteId(msgid, routeid), 0); + UtAssert_INT32_EQ(CFE_SBR_GetRouteId(msgid).RouteId, routeid.RouteId); routeid = CFE_SBR_ValueToRouteId(0); msgid = CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); - CFE_UtAssert_EQUAL(CFE_SBR_SetRouteId(msgid, routeid), 0); - CFE_UtAssert_EQUAL(CFE_SBR_GetRouteId(msgid).RouteId, routeid.RouteId); + UtAssert_INT32_EQ(CFE_SBR_SetRouteId(msgid, routeid), 0); + UtAssert_INT32_EQ(CFE_SBR_GetRouteId(msgid).RouteId, routeid.RouteId); UtPrintf("Check there is now 1 valid entry in map"); count = 0; @@ -81,13 +81,13 @@ void Test_SBR_Map_Direct(void) count++; } } - CFE_UtAssert_EQUAL(count, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); + UtAssert_INT32_EQ(count, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); UtPrintf("Set back to invalid and check again"); routeid = CFE_SBR_INVALID_ROUTE_ID; - CFE_UtAssert_EQUAL(CFE_SBR_SetRouteId(msgid, routeid), 0); - CFE_UtAssert_EQUAL(CFE_SBR_GetRouteId(msgid).RouteId, routeid.RouteId); - CFE_UtAssert_EQUAL(CFE_SBR_IsValidRouteId(CFE_SBR_GetRouteId(msgid)), false); + UtAssert_INT32_EQ(CFE_SBR_SetRouteId(msgid, routeid), 0); + UtAssert_INT32_EQ(CFE_SBR_GetRouteId(msgid).RouteId, routeid.RouteId); + CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_GetRouteId(msgid))); /* Performance check, 0xFFFFFF on 3.2GHz linux box is around 8-9 seconds */ count = 0; diff --git a/modules/sbr/ut-coverage/test_cfe_sbr_map_hash.c b/modules/sbr/ut-coverage/test_cfe_sbr_map_hash.c index f7a8a8110..1f173584a 100644 --- a/modules/sbr/ut-coverage/test_cfe_sbr_map_hash.c +++ b/modules/sbr/ut-coverage/test_cfe_sbr_map_hash.c @@ -60,8 +60,8 @@ void Test_SBR_Map_Hash(void) uint32 collisions; UtPrintf("Invalid msg checks"); - CFE_UtAssert_EQUAL(CFE_SBR_SetRouteId(CFE_SB_ValueToMsgId(0), CFE_SBR_ValueToRouteId(0)), 0); - CFE_UtAssert_EQUAL(CFE_SBR_IsValidRouteId(CFE_SBR_GetRouteId(CFE_SB_ValueToMsgId(0))), false); + UtAssert_INT32_EQ(CFE_SBR_SetRouteId(CFE_SB_ValueToMsgId(0), CFE_SBR_ValueToRouteId(0)), 0); + CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_GetRouteId(CFE_SB_ValueToMsgId(0)))); UtPrintf("Initialize routing and map"); CFE_SBR_Init(); @@ -78,7 +78,7 @@ void Test_SBR_Map_Hash(void) count++; } } - CFE_UtAssert_EQUAL(count, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1); + UtAssert_INT32_EQ(count, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1); /* Note AddRoute required for hash logic to work since it depends on MsgId in routing table */ UtPrintf("Add routes and check with a rollover and a skip"); @@ -86,15 +86,15 @@ void Test_SBR_Map_Hash(void) msgid[1] = Test_SBR_Unhash(0xFFFFFFFF); msgid[2] = Test_SBR_Unhash(0x7FFFFFFF); routeid[0] = CFE_SBR_AddRoute(msgid[0], &collisions); - CFE_UtAssert_EQUAL(collisions, 0); + UtAssert_INT32_EQ(collisions, 0); routeid[1] = CFE_SBR_AddRoute(msgid[1], &collisions); - CFE_UtAssert_EQUAL(collisions, 0); + UtAssert_INT32_EQ(collisions, 0); routeid[2] = CFE_SBR_AddRoute(msgid[2], &collisions); - CFE_UtAssert_EQUAL(collisions, 2); + UtAssert_INT32_EQ(collisions, 2); - CFE_UtAssert_EQUAL(CFE_SBR_RouteIdToValue(CFE_SBR_GetRouteId(msgid[0])), CFE_SBR_RouteIdToValue(routeid[0])); - CFE_UtAssert_EQUAL(CFE_SBR_RouteIdToValue(CFE_SBR_GetRouteId(msgid[1])), CFE_SBR_RouteIdToValue(routeid[1])); - CFE_UtAssert_EQUAL(CFE_SBR_RouteIdToValue(CFE_SBR_GetRouteId(msgid[2])), CFE_SBR_RouteIdToValue(routeid[2])); + UtAssert_INT32_EQ(CFE_SBR_RouteIdToValue(CFE_SBR_GetRouteId(msgid[0])), CFE_SBR_RouteIdToValue(routeid[0])); + UtAssert_INT32_EQ(CFE_SBR_RouteIdToValue(CFE_SBR_GetRouteId(msgid[1])), CFE_SBR_RouteIdToValue(routeid[1])); + UtAssert_INT32_EQ(CFE_SBR_RouteIdToValue(CFE_SBR_GetRouteId(msgid[2])), CFE_SBR_RouteIdToValue(routeid[2])); /* Performance check, 0xFFFFFF on 3.2GHz linux box is around 8-9 seconds */ count = 0; diff --git a/modules/sbr/ut-coverage/test_cfe_sbr_route_unsorted.c b/modules/sbr/ut-coverage/test_cfe_sbr_route_unsorted.c index b783f9a60..0b654041c 100644 --- a/modules/sbr/ut-coverage/test_cfe_sbr_route_unsorted.c +++ b/modules/sbr/ut-coverage/test_cfe_sbr_route_unsorted.c @@ -51,9 +51,9 @@ void Test_SBR_Route_Unsort_General(void) CFE_SBR_Init(); UtPrintf("Invalid msg checks"); - CFE_UtAssert_TRUE(!CFE_SBR_IsValidRouteId(CFE_SBR_AddRoute(CFE_SB_ValueToMsgId(0), NULL))); - CFE_UtAssert_TRUE(!CFE_SBR_IsValidRouteId(CFE_SBR_AddRoute(CFE_SB_ValueToMsgId(0), &collisions))); - CFE_UtAssert_EQUAL(collisions, 0); + CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_AddRoute(CFE_SB_ValueToMsgId(0), NULL))); + CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_AddRoute(CFE_SB_ValueToMsgId(0), &collisions))); + UtAssert_INT32_EQ(collisions, 0); /* * Force valid msgid responses @@ -65,18 +65,18 @@ void Test_SBR_Route_Unsort_General(void) UtPrintf("Callback test with no routes"); count = 0; CFE_SBR_ForEachRouteId(Test_SBR_Callback, &count, NULL); - CFE_UtAssert_EQUAL(count, 0); + UtAssert_INT32_EQ(count, 0); UtPrintf("Add maximum mesage id value"); msgid = CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); routeid = CFE_SBR_AddRoute(msgid, &collisions); - CFE_UtAssert_EQUAL(collisions, 0); + UtAssert_INT32_EQ(collisions, 0); CFE_UtAssert_TRUE(CFE_SBR_IsValidRouteId(routeid)); UtPrintf("Callback test with one route"); count = 0; CFE_SBR_ForEachRouteId(Test_SBR_Callback, &count, NULL); - CFE_UtAssert_EQUAL(count, 1); + UtAssert_INT32_EQ(count, 1); UtPrintf("Fill routing table"); count = 0; @@ -86,30 +86,30 @@ void Test_SBR_Route_Unsort_General(void) } /* Check for expected count indicating full routing table */ - CFE_UtAssert_EQUAL(count + 1, CFE_PLATFORM_SB_MAX_MSG_IDS); + UtAssert_INT32_EQ(count + 1, CFE_PLATFORM_SB_MAX_MSG_IDS); /* Try one more for good luck */ - CFE_UtAssert_TRUE(!CFE_SBR_IsValidRouteId(CFE_SBR_AddRoute(CFE_SB_ValueToMsgId(count), NULL))); + CFE_UtAssert_FALSE(CFE_SBR_IsValidRouteId(CFE_SBR_AddRoute(CFE_SB_ValueToMsgId(count), NULL))); /* Check that maximum msgid is still in the table */ - CFE_UtAssert_EQUAL(CFE_SB_MsgIdToValue(CFE_SBR_GetMsgId(routeid)), CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); - CFE_UtAssert_EQUAL(CFE_SBR_GetRouteId(msgid).RouteId, routeid.RouteId); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(CFE_SBR_GetMsgId(routeid)), CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); + UtAssert_INT32_EQ(CFE_SBR_GetRouteId(msgid).RouteId, routeid.RouteId); UtPrintf("Callback test with full route"); count = 0; CFE_SBR_ForEachRouteId(Test_SBR_Callback, &count, NULL); - CFE_UtAssert_EQUAL(count, CFE_PLATFORM_SB_MAX_MSG_IDS); + UtAssert_INT32_EQ(count, CFE_PLATFORM_SB_MAX_MSG_IDS); UtPrintf("Callback test throttled"); throttle.MaxLoop = CFE_PLATFORM_SB_MAX_MSG_IDS - 1; throttle.StartIndex = 0; count = 0; CFE_SBR_ForEachRouteId(Test_SBR_Callback, &count, &throttle); - CFE_UtAssert_EQUAL(count, CFE_PLATFORM_SB_MAX_MSG_IDS - 1); + UtAssert_UINT32_EQ(count, CFE_PLATFORM_SB_MAX_MSG_IDS - 1); count = 0; throttle.StartIndex = throttle.NextIndex; CFE_SBR_ForEachRouteId(Test_SBR_Callback, &count, &throttle); - CFE_UtAssert_EQUAL(count, 1); + UtAssert_INT32_EQ(count, 1); } void Test_SBR_Route_Unsort_GetSet(void) @@ -130,7 +130,7 @@ void Test_SBR_Route_Unsort_GetSet(void) { CFE_UtAssert_TRUE(CFE_SB_MsgId_Equal(CFE_SBR_GetMsgId(routeid[i]), CFE_SB_INVALID_MSG_ID)); UtAssert_ADDRESS_EQ(CFE_SBR_GetDestListHeadPtr(routeid[i]), NULL); - CFE_UtAssert_EQUAL(CFE_SBR_GetSequenceCounter(routeid[i]), 0); + UtAssert_INT32_EQ(CFE_SBR_GetSequenceCounter(routeid[i]), 0); } /* @@ -154,7 +154,7 @@ void Test_SBR_Route_Unsort_GetSet(void) count++; } } - CFE_UtAssert_EQUAL(count, 0); + UtAssert_INT32_EQ(count, 0); UtPrintf("Add routes and initialize values for testing"); msgid[0] = CFE_SB_ValueToMsgId(0); @@ -174,19 +174,19 @@ void Test_SBR_Route_Unsort_GetSet(void) CFE_UtAssert_TRUE(CFE_SB_MsgId_Equal(msgid[i], CFE_SBR_GetMsgId(routeid[i]))); CFE_SBR_IncrementSequenceCounter(routeid[0]); } - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_GetNextSequenceCount)), 3); + UtAssert_STUB_COUNT(CFE_MSG_GetNextSequenceCount, 3); /* Increment route 1 once and set dest pointers */ UT_SetDefaultReturnValue(UT_KEY(CFE_MSG_GetNextSequenceCount), seqcntexpected[1]); CFE_SBR_IncrementSequenceCounter(routeid[1]); - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_GetNextSequenceCount)), 4); + UtAssert_STUB_COUNT(CFE_MSG_GetNextSequenceCount, 4); CFE_SBR_SetDestListHeadPtr(routeid[1], &dest[1]); CFE_SBR_SetDestListHeadPtr(routeid[2], &dest[0]); UtPrintf("Verify remaining set values"); - CFE_UtAssert_EQUAL(CFE_SBR_GetSequenceCounter(routeid[0]), seqcntexpected[0]); - CFE_UtAssert_EQUAL(CFE_SBR_GetSequenceCounter(routeid[1]), seqcntexpected[1]); - CFE_UtAssert_EQUAL(CFE_SBR_GetSequenceCounter(routeid[2]), 0); + UtAssert_UINT32_EQ(CFE_SBR_GetSequenceCounter(routeid[0]), seqcntexpected[0]); + UtAssert_UINT32_EQ(CFE_SBR_GetSequenceCounter(routeid[1]), seqcntexpected[1]); + UtAssert_INT32_EQ(CFE_SBR_GetSequenceCounter(routeid[2]), 0); UtAssert_ADDRESS_EQ(CFE_SBR_GetDestListHeadPtr(routeid[0]), NULL); UtAssert_ADDRESS_EQ(CFE_SBR_GetDestListHeadPtr(routeid[1]), &dest[1]); UtAssert_ADDRESS_EQ(CFE_SBR_GetDestListHeadPtr(routeid[2]), &dest[0]); diff --git a/modules/tbl/ut-coverage/tbl_UT.c b/modules/tbl/ut-coverage/tbl_UT.c index 69716ce16..09172bef2 100644 --- a/modules/tbl/ut-coverage/tbl_UT.c +++ b/modules/tbl/ut-coverage/tbl_UT.c @@ -235,69 +235,66 @@ void Test_CFE_TBL_TaskInit(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); CFE_TBL_TaskMain(); - UT_Report(__FILE__, __LINE__, - ExitCode == CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR && UT_GetStubCount(UT_KEY(CFE_ES_ExitApp)) == 1, - "CFE_TBL_TaskMain", "Success"); + UtAssert_INT32_EQ(ExitCode, CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR); + UtAssert_STUB_COUNT(CFE_ES_ExitApp, 1); /* Test successful table services core application initialization */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TBL_TaskInit() == CFE_SUCCESS, "CFE_TBL_TaskInit", "Success"); + CFE_UtAssert_SUCCESS(CFE_TBL_TaskInit()); /* Test table services core application initialization response to a pipe * creation failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, -2); - UT_Report(__FILE__, __LINE__, CFE_TBL_TaskInit() == -2, "CFE_TBL_TaskInit", "Create pipe fail"); + UtAssert_INT32_EQ(CFE_TBL_TaskInit(), -2); /* Test table services core application initialization response to a * housekeeping request subscription error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 1, -3); - UT_Report(__FILE__, __LINE__, CFE_TBL_TaskInit() == -3, "CFE_TBL_TaskInit", "Housekeeping request subscribe fail"); + UtAssert_INT32_EQ(CFE_TBL_TaskInit(), -3); /* Test table services core application initialization response to a * ground command subscription error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 2, -4); - UT_Report(__FILE__, __LINE__, CFE_TBL_TaskInit() == -4, "CFE_TBL_TaskInit", "Ground command subscribe fail"); + UtAssert_INT32_EQ(CFE_TBL_TaskInit(), -4); /* Test table services core application initialization response to a * send initialization event error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 1, -5); - UT_Report(__FILE__, __LINE__, CFE_TBL_TaskInit() == -5, "CFE_TBL_TaskInit", "Send initialization event fail"); + UtAssert_INT32_EQ(CFE_TBL_TaskInit(), -5); /* Test table services core application initialization response to an * EVS register failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, -6); - UT_Report(__FILE__, __LINE__, CFE_TBL_TaskInit() == -6, "CFE_TBL_TaskInit", "EVS register fail"); + UtAssert_INT32_EQ(CFE_TBL_TaskInit(), -6); /* Test command pipe messages handler response to a valid command */ UT_InitData(); UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_TBL_CMD_NOOP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_NOOP_INF_EID), "CFE_TBL_TaskPipe", - "Valid command (no-op) - success"); + CFE_UtAssert_EVENTSENT(CFE_TBL_NOOP_INF_EID); /* Test command pipe messages handler response to an invalid * message length */ UT_InitData(); UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd) - 1, UT_TPID_CFE_TBL_CMD_NOOP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_LEN_ERR_EID), "CFE_TBL_TaskPipe", - "Invalid message length"); + CFE_UtAssert_EVENTSENT(CFE_TBL_LEN_ERR_EID); /* Test command pipe messages handler response to an invalid * command code */ UT_InitData(); UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_TBL_CMD_INVALID_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_CC1_ERR_EID), "CFE_TBL_TaskPipe", "Invalid command code"); + CFE_UtAssert_EVENTSENT(CFE_TBL_CC1_ERR_EID); /* Test command pipe messages handler response to other errors */ /* Test command pipe messages handler response to "message type" message */ @@ -305,18 +302,16 @@ void Test_CFE_TBL_TaskInit(void) CFE_TBL_Global.CommandCounter = 0; CFE_TBL_Global.CommandErrorCounter = 0; UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_TBL_INVALID_MID); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TBL_MID_ERR_EID) && CFE_TBL_Global.CommandCounter == 0 && - CFE_TBL_Global.CommandErrorCounter == 0, - "CFE_TBL_TaskPipe", "'Message' type message"); + CFE_UtAssert_EVENTSENT(CFE_TBL_MID_ERR_EID); + UtAssert_ZERO(CFE_TBL_Global.CommandCounter); + UtAssert_ZERO(CFE_TBL_Global.CommandErrorCounter); /* Test command pipe messages handler response to "command type" message */ UT_InitData(); UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_TBL_CMD_RESET_COUNTERS_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TBL_RESET_INF_EID) && CFE_TBL_Global.CommandCounter == 0 && - CFE_TBL_Global.CommandErrorCounter == 0, - "CFE_TBL_TaskPipe", "'Command' type message"); + CFE_UtAssert_EVENTSENT(CFE_TBL_RESET_INF_EID); + UtAssert_ZERO(CFE_TBL_Global.CommandCounter); + UtAssert_ZERO(CFE_TBL_Global.CommandErrorCounter); } /* @@ -329,7 +324,7 @@ void Test_CFE_TBL_InitData(void) /* This function has only one possible path with no return code */ UT_InitData(); CFE_TBL_InitData(); - CFE_UtAssert_EQUAL(UT_GetStubCount(UT_KEY(CFE_MSG_Init)), 3); + UtAssert_STUB_COUNT(CFE_MSG_Init, 3); } /* @@ -337,7 +332,6 @@ void Test_CFE_TBL_InitData(void) */ void Test_CFE_TBL_SearchCmdHndlrTbl(void) { - int16 TblIndex = 1; uint16 CmdCode; CFE_SB_MsgId_t MsgID; @@ -347,34 +341,27 @@ void Test_CFE_TBL_SearchCmdHndlrTbl(void) UT_InitData(); MsgID = CFE_SB_ValueToMsgId(CFE_TBL_CMD_MID); CmdCode = CFE_TBL_NOOP_CC; - UT_Report(__FILE__, __LINE__, CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, "CFE_TBL_SearchCmdHndlrTbl", - "Found matching message ID and command code"); + UtAssert_INT32_EQ(CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode), 1); /* Test using a message that is not a command message with specific * command code */ UT_InitData(); - TblIndex = 0; - MsgID = CFE_SB_ValueToMsgId(CFE_TBL_SEND_HK_MID); - UT_Report(__FILE__, __LINE__, CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, "CFE_TBL_SearchCmdHndlrTbl", - "Message is not a command message with specific command code"); + MsgID = CFE_SB_ValueToMsgId(CFE_TBL_SEND_HK_MID); + UtAssert_INT32_EQ(CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode), 0); /* Test with a message ID that matches but the command code does * not match */ UT_InitData(); - TblIndex = CFE_TBL_BAD_CMD_CODE; - MsgID = CFE_SB_ValueToMsgId(CFE_TBL_CMD_MID); - CmdCode = 0xffff; - UT_Report(__FILE__, __LINE__, CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, "CFE_TBL_SearchCmdHndlrTbl", - "Message ID matches, command code must does not match"); + MsgID = CFE_SB_ValueToMsgId(CFE_TBL_CMD_MID); + CmdCode = 0xffff; + UtAssert_INT32_EQ(CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode), CFE_TBL_BAD_CMD_CODE); /* Test with a message ID that does not match */ UT_InitData(); - TblIndex = CFE_TBL_BAD_MSG_ID; - MsgID = CFE_SB_INVALID_MSG_ID; - UT_Report(__FILE__, __LINE__, CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, "CFE_TBL_SearchCmdHndlrTbl", - "Message ID does not match"); + MsgID = CFE_SB_INVALID_MSG_ID; + UtAssert_INT32_EQ(CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode), CFE_TBL_BAD_MSG_ID); } /* @@ -391,8 +378,7 @@ void Test_CFE_TBL_DeleteCDSCmd(void) UT_InitData(); strncpy(DelCDSCmd.Payload.TableName, "0", sizeof(DelCDSCmd.Payload.TableName) - 1); DelCDSCmd.Payload.TableName[sizeof(DelCDSCmd.Payload.TableName) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DeleteCDSCmd", - "Table name found in table registry"); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_ERR_CTR); /* Test failure to find table in the critical table registry */ UT_InitData(); @@ -405,8 +391,7 @@ void Test_CFE_TBL_DeleteCDSCmd(void) strncpy(DelCDSCmd.Payload.TableName, "-1", sizeof(DelCDSCmd.Payload.TableName) - 1); DelCDSCmd.Payload.TableName[sizeof(DelCDSCmd.Payload.TableName) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DeleteCDSCmd", - "Table not found in critical table registry"); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_ERR_CTR); /* Test finding the table in the critical table registry, but CDS is not * tagged as a table @@ -415,33 +400,27 @@ void Test_CFE_TBL_DeleteCDSCmd(void) snprintf(DelCDSCmd.Payload.TableName, sizeof(DelCDSCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES + CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_ES_CDS_WRONG_TYPE_ERR); - UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DeleteCDSCmd", - "Table is in critical table registry but CDS is not tagged " - "as a table"); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_ERR_CTR); /* Test deletion when CDS owning application is still active */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_ES_CDS_OWNER_ACTIVE_ERR); - UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DeleteCDSCmd", - "CDS owning application is still active"); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_ERR_CTR); /* Test deletion where the table cannot be located in the CDS registry */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_ES_ERR_NAME_NOT_FOUND); - UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DeleteCDSCmd", - "Unable to locate table in CDS registry"); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_ERR_CTR); /* Test deletion error while deleting table from the CDS */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_SUCCESS - 1); - UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DeleteCDSCmd", - "Error while deleting table from CDS"); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_ERR_CTR); /* Test successful removal of the table from the CDS */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_SUCCESS); - UT_Report(__FILE__, __LINE__, CFE_TBL_DeleteCDSCmd(&DelCDSCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_DeleteCDSCmd", - "Successfully removed table from CDS"); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_CMD_CTR); } /* @@ -461,16 +440,14 @@ void Test_CFE_TBL_TlmRegCmd(void) */ strncpy(TlmRegCmd.Payload.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(TlmRegCmd.Payload.TableName) - 1); TlmRegCmd.Payload.TableName[sizeof(TlmRegCmd.Payload.TableName) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_TBL_SendRegistryCmd(&TlmRegCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_SendRegistryCmd", - "Table registry entry for telemetry does exist"); + UtAssert_INT32_EQ(CFE_TBL_SendRegistryCmd(&TlmRegCmd), CFE_TBL_INC_CMD_CTR); /* Test when table name does not exist */ UT_InitData(); snprintf(TlmRegCmd.Payload.TableName, sizeof(TlmRegCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UT_Report(__FILE__, __LINE__, CFE_TBL_SendRegistryCmd(&TlmRegCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_SendRegistryCmd", - "Table registry entry for telemetry doesn't exist"); + UtAssert_INT32_EQ(CFE_TBL_SendRegistryCmd(&TlmRegCmd), CFE_TBL_INC_ERR_CTR); } /* @@ -492,14 +469,12 @@ void Test_CFE_TBL_AbortLoadCmd(void) strncpy(AbortLdCmd.Payload.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(AbortLdCmd.Payload.TableName) - 1); AbortLdCmd.Payload.TableName[sizeof(AbortLdCmd.Payload.TableName) - 1] = '\0'; CFE_TBL_Global.Registry[0].LoadInProgress = 1; - UT_Report(__FILE__, __LINE__, CFE_TBL_AbortLoadCmd(&AbortLdCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_AbortLoadCmd", - "Table registry entry exists & load in progress"); + UtAssert_INT32_EQ(CFE_TBL_AbortLoadCmd(&AbortLdCmd), CFE_TBL_INC_CMD_CTR); /* Test when table name does exist but no table load is in progress */ UT_InitData(); CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - UT_Report(__FILE__, __LINE__, CFE_TBL_AbortLoadCmd(&AbortLdCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_AbortLoadCmd", - "Table registry entry exists but no load in progress"); + UtAssert_INT32_EQ(CFE_TBL_AbortLoadCmd(&AbortLdCmd), CFE_TBL_INC_ERR_CTR); /* Test when table name does exist, a table load is in progress, and the * table is dump only @@ -507,23 +482,20 @@ void Test_CFE_TBL_AbortLoadCmd(void) UT_InitData(); CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; CFE_TBL_Global.Registry[0].DumpOnly = true; - UT_Report(__FILE__, __LINE__, CFE_TBL_AbortLoadCmd(&AbortLdCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_AbortLoadCmd", - "Table registry entry exists, load in progress, dump only"); + UtAssert_INT32_EQ(CFE_TBL_AbortLoadCmd(&AbortLdCmd), CFE_TBL_INC_ERR_CTR); /* Test when table name not found in the registry */ UT_InitData(); snprintf(AbortLdCmd.Payload.TableName, sizeof(AbortLdCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UT_Report(__FILE__, __LINE__, CFE_TBL_AbortLoadCmd(&AbortLdCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_AbortLoadCmd", - "Table registry entry doesn't exist"); + UtAssert_INT32_EQ(CFE_TBL_AbortLoadCmd(&AbortLdCmd), CFE_TBL_INC_ERR_CTR); /* Test when table is double buffered */ UT_InitData(); CFE_TBL_Global.Registry[0].DoubleBuffered = true; CFE_TBL_Global.LoadBuffs[0].Taken = true; CFE_TBL_AbortLoad(&CFE_TBL_Global.Registry[0]); - UT_Report(__FILE__, __LINE__, CFE_TBL_Global.LoadBuffs[0].Taken == true, "CFE_TBL_AbortLoad", - "Table is double buffered"); + CFE_UtAssert_TRUE(CFE_TBL_Global.LoadBuffs[0].Taken); /* Restore values for subsequent tests */ CFE_TBL_Global.Registry[0].LoadInProgress = load; @@ -550,8 +522,7 @@ void Test_CFE_TBL_ActivateCmd(void) */ UT_InitData(); CFE_TBL_Global.Registry[0].DumpOnly = true; - UT_Report(__FILE__, __LINE__, CFE_TBL_ActivateCmd(&ActivateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ActivateCmd", - "Table registry exists, but dump-only table attempted to load"); + UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_TBL_INC_ERR_CTR); /* Test when table name exists, the table is not a dump-only, a load is in * progress, and the table is double-buffered @@ -560,9 +531,7 @@ void Test_CFE_TBL_ActivateCmd(void) CFE_TBL_Global.Registry[0].DumpOnly = false; CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; CFE_TBL_Global.Registry[0].DoubleBuffered = true; - UT_Report(__FILE__, __LINE__, CFE_TBL_ActivateCmd(&ActivateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ActivateCmd", - "Table registry exists, not a dump-only tbl, and a load in " - "progress: Table is double-buffered"); + UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_TBL_INC_ERR_CTR); /* Test when table name exists, the table is not a dump-only, a load is in * progress, the table isn't double-buffered, and ValidationStatus = true @@ -570,9 +539,7 @@ void Test_CFE_TBL_ActivateCmd(void) UT_InitData(); CFE_TBL_Global.Registry[0].DoubleBuffered = false; CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[0].LoadInProgress].Validated = true; - UT_Report(__FILE__, __LINE__, CFE_TBL_ActivateCmd(&ActivateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ActivateCmd", - "Table registry exists, not a dump-only tbl, and a load in " - "progress: Table isn't double-buffered"); + UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_TBL_INC_CMD_CTR); /* Test when table name exists, the table is not a dump-only, no load is in * progress, and no notification message should be sent @@ -580,9 +547,7 @@ void Test_CFE_TBL_ActivateCmd(void) UT_InitData(); CFE_TBL_Global.Registry[0].NotifyByMsg = false; CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - UT_Report(__FILE__, __LINE__, CFE_TBL_ActivateCmd(&ActivateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ActivateCmd", - "Table registry exists, not a dump-only tbl, no load in " - "progress, no notification message"); + UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_TBL_INC_ERR_CTR); /* Test when table name exists, the table is not a dump-only, no load in in * progress, and a notification message should be sent @@ -591,16 +556,13 @@ void Test_CFE_TBL_ActivateCmd(void) UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, CFE_SB_INTERNAL_ERR); CFE_TBL_Global.Registry[0].NotifyByMsg = true; CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - UT_Report(__FILE__, __LINE__, CFE_TBL_ActivateCmd(&ActivateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ActivateCmd", - "Table registry exists, not a dump-only tbl, no load in " - "progress, send notification message"); + UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_TBL_INC_CMD_CTR); /* Test when the table name doesn't exist */ UT_InitData(); snprintf(ActivateCmd.Payload.TableName, sizeof(ActivateCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UT_Report(__FILE__, __LINE__, CFE_TBL_ActivateCmd(&ActivateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ActivateCmd", - "Table registry entry doesn't exist"); + UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_TBL_INC_ERR_CTR); /* Restore original values */ CFE_TBL_Global.Registry[0].LoadInProgress = load; @@ -619,16 +581,12 @@ void Test_CFE_TBL_DumpToFile(void) /* Test with an error creating the dump file */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes) == CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpToFile", "Error creating dump file"); + UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_TBL_INC_ERR_CTR); /* Test with an error writing the cFE file header */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, sizeof(CFE_FS_Header_t) - 1); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes) == CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpToFile", "Error writing cFE file header"); + UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_TBL_INC_ERR_CTR); /* Test with an error writing the table file header */ UT_InitData(); @@ -638,29 +596,21 @@ void Test_CFE_TBL_DumpToFile(void) */ UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 6, sizeof(CFE_FS_Header_t)); UT_SetDeferredRetcode(UT_KEY(OS_write), 1, sizeof(CFE_TBL_File_Hdr_t) - 1); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes) == CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpToFile", "Error writing cFE file header"); + UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_TBL_INC_ERR_CTR); /* Test with an error writing the table to a file */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_write), 2, TblSizeInBytes - 1); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes) == CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpToFile", "Error writing cFE file header"); + UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_TBL_INC_ERR_CTR); /* Test successful file creation and data dumped */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_OpenCreate), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes) == CFE_TBL_INC_CMD_CTR, - "CFE_TBL_DumpToFile", "File created and data dumped"); + UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_TBL_INC_CMD_CTR); /* Test where file already exists so data isoverwritten */ UT_InitData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes) == CFE_TBL_INC_CMD_CTR, - "CFE_TBL_DumpToFile", "File existed previously => data overwritten"); + UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_TBL_INC_CMD_CTR); } /* @@ -672,8 +622,7 @@ void Test_CFE_TBL_ResetCmd(void) /* Test run through function (there are no additional paths) */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TBL_ResetCountersCmd(NULL) == CFE_TBL_DONT_INC_CTR, "CFE_TBL_ResetCountersCmd", - "Function run and completed"); + UtAssert_INT32_EQ(CFE_TBL_ResetCountersCmd(NULL), CFE_TBL_DONT_INC_CTR); } /* @@ -693,8 +642,7 @@ void Test_CFE_TBL_ValidateCmd(void) UT_InitData(); snprintf(ValidateCmd.Payload.TableName, sizeof(ValidateCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ValidateCmd", - "Table registry entry doesn't exist"); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_ERR_CTR); /* Test where the active buffer has data, but too many table validations * have been requested @@ -710,9 +658,7 @@ void Test_CFE_TBL_ValidateCmd(void) CFE_TBL_Global.ValidationResults[i].State = CFE_TBL_VALIDATION_PENDING; } - UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ValidateCmd", - "Active buffer with data: too many table validations have " - "been requested"); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_ERR_CTR); /* Test where the active buffer has data, but there is no validation * function pointer @@ -720,8 +666,7 @@ void Test_CFE_TBL_ValidateCmd(void) UT_InitData(); CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; CFE_TBL_Global.Registry[0].ValidationFuncPtr = NULL; - UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ValidateCmd", - "Active buffer with data: No validation function pointer"); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_CMD_CTR); /* Test where the active buffer has data, the validation function pointer * exists, and the active table flag is set @@ -730,9 +675,7 @@ void Test_CFE_TBL_ValidateCmd(void) CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; CFE_TBL_Global.Registry[0].ValidationFuncPtr = ValFuncPtr; ValidateCmd.Payload.ActiveTableFlag = true; - UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ValidateCmd", - "Active buffer with data: validation function pointer and " - "active table flag"); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_CMD_CTR); /* Test with the buffer inactive, the table is double-buffered, and the * validation function pointer exists @@ -743,9 +686,7 @@ void Test_CFE_TBL_ValidateCmd(void) CFE_TBL_Global.Registry[0].Buffers[1 - CFE_TBL_Global.Registry[0].ActiveBufferIndex].BufferPtr = BuffPtr; CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; CFE_TBL_Global.Registry[0].ValidationFuncPtr = ValFuncPtr; - UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ValidateCmd", - "Inactive buffer: double buffered table : validation " - "function pointer"); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_CMD_CTR); /* Test with the buffer inactive, the table is single-buffered with a * load in progress, the validation function pointer exists, and no @@ -757,9 +698,7 @@ void Test_CFE_TBL_ValidateCmd(void) CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[0].LoadInProgress].BufferPtr = BuffPtr; CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ValidateCmd", - "Inactive buffer: single buffered table with load in progress: " - "validation function pointer, no notification message"); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_CMD_CTR); /* Test with the buffer inactive, the table is single-buffered with a * load in progress, the validation function pointer exists, and a @@ -772,23 +711,19 @@ void Test_CFE_TBL_ValidateCmd(void) CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[0].LoadInProgress].BufferPtr = BuffPtr; CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_ValidateCmd", - "Inactive buffer: single buffered table with load in progress: " - "validation function pointer, send notification message"); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_CMD_CTR); /* Test where no inactive buffer is present (single-buffered table without * load in progress) */ UT_InitData(); CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ValidateCmd", - "Inactive buffer: single buffered table with load in progress"); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_ERR_CTR); /* Test with an illegal buffer */ UT_InitData(); ValidateCmd.Payload.ActiveTableFlag = 0xffff; - UT_Report(__FILE__, __LINE__, CFE_TBL_ValidateCmd(&ValidateCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_ValidateCmd", - "Illegal buffer"); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_ERR_CTR); } /* @@ -801,8 +736,7 @@ void Test_CFE_TBL_NoopCmd(void) /* Test run through function (there are no additional paths) */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TBL_NoopCmd(NULL) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_NoopCmd", - "Function run and completed"); + UtAssert_INT32_EQ(CFE_TBL_NoopCmd(NULL), CFE_TBL_INC_CMD_CTR); } /* @@ -818,8 +752,7 @@ void Test_CFE_TBL_GetTblRegData(void) CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = CFE_ES_MEMADDRESS_C(0); CFE_TBL_Global.Registry[CFE_TBL_Global.HkTlmTblRegIndex].DoubleBuffered = true; CFE_TBL_GetTblRegData(); - UT_Report(__FILE__, __LINE__, CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr != 0, "CFE_TBL_GetTblRegData", - "Double buffered table"); + UtAssert_NONZERO(CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr); /* Test using a single buffered table and the buffer is inactive */ UT_InitData(); @@ -827,16 +760,14 @@ void Test_CFE_TBL_GetTblRegData(void) CFE_TBL_Global.Registry[CFE_TBL_Global.HkTlmTblRegIndex].DoubleBuffered = false; CFE_TBL_Global.Registry[CFE_TBL_Global.HkTlmTblRegIndex].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; CFE_TBL_GetTblRegData(); - UT_Report(__FILE__, __LINE__, CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr != 0, "CFE_TBL_GetTblRegData", - "Single buffered table - inactive buffer"); + UtAssert_NONZERO(CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr); /* Test with no inactive buffer */ UT_InitData(); CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr = CFE_ES_MEMADDRESS_C(0); CFE_TBL_Global.Registry[CFE_TBL_Global.HkTlmTblRegIndex].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; CFE_TBL_GetTblRegData(); - UT_Report(__FILE__, __LINE__, CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr == 0, "CFE_TBL_GetTblRegData", - "No inactive buffer"); + UtAssert_ZERO(CFE_TBL_Global.TblRegPacket.Payload.InactiveBufferAddr); } /* @@ -866,16 +797,13 @@ void Test_CFE_TBL_GetHkData(void) CFE_TBL_Global.Registry[NumLoadPendingIndex].LoadPending = true; CFE_TBL_Global.Registry[NumLoadPendingIndex].OwnerAppId = AppID; CFE_TBL_GetHkData(); - UT_Report(__FILE__, __LINE__, CFE_TBL_Global.HkPacket.Payload.NumLoadPending == 1, "CFE_TBL_GetHkData", - "Raise load pending table count"); + UtAssert_UINT32_EQ(CFE_TBL_Global.HkPacket.Payload.NumLoadPending, 1); /* Test lowering the count of free shared buffers */ UT_InitData(); CFE_TBL_Global.LoadBuffs[FreeSharedBuffIndex].Taken = true; CFE_TBL_GetHkData(); - UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.HkPacket.Payload.NumFreeSharedBufs == CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS - 1, - "CFE_TBL_GetHkData", "Lower free shared buffer count"); + UtAssert_UINT32_EQ(CFE_TBL_Global.HkPacket.Payload.NumFreeSharedBufs, CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS - 1); /* Test making a ValPtr with result = CFE_SUCCESS */ UT_InitData(); @@ -883,8 +811,7 @@ void Test_CFE_TBL_GetHkData(void) CFE_TBL_Global.ValidationResults[ValTableIndex].State = CFE_TBL_VALIDATION_PERFORMED; CFE_TBL_Global.ValidationResults[ValTableIndex].Result = CFE_SUCCESS; CFE_TBL_GetHkData(); - UT_Report(__FILE__, __LINE__, CFE_TBL_Global.SuccessValCounter == 1, "CFE_TBL_GetHkData", - "ValPtr result CFE_SUCCESS"); + UtAssert_UINT32_EQ(CFE_TBL_Global.SuccessValCounter, 1); /* Test making a ValPtr without result = CFE_SUCCESS */ UT_InitData(); @@ -892,32 +819,28 @@ void Test_CFE_TBL_GetHkData(void) CFE_TBL_Global.ValidationResults[ValTableIndex].State = CFE_TBL_VALIDATION_PERFORMED; CFE_TBL_Global.ValidationResults[ValTableIndex].Result = CFE_SUCCESS - 1; CFE_TBL_GetHkData(); - UT_Report(__FILE__, __LINE__, CFE_TBL_Global.FailedValCounter == 1, "CFE_TBL_GetHkData", - "ValPtr result != CFE_SUCCESS"); + UtAssert_UINT32_EQ(CFE_TBL_Global.FailedValCounter, 1); /* Test with an invalid registry entry */ UT_InitData(); CFE_TBL_Global.Registry[CFE_TBL_Global.LastTblUpdated].OwnerAppId = CFE_TBL_NOT_OWNED; CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds = 19283; CFE_TBL_GetHkData(); - UT_Report(__FILE__, __LINE__, CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds == 19283, "CFE_TBL_GetHkData", - "Invalid registry entry"); + UtAssert_UINT32_EQ(CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds, 19283); /* Test with invalid last valid table updated out of range (low) */ UT_InitData(); CFE_TBL_Global.LastTblUpdated = -1; CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds = 12345; CFE_TBL_GetHkData(); - UT_Report(__FILE__, __LINE__, CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds == 12345, "CFE_TBL_GetHkData", - "Last valid table updated out of range (low)"); + UtAssert_UINT32_EQ(CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds, 12345); /* Test with invalid last valid table updated out of range (high) */ UT_InitData(); CFE_TBL_Global.LastTblUpdated = CFE_PLATFORM_TBL_MAX_NUM_TABLES; CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds = 54321; CFE_TBL_GetHkData(); - UT_Report(__FILE__, __LINE__, CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds == 54321, "CFE_TBL_GetHkData", - "Last valid table updated out of range (high)"); + UtAssert_UINT32_EQ(CFE_TBL_Global.HkPacket.Payload.LastUpdateTime.Seconds, 54321); } /* @@ -931,7 +854,6 @@ void Test_CFE_TBL_DumpRegCmd(void) CFE_ES_AppId_t AppID; size_t LocalSize; void * LocalBuf; - bool IsEOF; /* Get the AppID being used for UT */ CFE_ES_GetAppID(&AppID); @@ -948,65 +870,55 @@ void Test_CFE_TBL_DumpRegCmd(void) UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), false); strncpy(DumpRegCmd.Payload.DumpFilename, "X", sizeof(DumpRegCmd.Payload.DumpFilename) - 1); DumpRegCmd.Payload.DumpFilename[sizeof(DumpRegCmd.Payload.DumpFilename) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_TBL_DumpRegistryCmd(&DumpRegCmd) == CFE_TBL_INC_CMD_CTR, - "CFE_TBL_DumpRegistryCmd", "Default dump file name"); + UtAssert_INT32_EQ(CFE_TBL_DumpRegistryCmd(&DumpRegCmd), CFE_TBL_INC_CMD_CTR); /* Test command with a bad file name */ UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); - UT_Report(__FILE__, __LINE__, CFE_TBL_DumpRegistryCmd(&DumpRegCmd) == CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpRegistryCmd", "Dump file name invalid"); + UtAssert_INT32_EQ(CFE_TBL_DumpRegistryCmd(&DumpRegCmd), CFE_TBL_INC_ERR_CTR); UT_ResetState(UT_KEY(CFE_FS_ParseInputFileNameEx)); /* Test command with the dump file already pending (max requests pending) */ UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), true); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpRequest), CFE_STATUS_REQUEST_ALREADY_PENDING); - UT_Report(__FILE__, __LINE__, CFE_TBL_DumpRegistryCmd(&DumpRegCmd) == CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpRegistryCmd", "Dump file already pending (FS max requests)"); + UtAssert_INT32_EQ(CFE_TBL_DumpRegistryCmd(&DumpRegCmd), CFE_TBL_INC_ERR_CTR); UT_ResetState(UT_KEY(CFE_FS_BackgroundFileDumpRequest)); /* Test command with the dump file already pending (local) */ UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), false); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpRequest), CFE_STATUS_REQUEST_ALREADY_PENDING); - UT_Report(__FILE__, __LINE__, CFE_TBL_DumpRegistryCmd(&DumpRegCmd) == CFE_TBL_INC_ERR_CTR, - "CFE_TBL_DumpRegistryCmd", "Dump file already pending (local)"); + UtAssert_INT32_EQ(CFE_TBL_DumpRegistryCmd(&DumpRegCmd), CFE_TBL_INC_ERR_CTR); /* Check event generators */ UT_ClearEventHistory(); CFE_TBL_Global.RegDumpState.FileExisted = true; CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_COMPLETE, CFE_SUCCESS, 10, 0, 1000); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_OVERWRITE_REG_DUMP_INF_EID), - "CFE_TBL_DumpRegistryEventHandler", "Dump file created event (overwrite)"); + CFE_UtAssert_EVENTSENT(CFE_TBL_OVERWRITE_REG_DUMP_INF_EID); UT_ClearEventHistory(); CFE_TBL_Global.RegDumpState.FileExisted = false; CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_COMPLETE, CFE_SUCCESS, 10, 0, 1000); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_WRITE_REG_DUMP_INF_EID), - "CFE_TBL_DumpRegistryEventHandler", "Dump file created event (new)"); + CFE_UtAssert_EVENTSENT(CFE_TBL_WRITE_REG_DUMP_INF_EID); UT_ClearEventHistory(); CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR, CFE_SUCCESS, 10, 10, 1000); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_WRITE_TBL_REG_ERR_EID), - "CFE_TBL_DumpRegistryEventHandler", "Dump file record write error event"); + CFE_UtAssert_EVENTSENT(CFE_TBL_WRITE_TBL_REG_ERR_EID); UT_ClearEventHistory(); CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR, CFE_SUCCESS, 10, 10, 1000); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_WRITE_CFE_HDR_ERR_EID), - "CFE_TBL_DumpRegistryEventHandler", "Dump file header write error event"); + CFE_UtAssert_EVENTSENT(CFE_TBL_WRITE_CFE_HDR_ERR_EID); UT_ClearEventHistory(); CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_CREATE_ERROR, OS_ERROR, 10, 0, 0); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TBL_CREATING_DUMP_FILE_ERR_EID), - "CFE_TBL_DumpRegistryEventHandler", "Dump file created error event"); + CFE_UtAssert_EVENTSENT(CFE_TBL_CREATING_DUMP_FILE_ERR_EID); UT_ClearEventHistory(); CFE_TBL_DumpRegistryEventHandler(&CFE_TBL_Global.RegDumpState, CFE_FS_FileWriteEvent_UNDEFINED, OS_ERROR, 0, 0, 0); - UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0, "CFE_TBL_DumpRegistryEventHandler", - "Undefined event is ignored"); + CFE_UtAssert_EVENTCOUNT(0); /* Test where the table is owned, the file doesn't already exist, and the * table is successfully dumped @@ -1019,8 +931,7 @@ void Test_CFE_TBL_DumpRegCmd(void) CFE_TBL_Global.Registry[0].DoubleBuffered = true; LocalBuf = NULL; LocalSize = 0; - IsEOF = CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, 0, &LocalBuf, &LocalSize); - UT_Report(__FILE__, __LINE__, !IsEOF, "CFE_TBL_DumpRegistryGetter", "Nominal, first record, not end of file"); + CFE_UtAssert_FALSE(CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, 0, &LocalBuf, &LocalSize)); UtAssert_NOT_NULL(LocalBuf); UtAssert_NONZERO(LocalSize); @@ -1029,17 +940,14 @@ void Test_CFE_TBL_DumpRegCmd(void) CFE_TBL_Global.Handles[2].NextLink = CFE_TBL_END_OF_LIST; LocalBuf = NULL; LocalSize = 0; - IsEOF = CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1, &LocalBuf, - &LocalSize); - UT_Report(__FILE__, __LINE__, IsEOF, "CFE_TBL_DumpRegistryGetter", - "Nominal, last record, multiple accessors, end of file"); + CFE_UtAssert_TRUE(CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1, + &LocalBuf, &LocalSize)); UtAssert_NOT_NULL(LocalBuf); UtAssert_NONZERO(LocalSize); /* Test with record numb beyond EOF (should be ignored, return null) */ - IsEOF = CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1, &LocalBuf, - &LocalSize); - UT_Report(__FILE__, __LINE__, IsEOF, "CFE_TBL_DumpRegistryGetter", "Past end of file"); + CFE_UtAssert_TRUE(CFE_TBL_DumpRegistryGetter(&CFE_TBL_Global.RegDumpState, CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1, + &LocalBuf, &LocalSize)); UtAssert_NULL(LocalBuf); UtAssert_ZERO(LocalSize); } @@ -1065,8 +973,7 @@ void Test_CFE_TBL_DumpCmd(void) /* Test where the table cannot be found in the registry */ UT_InitData(); snprintf(DumpCmd.Payload.TableName, sizeof(DumpCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", - "Table registry entry doesn't exist"); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); /* Test with an active buffer, the pointer is created, validation passes, * the table is dump only, no dump is already in progress, and have a @@ -1094,9 +1001,7 @@ void Test_CFE_TBL_DumpCmd(void) CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[2].LoadInProgress] = Load; CFE_TBL_Global.Registry[2].NotifyByMsg = true; UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, CFE_SB_INTERNAL_ERR); - UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_DumpCmd", - "Active buffer, pointer created, validation passes, is a dump " - "only table, no dump already in progress, got working buffer"); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_CMD_CTR); /* Test with an active buffer, a pointer is created, the table is dump * only, no dump is already progress, and fails to get a working buffer; @@ -1116,10 +1021,7 @@ void Test_CFE_TBL_DumpCmd(void) } CFE_TBL_Global.Registry[2].NotifyByMsg = true; - UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", - "Active buffer, pointer created, is a dump only table, no dump " - "already in progress, fails to get a working buffer: No " - "working buffers available"); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); /* Test with an active buffer, a pointer is created, the table is dump * only, and no dump fails to find a free dump control block; too many @@ -1134,10 +1036,7 @@ void Test_CFE_TBL_DumpCmd(void) } CFE_TBL_Global.Registry[2].NotifyByMsg = true; - UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", - "Active buffer, pointer created, is dump only table, fails to " - "find a free dump control block: too many dump only table " - "dumps have been requested"); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); /* Test with an inactive buffer, double-buffered, dump already in progress; * dump is already pending @@ -1147,9 +1046,7 @@ void Test_CFE_TBL_DumpCmd(void) CFE_TBL_Global.Registry[2].DoubleBuffered = true; CFE_TBL_Global.Registry[2].Buffers[(1 - CFE_TBL_Global.Registry[2].ActiveBufferIndex)].BufferPtr = BuffPtr; CFE_TBL_Global.Registry[2].DumpControlIndex = CFE_TBL_NO_DUMP_PENDING + 1; - UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", - "Inactive buffer, double-buffered, dump already in progress: " - "dump is already pending"); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); /* Test with an inactive buffer, single-buffered, pointer created, is a * dump only table @@ -1162,18 +1059,14 @@ void Test_CFE_TBL_DumpCmd(void) strncpy(DumpCmd.Payload.DumpFilename, CFE_TBL_Global.Registry[2].LastFileLoaded, sizeof(DumpCmd.Payload.DumpFilename) - 1); DumpCmd.Payload.DumpFilename[sizeof(DumpCmd.Payload.DumpFilename) - 1] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_DumpCmd", - "Inactive buffer, single-buffered, pointer created, is a dump " - "only table"); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_CMD_CTR); /* Test with an inactive buffer, single-buffered: No inactive buffer for * table due to load in progress */ UT_InitData(); CFE_TBL_Global.Registry[2].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", - "Inactive buffer, single-buffered: no inactive buffer for table " - "due to load in progress"); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); /* Test with an inactive buffer, single-buffered: No inactive buffer for * table due to user defined address @@ -1181,15 +1074,12 @@ void Test_CFE_TBL_DumpCmd(void) UT_InitData(); CFE_TBL_Global.Registry[2].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; CFE_TBL_Global.Registry[2].UserDefAddr = true; - UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", - "Inactive buffer, single-buffered: no inactive buffer for table " - "due to user defined address"); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); /* Test with an illegal buffer parameter */ UT_InitData(); DumpCmd.Payload.ActiveTableFlag = CFE_TBL_BufferSelect_ACTIVE + 1; - UT_Report(__FILE__, __LINE__, CFE_TBL_DumpCmd(&DumpCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_DumpCmd", - "Illegal buffer parameter"); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); } /* @@ -1217,8 +1107,7 @@ void Test_CFE_TBL_LoadCmd(void) strncpy(LoadCmd.Payload.LoadFilename, "LoadFileName", sizeof(LoadCmd.Payload.LoadFilename) - 1); LoadCmd.Payload.LoadFilename[sizeof(LoadCmd.Payload.LoadFilename) - 1] = '\0'; UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", - "Unable to open file"); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); /* Test response to inability to find the table in the registry */ UT_InitData(); @@ -1237,8 +1126,7 @@ void Test_CFE_TBL_LoadCmd(void) StdFileHeader.SubType = CFE_FS_SubType_TBL_IMG; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", - "Table registry entry doesn't exist"); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); /* Test attempt to load a dump only table */ UT_InitData(); @@ -1247,8 +1135,7 @@ void Test_CFE_TBL_LoadCmd(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); CFE_TBL_Global.Registry[0].Size = sizeof(CFE_TBL_File_Hdr_t) + 1; CFE_TBL_Global.Registry[0].DumpOnly = true; - UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", - "Attempting to load a dump only table"); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); /* Test attempt to load a table with a load already pending */ UT_InitData(); @@ -1258,8 +1145,7 @@ void Test_CFE_TBL_LoadCmd(void) CFE_TBL_Global.Registry[0].Size = sizeof(CFE_TBL_File_Hdr_t) + 1; CFE_TBL_Global.Registry[0].DumpOnly = false; CFE_TBL_Global.Registry[0].LoadPending = true; - UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", - "Attempting to load a table with load already pending"); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); CFE_TBL_Global.Registry[0].LoadPending = false; /* Test where the file isn't dump only and passes table checks, get a @@ -1277,8 +1163,7 @@ void Test_CFE_TBL_LoadCmd(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); CFE_TBL_Global.Registry[0].DumpOnly = false; - UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", - "There is more data than the file indicates"); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); /* Test with no extra byte => successful load */ UT_InitData(); @@ -1289,8 +1174,7 @@ void Test_CFE_TBL_LoadCmd(void) TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_CMD_CTR, "CFE_TBL_LoadCmd", - "Successful load"); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_CMD_CTR); /* Test with differing amount of data from header's claim */ UT_InitData(); @@ -1306,8 +1190,7 @@ void Test_CFE_TBL_LoadCmd(void) UT_SetDeferredRetcode(UT_KEY(OS_read), 2, 0); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", - "Incomplete load of file into the working buffer"); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); /* Test with no working buffers available */ UT_InitData(); @@ -1325,8 +1208,7 @@ void Test_CFE_TBL_LoadCmd(void) TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", - "No working buffers available"); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); /* Test with table header indicating data beyond size of the table */ UT_InitData(); @@ -1337,8 +1219,7 @@ void Test_CFE_TBL_LoadCmd(void) TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", - "Table header indicates data beyond size of the table"); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); /* Test with table header indicating no data in the file */ UT_InitData(); @@ -1348,8 +1229,7 @@ void Test_CFE_TBL_LoadCmd(void) TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", - "Table header indicates no data in file"); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); /* Test where file has partial load for uninitialized table and offset * is non-zero @@ -1364,9 +1244,7 @@ void Test_CFE_TBL_LoadCmd(void) TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", - "File has partial load for uninitialized table and offset " - "is non-zero"); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); /* Test where file has partial load for uninitialized table and offset * is zero @@ -1381,17 +1259,14 @@ void Test_CFE_TBL_LoadCmd(void) TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", - "File has partial load for uninitialized table and offset " - "is zero"); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); /* Test response to inability to read the file header */ UT_InitData(); strncpy(LoadCmd.Payload.LoadFilename, "LoadFileName", sizeof(LoadCmd.Payload.LoadFilename) - 1); LoadCmd.Payload.LoadFilename[sizeof(LoadCmd.Payload.LoadFilename) - 1] = '\0'; UT_SetDeferredRetcode(UT_KEY(CFE_FS_ReadHeader), 1, sizeof(CFE_FS_Header_t) - 1); - UT_Report(__FILE__, __LINE__, CFE_TBL_LoadCmd(&LoadCmd) == CFE_TBL_INC_ERR_CTR, "CFE_TBL_LoadCmd", - "Unable to read file header"); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); } /* @@ -1439,8 +1314,7 @@ void Test_CFE_TBL_HousekeepingCmd(void) UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, CFE_SUCCESS - 1); CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND + 1; - UT_Report(__FILE__, __LINE__, CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, "CFE_TBL_HousekeepingCmd", - "Able to open dump file"); + UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_TBL_DONT_INC_CTR); for (i = 1; i < CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS; i++) { @@ -1455,23 +1329,20 @@ void Test_CFE_TBL_HousekeepingCmd(void) CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND + 1; UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, "CFE_TBL_HousekeepingCmd", - "Unable to open dump file"); + UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_TBL_DONT_INC_CTR); /* Test response to an invalid table and a dump file create failure */ UT_InitData(); CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND; CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, "CFE_TBL_HousekeepingCmd", - "Invalid table and dump file create failure"); + UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_TBL_DONT_INC_CTR); /* Test response to a file time stamp failure */ UT_InitData(); CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; UT_SetDeferredRetcode(UT_KEY(CFE_FS_SetTimestamp), 1, OS_SUCCESS - 1); - UT_Report(__FILE__, __LINE__, CFE_TBL_HousekeepingCmd(NULL) == CFE_TBL_DONT_INC_CTR, "CFE_TBL_HousekeepingCmd", - "Time stamp file failure"); + UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_TBL_DONT_INC_CTR); } /* @@ -1490,12 +1361,9 @@ void Test_CFE_TBL_ApiInit(void) */ void Test_CFE_TBL_Register(void) { - int32 RtnCode; - int32 RtnCode2; CFE_TBL_Handle_t TblHandle1; CFE_TBL_Handle_t TblHandle2; CFE_TBL_Handle_t TblHandle3; - bool EventsCorrect; char TblName[CFE_MISSION_TBL_MAX_NAME_LENGTH + 2]; int16 i; CFE_TBL_AccessDescriptor_t *AccessDescPtr; @@ -1506,10 +1374,10 @@ void Test_CFE_TBL_Register(void) /* Test response to an invalid application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, "CFE_TBL_Register", - "Invalid application ID"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_ES_ERR_RESOURCEID_NOT_VALID); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to a table name longer than the maximum allowed */ UT_InitData(); @@ -1520,241 +1388,220 @@ void Test_CFE_TBL_Register(void) TblName[i] = 'A'; } - TblName[i] = '\0'; - RtnCode = CFE_TBL_Register(&TblHandle1, TblName, sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_NAME && EventsCorrect, "CFE_TBL_Register", - "Table name too long"); + TblName[i] = '\0'; + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, TblName, sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_ERR_INVALID_NAME); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to a table name shorter than the minimum allowed */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_NAME && EventsCorrect, "CFE_TBL_Register", - "Table name too short"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_ERR_INVALID_NAME); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to a table size of zero */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", 0, CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_SIZE && EventsCorrect, "CFE_TBL_Register", - "Size of table = 0"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", 0, CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_ERR_INVALID_SIZE); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to a table size larger than the maximum allowed */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", (CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE + 1), - CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_SIZE && EventsCorrect, "CFE_TBL_Register", - "Table size too large"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", (CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE + 1), + CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_ERR_INVALID_SIZE); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to a double-buffered table size larger than the * maximum allowed */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", (CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE + 1), - CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_SIZE && EventsCorrect, "CFE_TBL_Register", - "Double-buffered table size too large"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", (CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE + 1), + CFE_TBL_OPT_DBL_BUFFER, NULL), + CFE_TBL_ERR_INVALID_SIZE); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to an invalid table option combination * (CFE_TBL_OPT_USR_DEF_ADDR | CFE_TBL_OPT_DBL_BUFFER) */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), - ((CFE_TBL_OPT_USR_DEF_ADDR & ~CFE_TBL_OPT_LD_DMP_MSK) | CFE_TBL_OPT_DBL_BUFFER), NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, "CFE_TBL_Register", - "Invalid table option combination (CFE_TBL_OPT_USR_DEF_ADDR | " - "CFE_TBL_OPT_DBL_BUFFER)"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + ((CFE_TBL_OPT_USR_DEF_ADDR & ~CFE_TBL_OPT_LD_DMP_MSK) | CFE_TBL_OPT_DBL_BUFFER), + NULL), + CFE_TBL_ERR_INVALID_OPTIONS); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to an invalid table option combination * (CFE_TBL_OPT_USR_DEF_ADDR | CFE_TBL_OPT_LOAD_DUMP) */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), - (CFE_TBL_OPT_USR_DEF_ADDR & ~CFE_TBL_OPT_LD_DMP_MSK), NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, "CFE_TBL_Register", - "Invalid table option combination (CFE_TBL_OPT_USR_DEF_ADDR | " - "CFE_TBL_OPT_LOAD_DUMP)"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + (CFE_TBL_OPT_USR_DEF_ADDR & ~CFE_TBL_OPT_LD_DMP_MSK), NULL), + CFE_TBL_ERR_INVALID_OPTIONS); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to an invalid table option combination * (CFE_TBL_OPT_USR_DEF_ADDR | CFE_TBL_OPT_CRITICAL) */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), - ((CFE_TBL_OPT_USR_DEF_ADDR & ~CFE_TBL_OPT_LD_DMP_MSK) | CFE_TBL_OPT_CRITICAL), NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, "CFE_TBL_Register", - "Invalid table option combination (CFE_TBL_OPT_USR_DEF_ADDR | " - "CFE_TBL_OPT_CRITICAL)"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + ((CFE_TBL_OPT_USR_DEF_ADDR & ~CFE_TBL_OPT_LD_DMP_MSK) | CFE_TBL_OPT_CRITICAL), + NULL), + CFE_TBL_ERR_INVALID_OPTIONS); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to an invalid table option combination * (CFE_TBL_OPT_DUMP_ONLY | CFE_TBL_OPT_DBL_BUFFER) */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), - (CFE_TBL_OPT_DUMP_ONLY | CFE_TBL_OPT_DBL_BUFFER), NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, "CFE_TBL_Register", - "Invalid table option combination (CFE_TBL_OPT_DUMP_ONLY | " - "CFE_TBL_OPT_DBL_BUFFER)"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + (CFE_TBL_OPT_DUMP_ONLY | CFE_TBL_OPT_DBL_BUFFER), NULL), + CFE_TBL_ERR_INVALID_OPTIONS); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to a memory handle error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, "CFE_TBL_Register", - "Memory handle error"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_ES_ERR_RESOURCEID_NOT_VALID); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to a memory block size error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_MEM_BLOCK_SIZE); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_MEM_BLOCK_SIZE && EventsCorrect, "CFE_TBL_Register", - "Memory block size error"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_ES_ERR_MEM_BLOCK_SIZE); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to a memory block size error (for a second buffer) */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 2, CFE_ES_ERR_MEM_BLOCK_SIZE); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_MEM_BLOCK_SIZE && EventsCorrect, "CFE_TBL_Register", - "Memory block size error (for second buffer)"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL), + CFE_ES_ERR_MEM_BLOCK_SIZE); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test successfully getting a double buffered table */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Get a double buffered table - successful"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* Test attempt to register table owned by another application */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_Register(&TblHandle3, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_DUPLICATE_NOT_OWNED && EventsCorrect, "CFE_TBL_Register", - "Table owned by another application"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle3, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL), + CFE_TBL_ERR_DUPLICATE_NOT_OWNED); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test attempt to register existing table with a different size */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Register(&TblHandle3, "UT_Table1", sizeof(UT_Table2_t), CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_DUPLICATE_DIFF_SIZE && EventsCorrect, "CFE_TBL_Register", - "Table size mismatch"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle3, "UT_Table1", sizeof(UT_Table2_t), CFE_TBL_OPT_DBL_BUFFER, NULL), + CFE_TBL_ERR_DUPLICATE_DIFF_SIZE); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test attempt to register a table with the same size and name */ /* a. Test setup */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - EventsCorrect = (UT_GetNumEventsSent() == 0); - RtnCode = CFE_TBL_Share(&TblHandle3, "ut_cfe_tbl.UT_Table1"); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Table with same size and name (setup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Share(&TblHandle3, "ut_cfe_tbl.UT_Table1")); + CFE_UtAssert_EVENTCOUNT(0); /* b. Perform test */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); /* Restore AppID to proper value */ - RtnCode = CFE_TBL_Register(&TblHandle2, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_WARN_DUPLICATE && EventsCorrect && TblHandle1 == TblHandle2, - "CFE_TBL_Register", "Table with same size and name"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle2, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL), + CFE_TBL_WARN_DUPLICATE); + CFE_UtAssert_EVENTCOUNT(0); + UtAssert_INT32_EQ(TblHandle1, TblHandle2); /* c. Test cleanup: unregister tables */ UT_ClearEventHistory(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Unregister(TblHandle2); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(TblHandle2)); UT_SetAppID(UT_TBL_APPID_2); - RtnCode2 = CFE_TBL_Unregister(TblHandle3); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && RtnCode2 == CFE_SUCCESS && EventsCorrect, - "CFE_TBL_Unregister", "Table with same size and name (cleanup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(TblHandle3)); + CFE_UtAssert_EVENTCOUNT(0); /* Test registering a single buffered table */ /* a. Perform test */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Register single buffered table"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", - "Register single buffered table (cleanup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(TblHandle1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test registering a single buffered dump-only table */ /* a. Perform test */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), - (CFE_TBL_OPT_SNGL_BUFFER | CFE_TBL_OPT_DUMP_ONLY), NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Register single buffered dump-only table"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + (CFE_TBL_OPT_SNGL_BUFFER | CFE_TBL_OPT_DUMP_ONLY), NULL)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", - "Register single buffered dump-only table (cleanup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(TblHandle1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test registering a user defined address table */ /* a. Perform test */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_USR_DEF_ADDR, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Register user defined address table"); + CFE_UtAssert_SUCCESS( + CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_USR_DEF_ADDR, NULL)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", - "Register user defined address table (cleanup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(TblHandle1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test registering a critical table */ /* a. Perform test */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Register critical table"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", - "Register critical table (cleanup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(TblHandle1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test registering a critical table that already has an allocated CDS */ /* a. Perform test */ UT_ClearEventHistory(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_CDS_ALREADY_EXISTS); CFE_TBL_Global.CritReg[0].TableLoadedOnce = true; - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_RECOVERED_TBL && EventsCorrect, "CFE_TBL_Register", - "Register critical table that already has an allocated CDS"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL), + CFE_TBL_INFO_RECOVERED_TBL); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", - "Register critical table that already has an allocated " - "CDS (cleanup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(TblHandle1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test registering a critical table that already has an allocated CDS * and recovery fails @@ -1763,19 +1610,14 @@ void Test_CFE_TBL_Register(void) UT_ClearEventHistory(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_CDS_ALREADY_EXISTS); CFE_TBL_Global.CritReg[0].TableLoadedOnce = false; - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Register critical table that already has an allocated CDS where " - "recovery fails"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", - "Register critical table that already has an allocated " - "CDS where recovery fails (cleanup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(TblHandle1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test registering a critical table that already has an allocated CDS but * fails recovery @@ -1784,19 +1626,14 @@ void Test_CFE_TBL_Register(void) UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_CDS_ALREADY_EXISTS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RestoreFromCDS), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Register critical table that already has an allocated CDS but " - "fails recovery"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", - "Register critical table that already has an allocated CDS but " - "fails recovery (cleanup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(TblHandle1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test registering a critical table that already has an allocated CDS but * no critical table registry entry @@ -1811,19 +1648,14 @@ void Test_CFE_TBL_Register(void) CFE_TBL_Global.CritReg[i].CDSHandle = CFE_ES_CDS_BAD_HANDLE; } - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Register Critical table that already has an allocated CDS " - "but no critical table registry entry"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", - "Register Critical table that already has an allocated CDS " - "but no critical table registry entry (cleanup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(TblHandle1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test registering a critical table but no critical table registry entry * is free @@ -1838,60 +1670,52 @@ void Test_CFE_TBL_Register(void) CFE_TBL_Global.CritReg[i].CDSHandle = CFE_ES_CDS_BAD_HANDLE; } - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Register Critical table but no critical table registry entry " - "is free"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* b. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", - "Register Critical table but no critical table registry entry " - "is free (cleanup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(TblHandle1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test attempt to register a critical table when the CDS registry * is full */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_NO_RESOURCE_IDS_AVAILABLE); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_WARN_NOT_CRITICAL && EventsCorrect, "CFE_TBL_Register", - "Register critical table when CDS registry is full"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL), + CFE_TBL_WARN_NOT_CRITICAL); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* Test attempt to register a table when the registry is full */ /* a. Test setup */ UT_InitData(); UT_ResetTableRegistry(); - i = 0; - RtnCode = CFE_SUCCESS; - while (i < CFE_PLATFORM_TBL_MAX_NUM_TABLES && RtnCode == CFE_SUCCESS) + for (i = 0; i < CFE_PLATFORM_TBL_MAX_NUM_TABLES; ++i) { snprintf(TblName, CFE_MISSION_TBL_MAX_NAME_LENGTH, "UT_Table%d", i + 1); - RtnCode = CFE_TBL_Register(&TblHandle1, TblName, sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); - i++; + if (!CFE_UtAssert_SETUP(CFE_TBL_Register(&TblHandle1, TblName, sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL))) + { + break; + } } - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS, "CFE_TBL_Register", "Registry full (setup)"); - /* b. Perform test */ UT_ClearEventHistory(); snprintf(TblName, CFE_MISSION_TBL_MAX_NAME_LENGTH, "UT_Table%d", i + 1); - RtnCode = CFE_TBL_Register(&TblHandle2, TblName, sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_REGISTRY_FULL && EventsCorrect, "CFE_TBL_Register", - "Registry full"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle2, TblName, sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_ERR_REGISTRY_FULL); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* c. Test cleanup: unregister table */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", - "Registry full (cleanup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(TblHandle1)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* Test response to no available handles */ /* a. Test setup */ @@ -1899,57 +1723,56 @@ void Test_CFE_TBL_Register(void) do { - RtnCode = CFE_TBL_Share(&TblHandle1, "ut_cfe_tbl.UT_Table2"); - } while ((TblHandle1 < CFE_PLATFORM_TBL_MAX_NUM_HANDLES - 1) && RtnCode == CFE_SUCCESS); - - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS, "CFE_TBL_Share", "No available handles (setup)"); + if (!CFE_UtAssert_SETUP(CFE_TBL_Share(&TblHandle1, "ut_cfe_tbl.UT_Table2"))) + { + break; + } + } while (TblHandle1 < CFE_PLATFORM_TBL_MAX_NUM_HANDLES - 1); /* b. Perform test */ UT_ClearEventHistory(); snprintf(TblName, CFE_MISSION_TBL_MAX_NAME_LENGTH, "UT_Table%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES); - RtnCode = CFE_TBL_Register(&TblHandle1, TblName, sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_HANDLES_FULL && EventsCorrect, "CFE_TBL_Register", - "No available handles"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, TblName, sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_ERR_HANDLES_FULL); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to an invalid table option combination * (CFE_TBL_OPT_USR_DEF_ADDR | CFE_TBL_OPT_CRITICAL) */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), - CFE_TBL_OPT_USR_DEF_ADDR | CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, "CFE_TBL_Register", - "Invalid table option combination (CFE_TBL_OPT_USR_DEF_ADDR |" - "CFE_TBL_OPT_CRITICAL)"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + CFE_TBL_OPT_USR_DEF_ADDR | CFE_TBL_OPT_CRITICAL, NULL), + CFE_TBL_ERR_INVALID_OPTIONS); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to an invalid table option combination * (CFE_TBL_OPT_DUMP_ONLY | CFE_TBL_OPT_CRITICAL) */ UT_InitData(); - RtnCode = CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), - CFE_TBL_OPT_DUMP_ONLY | CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_OPTIONS && EventsCorrect, "CFE_TBL_Register", - "Invalid table option combination (CFE_TBL_OPT_DUMP_ONLY |" - "CFE_TBL_OPT_CRITICAL)"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + CFE_TBL_OPT_DUMP_ONLY | CFE_TBL_OPT_CRITICAL, NULL), + CFE_TBL_ERR_INVALID_OPTIONS); + CFE_UtAssert_EVENTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test attempt to register a table with UsedFlag = false */ UT_InitData(); CFE_TBL_Global.Handles[0].UsedFlag = false; - RtnCode = CFE_TBL_Register(&TblHandle2, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_WARN_DUPLICATE && EventsCorrect && TblHandle1 == TblHandle2, - "CFE_TBL_Register", "UsedFlag is false"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle2, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL), + CFE_TBL_WARN_DUPLICATE); + CFE_UtAssert_EVENTCOUNT(0); + UtAssert_INT32_EQ(TblHandle1, TblHandle2); /* Test attempt to register a table with an invalid registry index */ UT_InitData(); CFE_TBL_Global.Handles[0].UsedFlag = true; CFE_TBL_Global.Handles[0].RegIndex = -1; - RtnCode = CFE_TBL_Register(&TblHandle2, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_WARN_DUPLICATE && EventsCorrect && TblHandle1 == TblHandle2, - "CFE_TBL_Register", "Invalid registry index"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle2, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL), + CFE_TBL_WARN_DUPLICATE); + CFE_UtAssert_EVENTCOUNT(0); + UtAssert_INT32_EQ(TblHandle1, TblHandle2); /* Test attempt to register a table with access index at end of list */ UT_InitData(); @@ -1959,10 +1782,10 @@ void Test_CFE_TBL_Register(void) CFE_TBL_Global.Registry[i].HeadOfAccessList = CFE_TBL_END_OF_LIST; } - RtnCode = CFE_TBL_Register(&TblHandle2, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_WARN_DUPLICATE && EventsCorrect && TblHandle1 == TblHandle2, - "CFE_TBL_Register", "Access index at end of list"); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle2, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, NULL), + CFE_TBL_WARN_DUPLICATE); + CFE_UtAssert_EVENTCOUNT(0); + UtAssert_INT32_EQ(TblHandle1, TblHandle2); /* Test attempt to register a double buffered table with a pool buffer * error */ @@ -1971,12 +1794,12 @@ void Test_CFE_TBL_Register(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_SEVERITY_ERROR); snprintf(TblName, CFE_MISSION_TBL_MAX_NAME_LENGTH, "UT_Table%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES); CFE_TBL_Global.Handles[0].UsedFlag = false; - RtnCode = CFE_TBL_Register(&TblHandle2, TblName, sizeof(UT_Table1_t) + 1, CFE_TBL_OPT_DBL_BUFFER, NULL); + UtAssert_INT32_EQ(CFE_TBL_Register(&TblHandle2, TblName, sizeof(UT_Table1_t) + 1, CFE_TBL_OPT_DBL_BUFFER, NULL), + CFE_SEVERITY_ERROR); AccessDescPtr = &CFE_TBL_Global.Handles[TblHandle2]; RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - EventsCorrect = RegRecPtr->DoubleBuffered == false && RegRecPtr->ActiveBufferIndex == 0; - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SEVERITY_ERROR && EventsCorrect, "CFE_TBL_Register", - "Register a double buffered table with pool buffer error"); + CFE_UtAssert_FALSE(RegRecPtr->DoubleBuffered); + UtAssert_ZERO(RegRecPtr->ActiveBufferIndex); CFE_TBL_Global.Handles[0].UsedFlag = true; } @@ -1986,8 +1809,6 @@ void Test_CFE_TBL_Register(void) */ void Test_CFE_TBL_Share(void) { - int32 RtnCode; - bool EventsCorrect; CFE_FS_Header_t StdFileHeader; CFE_TBL_File_Hdr_t TblFileHeader; @@ -1999,38 +1820,33 @@ void Test_CFE_TBL_Share(void) /* Test response to an invalid application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table2"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_SHARE_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, "CFE_TBL_Share", - "Invalid application ID"); + UtAssert_INT32_EQ(CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table2"), CFE_ES_ERR_RESOURCEID_NOT_VALID); + CFE_UtAssert_EVENTSENT(CFE_TBL_SHARE_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response when table name is not in the registry */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Share(&App1TblHandle1, "ut_cfe_tbl.NOT_Table2"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_SHARE_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_NAME && EventsCorrect, "CFE_TBL_Share", - "Table name not in registry"); + UtAssert_INT32_EQ(CFE_TBL_Share(&App1TblHandle1, "ut_cfe_tbl.NOT_Table2"), CFE_TBL_ERR_INVALID_NAME); + CFE_UtAssert_EVENTSENT(CFE_TBL_SHARE_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response when there are no available table handles */ UT_InitData(); - RtnCode = CFE_TBL_Share(&App1TblHandle1, "ut_cfe_tbl.UT_Table3"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_SHARE_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_HANDLES_FULL && EventsCorrect, "CFE_TBL_Share", - "No available table handles"); + UtAssert_INT32_EQ(CFE_TBL_Share(&App1TblHandle1, "ut_cfe_tbl.UT_Table3"), CFE_TBL_ERR_HANDLES_FULL); + CFE_UtAssert_EVENTSENT(CFE_TBL_SHARE_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test unregistering tables to free handles */ UT_InitData(); - RtnCode = CFE_TBL_Unregister(CFE_PLATFORM_TBL_MAX_NUM_HANDLES / 2); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "Free handles"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(CFE_PLATFORM_TBL_MAX_NUM_HANDLES / 2)); + CFE_UtAssert_EVENTCOUNT(0); /* Test unregister response to a PutPoolBuf error */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_PutPoolBuf), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Unregister(CFE_PLATFORM_TBL_MAX_NUM_HANDLES / 2 + 1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", "PutPoolBuf error"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(CFE_PLATFORM_TBL_MAX_NUM_HANDLES / 2 + 1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test successful first load of a table */ UT_InitData(); @@ -2046,25 +1862,20 @@ void Test_CFE_TBL_Share(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(3, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", - "First load of a table - successful"); + CFE_UtAssert_SUCCESS(CFE_TBL_Load(3, CFE_TBL_SRC_FILE, "TblSrcFileName.dat")); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_SUCCESS_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test successful share of a table that has not been loaded once */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table3"); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Share", - "Share of table that has not been loaded - successful"); + CFE_UtAssert_SUCCESS(CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table3")); + CFE_UtAssert_EVENTCOUNT(0); /* Test successful share of a table that has been loaded once */ UT_InitData(); - RtnCode = CFE_TBL_Share(&App2TblHandle2, "ut_cfe_tbl.UT_Table4"); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Share", - "Share of table that has been loaded - successful"); + CFE_UtAssert_SUCCESS(CFE_TBL_Share(&App2TblHandle2, "ut_cfe_tbl.UT_Table4")); + CFE_UtAssert_EVENTCOUNT(0); } /* @@ -2073,33 +1884,26 @@ void Test_CFE_TBL_Share(void) */ void Test_CFE_TBL_Unregister(void) { - int32 RtnCode; - bool EventsCorrect; - UtPrintf("Begin Test Unregister"); /* Test response to unregistering a table with an invalid handle */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Unregister(CFE_PLATFORM_TBL_MAX_NUM_HANDLES); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_UNREGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, (RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect), "CFE_TBL_Unregister", - "Invalid handle"); + UtAssert_INT32_EQ(CFE_TBL_Unregister(CFE_PLATFORM_TBL_MAX_NUM_HANDLES), CFE_TBL_ERR_INVALID_HANDLE); + CFE_UtAssert_EVENTSENT(CFE_TBL_UNREGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Unregister a shared table to make it unowned */ UT_InitData(); - RtnCode = CFE_TBL_Unregister(3); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", - "Unregister shared table to make it unowned"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(3)); + CFE_UtAssert_EVENTCOUNT(0); /* Test response to unregistering an unowned table */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_Unregister(App2TblHandle2); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_UNREGISTER_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_Unregister", - "Unregister unowned table"); + UtAssert_INT32_EQ(CFE_TBL_Unregister(App2TblHandle2), CFE_TBL_ERR_NO_ACCESS); + CFE_UtAssert_EVENTSENT(CFE_TBL_UNREGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); } /* @@ -2108,9 +1912,6 @@ void Test_CFE_TBL_Unregister(void) */ void Test_CFE_TBL_NotifyByMessage(void) { - int32 RtnCode; - bool EventsCorrect; - UtPrintf("Begin Test Notify by Message"); /* Set up notify by message tests */ @@ -2119,35 +1920,29 @@ void Test_CFE_TBL_NotifyByMessage(void) UT_SetAppID(UT_TBL_APPID_1); UT_ResetPoolBufferIndex(); - RtnCode = CFE_TBL_Register(&App1TblHandle1, "NBMsg_Tbl", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Notify by message (setup)"); + CFE_UtAssert_SUCCESS( + CFE_TBL_Register(&App1TblHandle1, "NBMsg_Tbl", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL)); + CFE_UtAssert_EVENTCOUNT(0); /* Test successful notification */ UT_InitData(); - EventsCorrect = (UT_GetNumEventsSent() == 0); - RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_NotifyByMessage", - "Notify - success"); + CFE_UtAssert_SUCCESS(CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test response to notification request when the application doesn't * own the table handle */ UT_InitData(); CFE_TBL_Global.Registry[0].OwnerAppId = CFE_TBL_NOT_OWNED; - EventsCorrect = (UT_GetNumEventsSent() == 0); - RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_NotifyByMessage", - "Notify - no access"); + UtAssert_INT32_EQ(CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1), CFE_TBL_ERR_NO_ACCESS); + CFE_UtAssert_EVENTCOUNT(0); /* Test response to notification request when the application ID is bad */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - EventsCorrect = (UT_GetNumEventsSent() == 0); - RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, - "CFE_TBL_NotifyByMessage", "Notify - bad application ID"); + UtAssert_INT32_EQ(CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1), + CFE_ES_ERR_RESOURCEID_NOT_VALID); + CFE_UtAssert_EVENTCOUNT(0); } /* @@ -2159,8 +1954,6 @@ void Test_CFE_TBL_Load(void) CFE_TBL_Handle_t DumpOnlyTblHandle; CFE_TBL_Handle_t UserDefTblHandle; UT_Table1_t TestTable1; - int32 RtnCode; - bool EventsCorrect; CFE_FS_Header_t StdFileHeader; CFE_TBL_File_Hdr_t TblFileHeader; UT_Table1_t * App2TblPtr; @@ -2176,11 +1969,10 @@ void Test_CFE_TBL_Load(void) UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); UT_ResetTableRegistry(); - RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, - Test_CFE_TBL_ValidationFunc); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Load setup - single buffered table"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&App1TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, + Test_CFE_TBL_ValidationFunc)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* Test attempt to perform partial INITIAL load */ UT_InitData(); @@ -2195,10 +1987,9 @@ void Test_CFE_TBL_Load(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_PARTIAL_LOAD_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_PARTIAL_LOAD && EventsCorrect, "CFE_TBL_Load", - "Attempt to perform partial INITIAL load"); + UtAssert_INT32_EQ(CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"), CFE_TBL_ERR_PARTIAL_LOAD); + CFE_UtAssert_EVENTSENT(CFE_TBL_PARTIAL_LOAD_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test attempt to perform partial INITIAL load with table already * loaded @@ -2211,10 +2002,9 @@ void Test_CFE_TBL_Load(void) RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; RegRecPtr->UserDefAddr = true; RegRecPtr->TableLoadedOnce = true; - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_PARTIAL_LOAD_ERR_EID) == false && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", - "Attempt to perform partial INITIAL load with table already loaded"); + CFE_UtAssert_SUCCESS(CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat")); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_PARTIAL_LOAD_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test attempt to load a file that has incompatible data for the * specified table @@ -2231,20 +2021,19 @@ void Test_CFE_TBL_Load(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_FILE_FOR_WRONG_TABLE && EventsCorrect, "CFE_TBL_Load", - "File data incompatible with table"); + UtAssert_INT32_EQ(CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"), + CFE_TBL_ERR_FILE_FOR_WRONG_TABLE); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Set up for double buffer table load test */ /* Test setup - register a double buffered table */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Register(&App1TblHandle2, "UT_Table2x", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, - Test_CFE_TBL_ValidationFunc); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "CFE_TBL_Load setup - register a double buffered table"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&App1TblHandle2, "UT_Table2x", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, + Test_CFE_TBL_ValidationFunc)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* Test attempt to load a file that has incompatible data for the * specified double buffered table that is already loaded @@ -2265,68 +2054,63 @@ void Test_CFE_TBL_Load(void) RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; RegRecPtr->DoubleBuffered = true; RegRecPtr->TableLoadedOnce = true; - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_FILE_FOR_WRONG_TABLE && EventsCorrect, "CFE_TBL_Load", - "File data incompatible with table, double buffered, already " - "loaded"); + UtAssert_INT32_EQ(CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"), + CFE_TBL_ERR_FILE_FOR_WRONG_TABLE); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test performing a Load from memory */ UT_InitData(); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", "Perform load from memory"); + CFE_UtAssert_SUCCESS(CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1)); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_SUCCESS_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test attempt to load from an illegal source type (not a file or * from memory) */ UT_InitData(); - RtnCode = CFE_TBL_Load(App1TblHandle1, (CFE_TBL_SrcEnum_t)99, &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_TYPE_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_ILLEGAL_SRC_TYPE && EventsCorrect, "CFE_TBL_Load", - "Attempt to load from illegal source type"); + UtAssert_INT32_EQ(CFE_TBL_Load(App1TblHandle1, (CFE_TBL_SrcEnum_t)99, &TestTable1), CFE_TBL_ERR_ILLEGAL_SRC_TYPE); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_TYPE_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test failure of validation function on table load using a negative * return code */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, -1); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == -1 && EventsCorrect, "CFE_TBL_Load", - "Fail validation function on table load (negative return code)"); + UtAssert_INT32_EQ(CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1), -1); + CFE_UtAssert_EVENTSENT(CFE_TBL_VALIDATION_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test failure of validation function on table load using a positive * return code */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, 1); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_VAL_ERR_EID) == true && UT_GetNumEventsSent() == 2); - UT_Report(__FILE__, __LINE__, RtnCode == -1 && EventsCorrect, "CFE_TBL_Load", - "Fail validation function on table load (positive return code)"); + UtAssert_INT32_EQ(CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1), -1); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_VAL_ERR_EID); + CFE_UtAssert_EVENTCOUNT(2); /* Test attempt to load a table with a bad handle */ UT_InitData(); - RtnCode = CFE_TBL_Load(CFE_PLATFORM_TBL_MAX_NUM_HANDLES, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_HANDLE_ACCESS_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect, "CFE_TBL_Load", - "Attempt to load table with bad handle"); + UtAssert_INT32_EQ(CFE_TBL_Load(CFE_PLATFORM_TBL_MAX_NUM_HANDLES, CFE_TBL_SRC_ADDRESS, &TestTable1), + CFE_TBL_ERR_INVALID_HANDLE); + CFE_UtAssert_EVENTSENT(CFE_TBL_HANDLE_ACCESS_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test attempt to load a dump-only table */ /* a. Test setup */ UT_InitData(); - RtnCode = CFE_TBL_Register(&DumpOnlyTblHandle, "UT_Table2", sizeof(UT_Table1_t), CFE_TBL_OPT_DUMP_ONLY, NULL); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Attempt to load a dump-only table (setup)"); + CFE_UtAssert_SUCCESS( + CFE_TBL_Register(&DumpOnlyTblHandle, "UT_Table2", sizeof(UT_Table1_t), CFE_TBL_OPT_DUMP_ONLY, NULL)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* b. Perform test */ UT_InitData(); - RtnCode = CFE_TBL_Load(DumpOnlyTblHandle, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_DUMP_ONLY && EventsCorrect, "CFE_TBL_Load", - "Attempt to load a dump-only table"); + UtAssert_INT32_EQ(CFE_TBL_Load(DumpOnlyTblHandle, CFE_TBL_SRC_ADDRESS, &TestTable1), CFE_TBL_ERR_DUMP_ONLY); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test attempt to load a dump-only table with the table already loaded */ UT_InitData(); @@ -2334,56 +2118,45 @@ void Test_CFE_TBL_Load(void) RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; RegRecPtr->UserDefAddr = true; RegRecPtr->TableLoadedOnce = true; - RtnCode = CFE_TBL_Load(DumpOnlyTblHandle, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_DUMP_ONLY && EventsCorrect, "CFE_TBL_Load", - "Attempt to load a dump-only table with table already loaded"); + UtAssert_INT32_EQ(CFE_TBL_Load(DumpOnlyTblHandle, CFE_TBL_SRC_ADDRESS, &TestTable1), CFE_TBL_ERR_DUMP_ONLY); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOADING_A_DUMP_ONLY_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test specifying a table address for a user defined table */ /* a. Test setup */ UT_InitData(); - RtnCode = CFE_TBL_Register(&UserDefTblHandle, "UT_Table3", sizeof(UT_Table1_t), CFE_TBL_OPT_USR_DEF_ADDR, NULL); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Specify table address for a user defined table"); + CFE_UtAssert_SUCCESS( + CFE_TBL_Register(&UserDefTblHandle, "UT_Table3", sizeof(UT_Table1_t), CFE_TBL_OPT_USR_DEF_ADDR, NULL)); + CFE_UtAssert_EVENTCOUNT(0); /* Perform test */ UT_InitData(); - RtnCode = CFE_TBL_Load(UserDefTblHandle, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", - "Specify table address for a user defined table"); + CFE_UtAssert_SUCCESS(CFE_TBL_Load(UserDefTblHandle, CFE_TBL_SRC_ADDRESS, &TestTable1)); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_SUCCESS_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test attempt to load a locked shared table */ /* a. Test setup part 1 */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table1"); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Share", - "Attempt to load locked shared table (setup part 1)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table1")); + CFE_UtAssert_EVENTCOUNT(0); /* a. Test setup part 2 */ - RtnCode = CFE_TBL_GetAddress((void **)&App2TblPtr, App2TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, "CFE_TBL_GetAddress", - "Attempt to load locked shared table (setup part 2)"); + UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&App2TblPtr, App2TblHandle1), CFE_TBL_INFO_UPDATED); + CFE_UtAssert_EVENTCOUNT(0); /* c. Perform test */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = (UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_TABLE_LOCKED && EventsCorrect, "CFE_TBL_Load", - "Attempt to load locked shared table"); + UtAssert_INT32_EQ(CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1), CFE_TBL_INFO_TABLE_LOCKED); + CFE_UtAssert_EVENTCOUNT(1); /* d. Test cleanup */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_ReleaseAddress(App2TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_ReleaseAddress", - "Attempt to load locked shared table (cleanup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_ReleaseAddress(App2TblHandle1)); + CFE_UtAssert_EVENTCOUNT(0); } /* @@ -2392,8 +2165,6 @@ void Test_CFE_TBL_Load(void) */ void Test_CFE_TBL_GetAddress(void) { - int32 RtnCode; - bool EventsCorrect; UT_Table1_t *App3TblPtr; UT_Table1_t *App2TblPtr; @@ -2404,42 +2175,33 @@ void Test_CFE_TBL_GetAddress(void) */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_3); - RtnCode = CFE_TBL_GetAddress((void **)&App3TblPtr, App2TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_GetAddress", - "Application does not have access to table"); + UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&App3TblPtr, App2TblHandle1), CFE_TBL_ERR_NO_ACCESS); + CFE_UtAssert_EVENTCOUNT(0); /* Test attempt to get the address with an invalid application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_GetAddress((void **)&App3TblPtr, App2TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, "CFE_TBL_GetAddress", - "Invalid application ID"); + UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&App3TblPtr, App2TblHandle1), CFE_ES_ERR_RESOURCEID_NOT_VALID); + CFE_UtAssert_EVENTCOUNT(0); /* Test attempt to get the address with an invalid handle */ UT_InitData(); - RtnCode = CFE_TBL_GetAddress((void **)&App3TblPtr, CFE_PLATFORM_TBL_MAX_NUM_HANDLES); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect, "CFE_TBL_GetAddress", - "Invalid table handle"); + UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&App3TblPtr, CFE_PLATFORM_TBL_MAX_NUM_HANDLES), + CFE_TBL_ERR_INVALID_HANDLE); + CFE_UtAssert_EVENTCOUNT(0); /* Attempt to get the address of an unregistered (unowned) table */ /* a. Test setup */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Unregister(App1TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", - "Attempt to get address of unregistered table (setup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(App1TblHandle1)); + CFE_UtAssert_EVENTCOUNT(0); /* b. Perform test */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_GetAddress((void **)&App2TblPtr, App2TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_UNREGISTERED && EventsCorrect, "CFE_TBL_GetAddress", - "Attempt to get address of unregistered table"); + UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&App2TblPtr, App2TblHandle1), CFE_TBL_ERR_UNREGISTERED); + CFE_UtAssert_EVENTCOUNT(0); } /* @@ -2448,9 +2210,6 @@ void Test_CFE_TBL_GetAddress(void) */ void Test_CFE_TBL_ReleaseAddress(void) { - int32 RtnCode; - bool EventsCorrect; - UtPrintf("Begin Test Release Address"); /* Test address release using an invalid application ID */ @@ -2458,19 +2217,16 @@ void Test_CFE_TBL_ReleaseAddress(void) UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); UT_ResetTableRegistry(); - RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, - Test_CFE_TBL_ValidationFunc); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Attempt to release address with invalid application ID (setup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&App1TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, + Test_CFE_TBL_ValidationFunc)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* b. Perform test */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_ReleaseAddress(App1TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, "CFE_TBL_GetAddress", - "Attempt to release address with invalid application ID"); + UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(App1TblHandle1), CFE_ES_ERR_RESOURCEID_NOT_VALID); + CFE_UtAssert_EVENTCOUNT(0); } /* @@ -2479,19 +2235,15 @@ void Test_CFE_TBL_ReleaseAddress(void) */ void Test_CFE_TBL_GetAddresses(void) { - int32 RtnCode; - bool EventsCorrect; - UtPrintf("Begin Test Get Addresses"); /* Test setup - register a double buffered table */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Register(&App1TblHandle2, "UT_Table2", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, - Test_CFE_TBL_ValidationFunc); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "CFE_TBL_GetAddresses setup - register a double buffered table"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&App1TblHandle2, "UT_Table2", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, + Test_CFE_TBL_ValidationFunc)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* b. Perform test */ UT_InitData(); @@ -2502,24 +2254,18 @@ void Test_CFE_TBL_GetAddresses(void) ArrayOfPtrsToTblPtrs[0] = &Tbl1Ptr; ArrayOfPtrsToTblPtrs[1] = &Tbl2Ptr; - RtnCode = CFE_TBL_GetAddresses(ArrayOfPtrsToTblPtrs, 2, ArrayOfHandles); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_TBL_ERR_NEVER_LOADED && EventsCorrect && Tbl1Ptr != NULL && Tbl2Ptr != NULL, - "CFE_TBL_GetAddresses", - "Get addresses of two tables (neither of which have " - "been loaded)"); + UtAssert_INT32_EQ(CFE_TBL_GetAddresses(ArrayOfPtrsToTblPtrs, 2, ArrayOfHandles), CFE_TBL_ERR_NEVER_LOADED); + CFE_UtAssert_EVENTCOUNT(0); + UtAssert_NOT_NULL(Tbl1Ptr); + UtAssert_NOT_NULL(Tbl2Ptr); /* Test attempt to get addresses of tables that the application is not * allowed to see */ UT_InitData(); UT_SetAppID(CFE_ES_APPID_UNDEFINED); - RtnCode = CFE_TBL_GetAddresses(ArrayOfPtrsToTblPtrs, 2, ArrayOfHandles); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_Validate", - "Attempt to get addresses of tables that application is not " - "allowed to see"); + UtAssert_INT32_EQ(CFE_TBL_GetAddresses(ArrayOfPtrsToTblPtrs, 2, ArrayOfHandles), CFE_TBL_ERR_NO_ACCESS); + CFE_UtAssert_EVENTCOUNT(0); } /* @@ -2528,19 +2274,13 @@ void Test_CFE_TBL_GetAddresses(void) */ void Test_CFE_TBL_ReleaseAddresses(void) { - int32 RtnCode; - bool EventsCorrect; - UtPrintf("Begin Test Release Addresses"); /* Test response to releasing two tables that have not been loaded */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_ReleaseAddresses(2, ArrayOfHandles); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NEVER_LOADED && EventsCorrect, "CFE_TBL_ReleaseAddresses", - "Release addresses of two tables (neither of which have " - "been loaded)"); + UtAssert_INT32_EQ(CFE_TBL_ReleaseAddresses(2, ArrayOfHandles), CFE_TBL_ERR_NEVER_LOADED); + CFE_UtAssert_EVENTCOUNT(0); } /* @@ -2548,9 +2288,6 @@ void Test_CFE_TBL_ReleaseAddresses(void) */ void Test_CFE_TBL_Validate(void) { - int32 RtnCode; - bool EventsCorrect; - UtPrintf("Begin Test Validate"); /* Test response to attempt to validate a table that an application is @@ -2558,21 +2295,16 @@ void Test_CFE_TBL_Validate(void) */ UT_InitData(); UT_SetAppID(CFE_ES_APPID_UNDEFINED); - RtnCode = CFE_TBL_Validate(App1TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_Validate", - "Attempt to validate table that application is not allowed " - "to see"); + UtAssert_INT32_EQ(CFE_TBL_Validate(App1TblHandle1), CFE_TBL_ERR_NO_ACCESS); + CFE_UtAssert_EVENTCOUNT(0); /* Test response to attempt to validate a table when no validation is * pending */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Validate(App1TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_NO_VALIDATION_PENDING && EventsCorrect, "CFE_TBL_Validate", - "Attempt to validate table when no validation is pending"); + UtAssert_INT32_EQ(CFE_TBL_Validate(App1TblHandle1), CFE_TBL_INFO_NO_VALIDATION_PENDING); + CFE_UtAssert_EVENTCOUNT(0); } /* @@ -2581,8 +2313,6 @@ void Test_CFE_TBL_Validate(void) */ void Test_CFE_TBL_Manage(void) { - int32 RtnCode; - bool EventsCorrect; int16 RegIndex; CFE_TBL_RegistryRec_t * RegRecPtr; CFE_TBL_LoadBuff_t * WorkingBufferPtr; @@ -2595,10 +2325,8 @@ void Test_CFE_TBL_Manage(void) /* Test response to attempt to manage a table that doesn't need managing */ UT_InitData(); - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Manage", - "Manage table that doesn't need managing"); + CFE_UtAssert_SUCCESS(CFE_TBL_Manage(App1TblHandle1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test response to attempt to load while a load is in progress */ UT_InitData(); @@ -2606,12 +2334,11 @@ void Test_CFE_TBL_Manage(void) /* "Load" image into inactive buffer for table */ RegIndex = CFE_TBL_FindTableInRegistry("ut_cfe_tbl.UT_Table1"); RegRecPtr = &CFE_TBL_Global.Registry[RegIndex]; - RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); + CFE_UtAssert_SUCCESS(CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false)); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_IN_PROGRESS_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_LOAD_IN_PROGRESS && EventsCorrect, "CFE_TBL_Load", - "Attempt to load while a load is in progress"); + UtAssert_INT32_EQ(CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_ADDRESS, &TestTable1), CFE_TBL_ERR_LOAD_IN_PROGRESS); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_IN_PROGRESS_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to processing an unsuccessful validation request on * inactive buffer; validation function return code is valid @@ -2630,13 +2357,10 @@ void Test_CFE_TBL_Manage(void) /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, -1); - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == -1, - "CFE_TBL_Manage", - "Manage table that has a failed validation pending on " - "inactive buffer (valid function return code)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Manage(App1TblHandle1)); + CFE_UtAssert_EVENTSENT(CFE_TBL_VALIDATION_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); + UtAssert_INT32_EQ(CFE_TBL_Global.ValidationResults[0].Result, -1); /* Test response to processing an unsuccessful validation request on * inactive buffer ; validation function return code is invalid @@ -2655,13 +2379,10 @@ void Test_CFE_TBL_Manage(void) /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, 1); - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == 1, - "CFE_TBL_Manage", - "Manage table that has a failed validation pending on " - "inactive buffer (invalid function return code)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Manage(App1TblHandle1)); + CFE_UtAssert_EVENTSENT(CFE_TBL_VALIDATION_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); + UtAssert_INT32_EQ(CFE_TBL_Global.ValidationResults[0].Result, 1); /* Test response to processing a successful validation request on an * inactive buffer @@ -2680,13 +2401,10 @@ void Test_CFE_TBL_Manage(void) /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, CFE_SUCCESS); - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == 0, - "CFE_TBL_Manage", - "Manage table that has a successful validation pending on " - "an inactive buffer"); + CFE_UtAssert_SUCCESS(CFE_TBL_Manage(App1TblHandle1)); + CFE_UtAssert_EVENTSENT(CFE_TBL_VALIDATION_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); + UtAssert_INT32_EQ(CFE_TBL_Global.ValidationResults[0].Result, 0); /* Test response to processing an unsuccessful validation request on an * active buffer @@ -2705,13 +2423,10 @@ void Test_CFE_TBL_Manage(void) /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, -1); - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == -1, - "CFE_TBL_Manage", - "Manage table that has an unsuccessful validation pending on " - "an active buffer"); + CFE_UtAssert_SUCCESS(CFE_TBL_Manage(App1TblHandle1)); + CFE_UtAssert_EVENTSENT(CFE_TBL_VALIDATION_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); + UtAssert_INT32_EQ(CFE_TBL_Global.ValidationResults[0].Result, -1); /* Test response to processing an unsuccessful validation request on * an active buffer @@ -2730,13 +2445,10 @@ void Test_CFE_TBL_Manage(void) /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, 1); - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == 1, - "CFE_TBL_Manage", - "Manage table that has an unsuccessful validation pending " - "on an active buffer"); + CFE_UtAssert_SUCCESS(CFE_TBL_Manage(App1TblHandle1)); + CFE_UtAssert_EVENTSENT(CFE_TBL_VALIDATION_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); + UtAssert_INT32_EQ(CFE_TBL_Global.ValidationResults[0].Result, 1); /* Test response to processing a successful validation request on an * active buffer @@ -2755,28 +2467,21 @@ void Test_CFE_TBL_Manage(void) /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, CFE_SUCCESS); - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == 0, - "CFE_TBL_Manage", - "Manage table that has a successful validation pending on " - "an active buffer"); + CFE_UtAssert_SUCCESS(CFE_TBL_Manage(App1TblHandle1)); + CFE_UtAssert_EVENTSENT(CFE_TBL_VALIDATION_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); + UtAssert_INT32_EQ(CFE_TBL_Global.ValidationResults[0].Result, 0); /* Test response to processing an update request on a locked table */ /* a. Test setup - part 1 */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table1"); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Share", - "Process an update request on a locked table (setup - part 1)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table1")); + CFE_UtAssert_EVENTCOUNT(0); /* a. Test setup - part 2 */ - RtnCode = CFE_TBL_GetAddress((void **)&App2TblPtr, App2TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NEVER_LOADED && EventsCorrect, "CFE_TBL_GetAddress", - "Process an update request on a locked table (setup - part 2)"); + UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&App2TblPtr, App2TblHandle1), CFE_TBL_ERR_NEVER_LOADED); + CFE_UtAssert_EVENTCOUNT(0); /* c. Perform test */ UT_InitData(); @@ -2784,10 +2489,8 @@ void Test_CFE_TBL_Manage(void) /* Configure table for update */ RegRecPtr->LoadPending = true; - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_TABLE_LOCKED && EventsCorrect, "CFE_TBL_Manage", - "Process an update request on a locked table"); + UtAssert_INT32_EQ(CFE_TBL_Manage(App1TblHandle1), CFE_TBL_INFO_TABLE_LOCKED); + CFE_UtAssert_EVENTCOUNT(0); /* Save the previous table's information for a subsequent test */ AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; @@ -2797,10 +2500,8 @@ void Test_CFE_TBL_Manage(void) /* Test unlocking a table by releasing the address */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_ReleaseAddress(App2TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NEVER_LOADED && EventsCorrect, "CFE_TBL_ReleaseAddress", - "Release address to unlock shared table"); + UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(App2TblHandle1), CFE_TBL_ERR_NEVER_LOADED); + CFE_UtAssert_EVENTCOUNT(0); /* Test response to processing an update request on a single * buffered table @@ -2810,10 +2511,9 @@ void Test_CFE_TBL_Manage(void) /* Configure table for Update */ RegRecPtr->LoadPending = true; - RtnCode = CFE_TBL_Manage(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_UPDATE_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, "CFE_TBL_Manage", - "Process an update request on a single buffered table"); + UtAssert_INT32_EQ(CFE_TBL_Manage(App1TblHandle1), CFE_TBL_INFO_UPDATED); + CFE_UtAssert_EVENTSENT(CFE_TBL_UPDATE_SUCCESS_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test response to processing an unsuccessful validation request on an * inactive buffer (double buffered) @@ -2834,16 +2534,14 @@ void Test_CFE_TBL_Manage(void) /* Attempt to "load" image into inactive buffer for table */ RegIndex = CFE_TBL_FindTableInRegistry("ut_cfe_tbl.UT_Table2"); RegRecPtr = &CFE_TBL_Global.Registry[RegIndex]; - RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_BUFFER_AVAIL, "CFE_TBL_GetWorkingBuffer", - "No buffer available"); + UtAssert_INT32_EQ(CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false), CFE_TBL_ERR_NO_BUFFER_AVAIL); /* Reset the table information for subsequent tests */ CFE_TBL_Global.Handles[AccessIterator].BufferIndex = 1; CFE_TBL_Global.Handles[AccessIterator].LockFlag = false; /* Successfully "load" image into inactive buffer for table */ - RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); + CFE_UtAssert_SUCCESS(CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false)); /* Configure table for validation */ CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_PENDING; @@ -2857,13 +2555,10 @@ void Test_CFE_TBL_Manage(void) /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, -1); - RtnCode = CFE_TBL_Manage(App1TblHandle2); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == -1, - "CFE_TBL_Manage", - "Manage table that has a failed validation pending on an " - "inactive buffer (double buffered)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Manage(App1TblHandle2)); + CFE_UtAssert_EVENTSENT(CFE_TBL_VALIDATION_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); + UtAssert_INT32_EQ(CFE_TBL_Global.ValidationResults[0].Result, -1); /* Test successfully processing a validation request on an inactive buffer * (double buffered) @@ -2882,13 +2577,10 @@ void Test_CFE_TBL_Manage(void) /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, CFE_SUCCESS); - RtnCode = CFE_TBL_Manage(App1TblHandle2); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == 0, - "CFE_TBL_Manage", - "Manage table that has a successful validation pending on an " - "inactive buffer (double buffered)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Manage(App1TblHandle2)); + CFE_UtAssert_EVENTSENT(CFE_TBL_VALIDATION_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); + UtAssert_INT32_EQ(CFE_TBL_Global.ValidationResults[0].Result, 0); /* Test processing an unsuccessful validation request on an active buffer * (double buffered) @@ -2907,13 +2599,10 @@ void Test_CFE_TBL_Manage(void) /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, -1); - RtnCode = CFE_TBL_Manage(App1TblHandle2); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == -1, - "CFE_TBL_Manage", - "Manage table that has an unsuccessful validation pending on an " - "active buffer (double buffered)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Manage(App1TblHandle2)); + CFE_UtAssert_EVENTSENT(CFE_TBL_VALIDATION_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); + UtAssert_INT32_EQ(CFE_TBL_Global.ValidationResults[0].Result, -1); /* Test successfully processing a validation request on active buffer * (double buffered) @@ -2932,17 +2621,14 @@ void Test_CFE_TBL_Manage(void) /* Perform validation via manage call */ UT_SetDeferredRetcode(UT_KEY(Test_CFE_TBL_ValidationFunc), 1, CFE_SUCCESS); - RtnCode = CFE_TBL_Manage(App1TblHandle2); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_VALIDATION_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && CFE_TBL_Global.ValidationResults[0].Result == 0, - "CFE_TBL_Manage", - "Manage table that has a successful validation pending on an " - "active buffer (double buffered)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Manage(App1TblHandle2)); + CFE_UtAssert_EVENTSENT(CFE_TBL_VALIDATION_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); + UtAssert_INT32_EQ(CFE_TBL_Global.ValidationResults[0].Result, 0); /* Test successfully processing a table dump request */ UT_InitData(); - RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); + CFE_UtAssert_SUCCESS(CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false)); CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PENDING; CFE_TBL_Global.DumpControlBlocks[0].RegRecPtr = RegRecPtr; @@ -2959,10 +2645,8 @@ void Test_CFE_TBL_Manage(void) CFE_TBL_Global.DumpControlBlocks[0].TableName[sizeof(CFE_TBL_Global.DumpControlBlocks[0].TableName) - 1] = 0; CFE_TBL_Global.DumpControlBlocks[0].Size = RegRecPtr->Size; RegRecPtr->DumpControlIndex = 0; - RtnCode = CFE_TBL_Manage(App1TblHandle2); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Manage", - "Manage table that has a dump request pending"); + CFE_UtAssert_SUCCESS(CFE_TBL_Manage(App1TblHandle2)); + CFE_UtAssert_EVENTCOUNT(0); } /* @@ -2970,9 +2654,6 @@ void Test_CFE_TBL_Manage(void) */ void Test_CFE_TBL_Update(void) { - int32 RtnCode; - bool EventsCorrect; - UtPrintf("Begin Test Update"); /* Test processing an update on a single buffered table without @@ -2980,31 +2661,24 @@ void Test_CFE_TBL_Update(void) */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_Update(App1TblHandle1); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_UPDATE_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_Update", - "Process an update on a single buffered table " - "without privileges"); + UtAssert_INT32_EQ(CFE_TBL_Update(App1TblHandle1), CFE_TBL_ERR_NO_ACCESS); + CFE_UtAssert_EVENTSENT(CFE_TBL_UPDATE_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test processing an update on a single buffered table when no update * is pending */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Update(App1TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_NO_UPDATE_PENDING && EventsCorrect, "CFE_TBL_Update", - "Process an update on a single buffered table when no update " - "is pending"); + UtAssert_INT32_EQ(CFE_TBL_Update(App1TblHandle1), CFE_TBL_INFO_NO_UPDATE_PENDING); + CFE_UtAssert_EVENTCOUNT(0); /* Test processing an update on an application with a bad ID */ UT_InitData(); UT_SetAppID(CFE_ES_APPID_UNDEFINED); - RtnCode = CFE_TBL_Update(App1TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_Update", - "Bad application ID"); + UtAssert_INT32_EQ(CFE_TBL_Update(App1TblHandle1), CFE_TBL_ERR_NO_ACCESS); + CFE_UtAssert_EVENTCOUNT(1); } /* @@ -3012,9 +2686,6 @@ void Test_CFE_TBL_Update(void) */ void Test_CFE_TBL_GetStatus(void) { - int32 RtnCode; - bool EventsCorrect; - UtPrintf("Begin Test Get Status"); /* Test response to an attempt to get the status on a table that the @@ -3022,22 +2693,16 @@ void Test_CFE_TBL_GetStatus(void) */ UT_InitData(); UT_SetAppID(CFE_ES_APPID_UNDEFINED); - RtnCode = CFE_TBL_GetStatus(App1TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_GetStatus", - "Attempt to get status on a table that the application is not " - "allowed to see"); + UtAssert_INT32_EQ(CFE_TBL_GetStatus(App1TblHandle1), CFE_TBL_ERR_NO_ACCESS); + CFE_UtAssert_EVENTCOUNT(0); /* Test response to an attempt to dump the buffer on a table that the * application is not allowed to see */ UT_InitData(); UT_SetAppID(CFE_ES_APPID_UNDEFINED); - RtnCode = CFE_TBL_DumpToBuffer(App1TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_GetStatus", - "Attempt to to dump the buffer on a table that the application " - "is not allowed to see"); + UtAssert_INT32_EQ(CFE_TBL_DumpToBuffer(App1TblHandle1), CFE_TBL_ERR_NO_ACCESS); + CFE_UtAssert_EVENTCOUNT(0); } /* @@ -3045,8 +2710,6 @@ void Test_CFE_TBL_GetStatus(void) */ void Test_CFE_TBL_GetInfo(void) { - int32 RtnCode; - bool EventsCorrect; CFE_TBL_Info_t TblInfo; UtPrintf("Begin Test Get Info"); @@ -3054,17 +2717,13 @@ void Test_CFE_TBL_GetInfo(void) /* Test successfully getting information on a table */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_GetInfo(&TblInfo, "ut_cfe_tbl.UT_Table1"); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_GetInfo", - "Get information on UT_Table1"); + CFE_UtAssert_SUCCESS(CFE_TBL_GetInfo(&TblInfo, "ut_cfe_tbl.UT_Table1")); + CFE_UtAssert_EVENTCOUNT(0); /* Test response to attempt to get information on a non-existent table */ UT_InitData(); - RtnCode = CFE_TBL_GetInfo(&TblInfo, "ut_cfe_tbl.UT_Table_Not"); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_NAME && EventsCorrect, "CFE_TBL_GetInfo", - "Get information on non-existent table"); + UtAssert_INT32_EQ(CFE_TBL_GetInfo(&TblInfo, "ut_cfe_tbl.UT_Table_Not"), CFE_TBL_ERR_INVALID_NAME); + CFE_UtAssert_EVENTCOUNT(0); } /* @@ -3073,9 +2732,6 @@ void Test_CFE_TBL_GetInfo(void) */ void Test_CFE_TBL_TblMod(void) { - int32 RtnCode; - int32 RtnCode2; - bool EventsCorrect; CFE_FS_Header_t FileHeader; UT_TempFile_t File; uint32 Index; @@ -3102,11 +2758,9 @@ void Test_CFE_TBL_TblMod(void) UT_ResetPoolBufferIndex(); /* Test setup for CFE_TBL_Modified; register a non critical table */ - RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Add TBL API for notifying table services that table has " - "been updated by application (setup)"); + CFE_UtAssert_SUCCESS( + CFE_TBL_Register(&App1TblHandle1, "UT_Table1", sizeof(UT_Table1_t), CFE_TBL_OPT_CRITICAL, NULL)); + CFE_UtAssert_EVENTCOUNT(0); /* b. Perform test */ UT_ClearEventHistory(); @@ -3138,8 +2792,9 @@ void Test_CFE_TBL_TblMod(void) UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); /* Perform load */ - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "MyInputFile"); - EventsCorrect = (UT_GetNumEventsSent() == 1 && UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true); + CFE_UtAssert_SUCCESS(CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "MyInputFile")); + CFE_UtAssert_EVENTCOUNT(1); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_SUCCESS_INF_EID); /* Modify the contents of the table */ CFE_TBL_GetAddress((void **)&TblDataPtr, App1TblHandle1); @@ -3148,16 +2803,11 @@ void Test_CFE_TBL_TblMod(void) /* Notify Table Services that the table has been modified */ UT_SetDataBuffer(UT_KEY(CFE_ES_CopyToCDS), CDS_Data, sizeof(CDS_Data), false); - RtnCode = CFE_TBL_Modified(App1TblHandle1); - RtnCode2 = CFE_TBL_GetInfo(&TblInfo1, "ut_cfe_tbl.UT_Table1"); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && RtnCode2 == CFE_SUCCESS && EventsCorrect && - TblInfo1.TimeOfLastUpdate.Seconds == TblInfo1.TimeOfLastUpdate.Subseconds && - strcmp(TblInfo1.LastFileLoaded, "MyInputFile(*)") == 0 && - memcmp(CDS_Data, &File.TblData, sizeof(CDS_Data)) == 0, - "CFE_TBL_Modified", - "Add TBL API for notifying table services that table has " - "been updated by application"); + CFE_UtAssert_SUCCESS(CFE_TBL_Modified(App1TblHandle1)); + CFE_UtAssert_SUCCESS(CFE_TBL_GetInfo(&TblInfo1, "ut_cfe_tbl.UT_Table1")); + UtAssert_UINT32_EQ(TblInfo1.TimeOfLastUpdate.Seconds, TblInfo1.TimeOfLastUpdate.Subseconds); + UtAssert_StrCmp(TblInfo1.LastFileLoaded, "MyInputFile(*)", "TblInfo1.LastFileLoaded (%s)", TblInfo1.LastFileLoaded); + UtAssert_MemCmp(CDS_Data, &File.TblData, sizeof(CDS_Data), "Table Data"); /* Save the previous table's information for a subsequent test */ AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; @@ -3171,11 +2821,9 @@ void Test_CFE_TBL_TblMod(void) UT_InitData(); /* Register a non critical table */ - RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table2", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "Add TBL API for notifying table services that table has " - "been updated by application (setup)"); + CFE_UtAssert_SUCCESS( + CFE_TBL_Register(&App1TblHandle1, "UT_Table2", sizeof(UT_Table1_t), CFE_TBL_OPT_DEFAULT, NULL)); + CFE_UtAssert_EVENTCOUNT(0); /* Reset the current table entry pointer to a previous table in order to * exercise the path where one of the application IDs don't match @@ -3211,13 +2859,13 @@ void Test_CFE_TBL_TblMod(void) MyFilename[sizeof(MyFilename) - 1] = '\0'; CFE_UtAssert_SUCCESS(CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, MyFilename)); - CFE_UtAssert_EQUAL(UT_GetNumEventsSent(), 1); - CFE_UtAssert_TRUE(UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID)); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_SUCCESS_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Notify Table Services that the table has been modified */ CFE_UtAssert_SUCCESS(CFE_TBL_Modified(App1TblHandle1)); CFE_UtAssert_SUCCESS(CFE_TBL_GetInfo(&TblInfo1, "ut_cfe_tbl.UT_Table2")); - CFE_UtAssert_EQUAL(TblInfo1.TimeOfLastUpdate.Seconds, TblInfo1.TimeOfLastUpdate.Subseconds); + UtAssert_INT32_EQ(TblInfo1.TimeOfLastUpdate.Seconds, TblInfo1.TimeOfLastUpdate.Subseconds); /* * LastFileLoaded (limited by mission) can be bigger than MyFilename (limited by osal), @@ -3229,9 +2877,7 @@ void Test_CFE_TBL_TblMod(void) &TblInfo1.LastFileLoaded[sizeof(MyFilename) - 4]); /* Test response to an invalid handle */ - RtnCode = CFE_TBL_Modified(CFE_TBL_BAD_TABLE_HANDLE); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect, "CFE_TBL_Modified", - "Invalid table handle"); + UtAssert_INT32_EQ(CFE_TBL_Modified(CFE_TBL_BAD_TABLE_HANDLE), CFE_TBL_ERR_INVALID_HANDLE); } /* @@ -3239,8 +2885,6 @@ void Test_CFE_TBL_TblMod(void) */ void Test_CFE_TBL_Internal(void) { - int32 RtnCode; - bool EventsCorrect; CFE_TBL_LoadBuff_t * WorkingBufferPtr; CFE_TBL_RegistryRec_t * RegRecPtr; CFE_TBL_AccessDescriptor_t *AccessDescPtr; @@ -3261,11 +2905,10 @@ void Test_CFE_TBL_Internal(void) /* Test setup - register a double buffered table */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_Register(&App1TblHandle2, "UT_Table3", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, - Test_CFE_TBL_ValidationFunc); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_REGISTER_ERR_EID) == false && UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Register", - "CFE_TBL_GetWorkingBuffer setup - register a double buffered table"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&App1TblHandle2, "UT_Table3", sizeof(UT_Table1_t), CFE_TBL_OPT_DBL_BUFFER, + Test_CFE_TBL_ValidationFunc)); + CFE_UtAssert_EVENTNOTSENT(CFE_TBL_REGISTER_ERR_EID); + CFE_UtAssert_EVENTCOUNT(0); /* Test successful initial load of double buffered table */ UT_InitData(); @@ -3275,12 +2918,9 @@ void Test_CFE_TBL_Internal(void) RegRecPtr->Name[sizeof(RegRecPtr->Name) - 1] = '\0'; RegRecPtr->TableLoadedOnce = false; RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, true); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, - RtnCode == CFE_SUCCESS && EventsCorrect && - WorkingBufferPtr == &RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex], - "CFE_TBL_GetWorkingBuffer", "Initial load of double buffered table"); + CFE_UtAssert_SUCCESS(CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, true)); + CFE_UtAssert_EVENTCOUNT(0); + UtAssert_ADDRESS_EQ(WorkingBufferPtr, &RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex]); /* Test response to a single buffered table with a mutex sem take * failure @@ -3289,10 +2929,8 @@ void Test_CFE_TBL_Internal(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, OS_ERROR); AccessDescPtr = &CFE_TBL_Global.Handles[App1TblHandle1]; RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; - RtnCode = CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_GetWorkingBuffer", - "Single buffered table has mutex sem take failure"); + CFE_UtAssert_SUCCESS(CFE_TBL_GetWorkingBuffer(&WorkingBufferPtr, RegRecPtr, false)); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_LoadFromFile response to a file name that is too long */ UT_InitData(); @@ -3303,10 +2941,10 @@ void Test_CFE_TBL_Internal(void) } FilenameLong[i] = '\0'; /* Null terminate file name string */ - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, FilenameLong); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_FILENAME_LONG_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_FILENAME_TOO_LONG && EventsCorrect, "CFE_TBL_LoadFromFile", - "Filename too long"); + UtAssert_INT32_EQ(CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, FilenameLong), + CFE_TBL_ERR_FILENAME_TOO_LONG); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_FILENAME_LONG_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test CFE_TBL_LoadFromFile response to a file that's content is too large * (according to the header) @@ -3324,10 +2962,9 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_EXCEEDS_SIZE_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_FILE_TOO_LARGE && EventsCorrect, "CFE_TBL_LoadFromFile", - "File content too large (according to header)"); + UtAssert_INT32_EQ(CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename), CFE_TBL_ERR_FILE_TOO_LARGE); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_EXCEEDS_SIZE_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test CFE_TBL_LoadFromFile response that's file content is too large * (too much content) @@ -3342,10 +2979,9 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 2, sizeof(UT_Table1_t)); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_TOO_BIG_ERR_EID) == true && UT_GetNumEventsSent() == 1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_FILE_TOO_LARGE && EventsCorrect, "CFE_TBL_LoadFromFile", - "File content too large (too much content)"); + UtAssert_INT32_EQ(CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename), CFE_TBL_ERR_FILE_TOO_LARGE); + CFE_UtAssert_EVENTSENT(CFE_TBL_FILE_TOO_BIG_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test CFE_TBL_LoadFromFile response to the file content being * incomplete @@ -3361,10 +2997,9 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 2, sizeof(UT_Table1_t) - 1); UT_SetDeferredRetcode(UT_KEY(OS_read), 1, 0); - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_INCOMPLETE_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_LOAD_INCOMPLETE && EventsCorrect, "CFE_TBL_LoadFromFile", - "File content incomplete"); + UtAssert_INT32_EQ(CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename), CFE_TBL_ERR_LOAD_INCOMPLETE); + CFE_UtAssert_EVENTSENT(CFE_TBL_FILE_INCOMPLETE_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test CFE_TBL_LoadFromFile response to the file being for the * wrong table @@ -3379,10 +3014,10 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_FILE_FOR_WRONG_TABLE && EventsCorrect, "CFE_TBL_LoadFromFile", - "File for wrong table"); + UtAssert_INT32_EQ(CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename), + CFE_TBL_ERR_FILE_FOR_WRONG_TABLE); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_TBLNAME_MISMATCH_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test CFE_TBL_LoadFromFile response to an OS open error */ UT_InitData(); @@ -3395,10 +3030,9 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_ACCESS_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_ACCESS && EventsCorrect, "CFE_TBL_LoadFromFile", - "OS open error"); + UtAssert_INT32_EQ(CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename), CFE_TBL_ERR_ACCESS); + CFE_UtAssert_EVENTSENT(CFE_TBL_FILE_ACCESS_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test CFE_TBL_LoadFromFile response to a file too short warning */ UT_InitData(); @@ -3411,10 +3045,8 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_WARN_SHORT_FILE && EventsCorrect, "CFE_TBL_LoadFromFile", - "File too short warning"); + UtAssert_INT32_EQ(CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename), CFE_TBL_WARN_SHORT_FILE); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_ReadHeaders response to a failure reading the standard cFE * file header @@ -3431,10 +3063,10 @@ void Test_CFE_TBL_Internal(void) strncpy(Filename, "MyTestInputFilename", sizeof(Filename) - 1); Filename[sizeof(Filename) - 1] = '\0'; UT_SetDeferredRetcode(UT_KEY(CFE_FS_ReadHeader), 1, sizeof(CFE_FS_Header_t) - 1); - RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_STD_HDR_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_STD_HEADER && EventsCorrect, "CFE_TBL_ReadHeaders", - "Failure reading standard cFE file header"); + UtAssert_INT32_EQ(CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename), + CFE_TBL_ERR_NO_STD_HEADER); + CFE_UtAssert_EVENTSENT(CFE_TBL_FILE_STD_HDR_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test CFE_TBL_ReadHeaders response to a bad magic number in cFE * standard header @@ -3455,10 +3087,10 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_TYPE_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_BAD_CONTENT_ID && EventsCorrect, "CFE_TBL_ReadHeaders", - "Bad magic number in cFE standard header"); + UtAssert_INT32_EQ(CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename), + CFE_TBL_ERR_BAD_CONTENT_ID); + CFE_UtAssert_EVENTSENT(CFE_TBL_FILE_TYPE_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test CFE_TBL_ReadHeaders response to a wrong cFE file subtype */ UT_InitData(); @@ -3470,10 +3102,10 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_SUBTYPE_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_BAD_SUBTYPE_ID && EventsCorrect, "CFE_TBL_ReadHeaders", - "Wrong cFE file subType"); + UtAssert_INT32_EQ(CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename), + CFE_TBL_ERR_BAD_SUBTYPE_ID); + CFE_UtAssert_EVENTSENT(CFE_TBL_FILE_SUBTYPE_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test CFE_TBL_ReadHeaders response to a failure reading the cFE * table header @@ -3488,52 +3120,42 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 1, sizeof(CFE_TBL_File_Hdr_t) - 1); - RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_FILE_TBL_HDR_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_TBL_HEADER && EventsCorrect, "CFE_TBL_ReadHeaders", - "Failure reading cFE table header"); + UtAssert_INT32_EQ(CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename), + CFE_TBL_ERR_NO_TBL_HEADER); + CFE_UtAssert_EVENTSENT(CFE_TBL_FILE_TBL_HDR_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test CFE_TBL_RemoveAccessLink response to a failure to put back the * memory buffer for a double buffered table */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_PutPoolBuf), 2, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_RemoveAccessLink(App1TblHandle2); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, - "CFE_TBL_RemoveAccessLink", "Fail to put back memory buffer for double buffered table"); + UtAssert_INT32_EQ(CFE_TBL_RemoveAccessLink(App1TblHandle2), CFE_ES_ERR_RESOURCEID_NOT_VALID); + CFE_UtAssert_EVENTCOUNT(0); /* EarlyInit - Table Registry Mutex Create Failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_ERROR); - RtnCode = CFE_TBL_EarlyInit(); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == OS_ERROR && EventsCorrect, "CFE_TBL_EarlyInit", - "Table registry mutex create failure"); + UtAssert_INT32_EQ(CFE_TBL_EarlyInit(), OS_ERROR); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_EarlyInit response to a work buffer mutex create failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 2, OS_ERROR); - RtnCode = CFE_TBL_EarlyInit(); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == OS_ERROR && EventsCorrect, "CFE_TBL_EarlyInit", - "Work buffer mutex create failure"); + UtAssert_INT32_EQ(CFE_TBL_EarlyInit(), OS_ERROR); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_EarlyInit response to a memory pool create failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_PoolCreate), 1, CFE_ES_BAD_ARGUMENT); - RtnCode = CFE_TBL_EarlyInit(); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_BAD_ARGUMENT && EventsCorrect, "CFE_TBL_EarlyInit", - "Memory pool create failure"); + UtAssert_INT32_EQ(CFE_TBL_EarlyInit(), CFE_ES_BAD_ARGUMENT); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_EarlyInit reponse to a get pool buffer failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_EarlyInit(); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_RESOURCEID_NOT_VALID && EventsCorrect, "CFE_TBL_EarlyInit", - "Get pool buffer failure"); + UtAssert_INT32_EQ(CFE_TBL_EarlyInit(), CFE_ES_ERR_RESOURCEID_NOT_VALID); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_EarlyInit response where the CDS already exists but * restore fails @@ -3541,48 +3163,38 @@ void Test_CFE_TBL_Internal(void) UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_CDS_ALREADY_EXISTS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RestoreFromCDS), 1, CFE_ES_CDS_BLOCK_CRC_ERR); - RtnCode = CFE_TBL_EarlyInit(); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_EarlyInit", - "CDS already exists but restore fails"); + CFE_UtAssert_SUCCESS(CFE_TBL_EarlyInit()); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_EarlyInit response when no CDS is available */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_NOT_IMPLEMENTED); - RtnCode = CFE_TBL_EarlyInit(); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_EarlyInit", "No CDS available"); + CFE_UtAssert_SUCCESS(CFE_TBL_EarlyInit()); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_EarlyInit response to a failure to save a critical table * registry to the CDS */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_CopyToCDS), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_EarlyInit(); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_EarlyInit", - "Fail to save critical table registry to CDS"); + CFE_UtAssert_SUCCESS(CFE_TBL_EarlyInit()); + CFE_UtAssert_EVENTCOUNT(0); /* Reset, then register tables for subsequent tests */ /* a. Reset tables */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_1); - RtnCode = CFE_TBL_EarlyInit(); - UT_Report(__FILE__, __LINE__, (RtnCode == CFE_SUCCESS), "CFE_TBL_EarlyInit", "Reset (setup - part 1)"); + CFE_UtAssert_SUCCESS(CFE_TBL_EarlyInit()); /* b. Register critical single buffered table */ UT_InitData(); - RtnCode = CFE_TBL_Register(&App1TblHandle1, "UT_Table1", sizeof(UT_Table1_t), - CFE_TBL_OPT_DEFAULT | CFE_TBL_OPT_CRITICAL, Test_CFE_TBL_ValidationFunc); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS, "CFE_TBL_Register", - "Critical single buffered table (setup - part 2)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&App1TblHandle1, "UT_Table1", sizeof(UT_Table1_t), + CFE_TBL_OPT_DEFAULT | CFE_TBL_OPT_CRITICAL, Test_CFE_TBL_ValidationFunc)); /* c. Register critical double buffered table */ UT_InitData(); - RtnCode = CFE_TBL_Register(&App1TblHandle2, "UT_Table2", sizeof(UT_Table1_t), - CFE_TBL_OPT_DBL_BUFFER | CFE_TBL_OPT_CRITICAL, Test_CFE_TBL_ValidationFunc); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS, "CFE_TBL_Register", - "Critical double buffered table (setup - part 3)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Register(&App1TblHandle2, "UT_Table2", sizeof(UT_Table1_t), + CFE_TBL_OPT_DBL_BUFFER | CFE_TBL_OPT_CRITICAL, Test_CFE_TBL_ValidationFunc)); /* d. Perform an initial load on the critical single buffered table */ UT_InitData(); @@ -3595,10 +3207,9 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", - "Critical single buffered table (setup - part 4)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat")); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_SUCCESS_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); /* e. Update CDS for single buffered table */ UT_InitData(); @@ -3611,10 +3222,9 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", - "Update CDS for single buffered table (setup - part 5)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Load(App1TblHandle1, CFE_TBL_SRC_FILE, "TblSrcFileName.dat")); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_SUCCESS_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); /* f. Perform an initial load on the critical double buffered table */ UT_InitData(); @@ -3627,10 +3237,9 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", - "Critical single buffered table (setup - part 6)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat")); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_SUCCESS_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); /* g. Update CDS for double buffered table */ UT_InitData(); @@ -3644,10 +3253,9 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); CFE_TBL_GetAddress(&TblPtr, App1TblHandle2); - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", - "Update CDS for single buffered table (setup - part 7)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat")); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_SUCCESS_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test CFE_TBL_GetWorkingBuffer response when both double buffered table * buffers are locked @@ -3662,25 +3270,21 @@ void Test_CFE_TBL_Internal(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_NO_WORK_BUFFERS_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_BUFFER_AVAIL && EventsCorrect, "CFE_TBL_Load", - "Both double buffered table buffers locked"); + UtAssert_INT32_EQ(CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"), + CFE_TBL_ERR_NO_BUFFER_AVAIL); + CFE_UtAssert_EVENTSENT(CFE_TBL_NO_WORK_BUFFERS_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Release buffer for error writing to CDS test */ /* a. Get table address */ UT_InitData(); - RtnCode = CFE_TBL_GetAddress(&TblPtr, App1TblHandle2); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, "CFE_TBL_GetAddress", - "Error writing to CDS (setup - part 1)"); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblPtr, App1TblHandle2), CFE_TBL_INFO_UPDATED); + CFE_UtAssert_EVENTCOUNT(0); /* b. Release table address */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_ReleaseAddress(App1TblHandle2); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_ReleaseAddress", - "Error writing to CDS (setup - part 2)"); + CFE_UtAssert_SUCCESS(CFE_TBL_ReleaseAddress(App1TblHandle2)); + CFE_UtAssert_EVENTCOUNT(0); /* c. Perform test */ UT_ClearEventHistory(); @@ -3694,24 +3298,20 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); UT_SetDeferredRetcode(UT_KEY(CFE_ES_CopyToCDS), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, ((RtnCode == CFE_SUCCESS) && EventsCorrect), "CFE_TBL_Load", "Error writing to CDS"); + CFE_UtAssert_SUCCESS(CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat")); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_SUCCESS_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Release buffer for error writing to CDS (second time) test */ /* a. Get table address */ UT_InitData(); - RtnCode = CFE_TBL_GetAddress(&TblPtr, App1TblHandle2); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, "CFE_TBL_GetAddress", - "Error writing to CDS second time (setup - part 1)"); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblPtr, App1TblHandle2), CFE_TBL_INFO_UPDATED); + CFE_UtAssert_EVENTCOUNT(0); /* b. Release table address */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_ReleaseAddress(App1TblHandle2); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_ReleaseAddress", - "Error writing to CDS second time (setup - part 2)"); + CFE_UtAssert_SUCCESS(CFE_TBL_ReleaseAddress(App1TblHandle2)); + CFE_UtAssert_EVENTCOUNT(0); /* c. Perform test */ UT_ClearEventHistory(); @@ -3725,27 +3325,22 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); UT_SetDeferredRetcode(UT_KEY(CFE_ES_CopyToCDS), 2, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", - "Error writing to CDS (second time)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat")); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_SUCCESS_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Release buffer for failure to find the CDS handle in the CDS * registry test */ /* a. Get table address */ UT_InitData(); - RtnCode = CFE_TBL_GetAddress(&TblPtr, App1TblHandle2); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_UPDATED && EventsCorrect, "CFE_TBL_GetAddress", - "Failure to find CDS handle in CDS registry (setup - part 1)"); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblPtr, App1TblHandle2), CFE_TBL_INFO_UPDATED); + CFE_UtAssert_EVENTCOUNT(0); /* b. Release table address */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_ReleaseAddress(App1TblHandle2); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_ReleaseAddress", - "Failure to find CDS handle in CDS registry (setup - part 2)"); + CFE_UtAssert_SUCCESS(CFE_TBL_ReleaseAddress(App1TblHandle2)); + CFE_UtAssert_EVENTCOUNT(0); /* c. Perform test */ UT_ClearEventHistory(); @@ -3770,25 +3365,21 @@ void Test_CFE_TBL_Internal(void) } } - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_LOAD_SUCCESS_INF_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Load", - "Failure to find CDS handle in CDS registry"); + CFE_UtAssert_SUCCESS(CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat")); + CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_SUCCESS_INF_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test unregistering a shared table */ /* a. Share table */ UT_InitData(); CFE_TBL_Global.CritReg[0].CDSHandle = RegRecPtr->CDSHandle; UT_SetAppID(UT_TBL_APPID_2); - RtnCode = CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table1"); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS, "CFE_TBL_Share", "Unregister shared table (setup)"); + CFE_UtAssert_SUCCESS(CFE_TBL_Share(&App2TblHandle1, "ut_cfe_tbl.UT_Table1")); /* b. Perform test */ UT_ClearEventHistory(); - RtnCode = CFE_TBL_Unregister(App2TblHandle1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_Unregister", - "Unregister shared table"); + CFE_UtAssert_SUCCESS(CFE_TBL_Unregister(App2TblHandle1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test successful application cleanup */ UT_InitData(); @@ -3801,12 +3392,10 @@ void Test_CFE_TBL_Internal(void) RegRecPtr->LoadInProgress = 1; CFE_TBL_Global.LoadBuffs[1].Taken = true; CFE_TBL_CleanUpApp(UT_TBL_APPID_1); - UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.DumpControlBlocks[3].State == CFE_TBL_DUMP_FREE && - CFE_RESOURCEID_TEST_EQUAL(RegRecPtr->OwnerAppId, CFE_TBL_NOT_OWNED) && - CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].Taken == false && - RegRecPtr->LoadInProgress == CFE_TBL_NO_LOAD_IN_PROGRESS, - "CFE_TBL_CleanUpApp", "Execute clean up - success"); + UtAssert_INT32_EQ(CFE_TBL_Global.DumpControlBlocks[3].State, CFE_TBL_DUMP_FREE); + CFE_UtAssert_RESOURCEID_EQ(RegRecPtr->OwnerAppId, CFE_TBL_NOT_OWNED); + CFE_UtAssert_FALSE(CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].Taken); + UtAssert_INT32_EQ(RegRecPtr->LoadInProgress, CFE_TBL_NO_LOAD_IN_PROGRESS); /* Test response to an attempt to use an invalid table handle */ UT_InitData(); @@ -3820,30 +3409,25 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); UT_SetDeferredRetcode(UT_KEY(CFE_ES_CopyToCDS), 2, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_HANDLE_ACCESS_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_INVALID_HANDLE && EventsCorrect, "CFE_TBL_Load", - "Attempt to use an invalid handle"); + UtAssert_INT32_EQ(CFE_TBL_Load(App1TblHandle2, CFE_TBL_SRC_FILE, "TblSrcFileName.dat"), CFE_TBL_ERR_INVALID_HANDLE); + CFE_UtAssert_EVENTSENT(CFE_TBL_HANDLE_ACCESS_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); /* Test CFE_TBL_EarlyInit response where the CDS already exists and * restore succeeds */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RegisterCDSEx), 1, CFE_ES_CDS_ALREADY_EXISTS); - RtnCode = CFE_TBL_EarlyInit(); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_EarlyInit", - "CDS already exists and restore succeeds"); + CFE_UtAssert_SUCCESS(CFE_TBL_EarlyInit()); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_CheckAccessRights response when the application ID matches * the table task application ID */ UT_InitData(); CFE_TBL_Global.TableTaskAppId = UT_TBL_APPID_1; - RtnCode = CFE_TBL_CheckAccessRights(App2TblHandle1, UT_TBL_APPID_1); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_EarlyInit", - "Application ID matches table task application ID"); + CFE_UtAssert_SUCCESS(CFE_TBL_CheckAccessRights(App2TblHandle1, UT_TBL_APPID_1)); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_FindFreeRegistryEntry response when the registry entry is * not owned but is not at the end of the list @@ -3851,35 +3435,29 @@ void Test_CFE_TBL_Internal(void) UT_InitData(); CFE_TBL_Global.Registry[0].OwnerAppId = CFE_TBL_NOT_OWNED; CFE_TBL_Global.Registry[0].HeadOfAccessList = CFE_TBL_END_OF_LIST + 1; - RtnCode = CFE_TBL_FindFreeRegistryEntry(); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == 1 && EventsCorrect, "CFE_TBL_FindFreeRegistryEntry", - "Registry entry not owned but not at end of list"); + UtAssert_INT32_EQ(CFE_TBL_FindFreeRegistryEntry(), 1); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_LockRegistry response when an error occurs taking the mutex */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, OS_ERROR); - RtnCode = CFE_TBL_LockRegistry(); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == OS_ERROR && EventsCorrect, "CFE_TBL_LockRegistry", "Mutex take error"); + UtAssert_INT32_EQ(CFE_TBL_LockRegistry(), OS_ERROR); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_UnlockRegistry response when an error occurs giving the * mutex */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemGive), 1, OS_ERROR); - RtnCode = CFE_TBL_UnlockRegistry(); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == OS_ERROR && EventsCorrect, "CFE_TBL_UnlockRegistry", "Mutex give error"); + UtAssert_INT32_EQ(CFE_TBL_UnlockRegistry(), OS_ERROR); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_LoadFromFile response to an invalid header length */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ReadHeader), 1, sizeof(CFE_FS_Header_t) - 1); - RtnCode = CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename); - EventsCorrect = (UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_STD_HEADER && EventsCorrect, "CFE_TBL_LoadFromFile", - "No standard header"); + UtAssert_INT32_EQ(CFE_TBL_LoadFromFile("UT", WorkingBufferPtr, RegRecPtr, Filename), CFE_TBL_ERR_NO_STD_HEADER); + CFE_UtAssert_EVENTCOUNT(1); /* Test CFE_TBL_UpdateInternal response when an inactive buffer is ready to * be copied but a load is in progress @@ -3889,10 +3467,8 @@ void Test_CFE_TBL_Internal(void) RegRecPtr = &CFE_TBL_Global.Registry[AccessDescPtr->RegIndex]; RegRecPtr->LoadPending = true; RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - RtnCode = CFE_TBL_UpdateInternal(App1TblHandle2, RegRecPtr, AccessDescPtr); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_INFO_NO_UPDATE_PENDING && EventsCorrect, "CFE_TBL_UpdateInternal", - "Inactive buffer ready while load in progress"); + UtAssert_INT32_EQ(CFE_TBL_UpdateInternal(App1TblHandle2, RegRecPtr, AccessDescPtr), CFE_TBL_INFO_NO_UPDATE_PENDING); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_UpdateInternal response when an inactive buffer is ready to * be copied but a load is in progress @@ -3905,11 +3481,8 @@ void Test_CFE_TBL_Internal(void) RegRecPtr->CriticalTable = false; RegRecPtr->DoubleBuffered = true; UT_SetDeferredRetcode(UT_KEY(CFE_ES_CopyToCDS), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - RtnCode = CFE_TBL_UpdateInternal(App1TblHandle2, RegRecPtr, AccessDescPtr); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_UpdateInternal", - "Active buffer ready, no load in progress, double buffered " - "non-critical table"); + CFE_UtAssert_SUCCESS(CFE_TBL_UpdateInternal(App1TblHandle2, RegRecPtr, AccessDescPtr)); + CFE_UtAssert_EVENTCOUNT(0); /* Test CFE_TBL_UpdateInternal single buffer memcpy when * source and dest are not equal @@ -3920,10 +3493,8 @@ void Test_CFE_TBL_Internal(void) RegRecPtr->LoadPending = true; RegRecPtr->LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; RegRecPtr->DoubleBuffered = false; - RtnCode = CFE_TBL_UpdateInternal(App1TblHandle2, RegRecPtr, AccessDescPtr); - EventsCorrect = (UT_GetNumEventsSent() == 0); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_UpdateInternal", - "Update single buffer table memcpy test with src != dest"); + CFE_UtAssert_SUCCESS(CFE_TBL_UpdateInternal(App1TblHandle2, RegRecPtr, AccessDescPtr)); + CFE_UtAssert_EVENTCOUNT(0); /* Test application cleanup where there are no dumped tables to delete and * the application doesn't own the table @@ -3938,12 +3509,8 @@ void Test_CFE_TBL_Internal(void) CFE_TBL_Global.DumpControlBlocks[3].State = CFE_TBL_DUMP_PENDING; CFE_TBL_Global.DumpControlBlocks[3].RegRecPtr = RegRecPtr; CFE_TBL_CleanUpApp(UT_TBL_APPID_1); - UT_Report(__FILE__, __LINE__, - CFE_TBL_Global.DumpControlBlocks[3].State == CFE_TBL_DUMP_PENDING && - CFE_RESOURCEID_TEST_EQUAL(RegRecPtr->OwnerAppId, CFE_TBL_NOT_OWNED), - "CFE_TBL_CleanUpApp", - "Execute clean up - no dumped tables to delete, application " - "doesn't own table"); + UtAssert_INT32_EQ(CFE_TBL_Global.DumpControlBlocks[3].State, CFE_TBL_DUMP_PENDING); + CFE_UtAssert_RESOURCEID_EQ(RegRecPtr->OwnerAppId, CFE_TBL_NOT_OWNED); #if (CFE_PLATFORM_TBL_VALID_SCID_COUNT > 0) /* Test CFE_TBL_ReadHeaders response to an invalid spacecraft ID */ @@ -3967,12 +3534,12 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); strncpy(Filename, "MyTestInputFilename", sizeof(Filename) - 1); Filename[sizeof(Filename) - 1] = '\0'; - RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_SPACECRAFT_ID_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_BAD_SPACECRAFT_ID && EventsCorrect, "CFE_TBL_ReadHeaders", - "Invalid spacecraft ID"); + UtAssert_INT32_EQ(CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename), + CFE_TBL_ERR_BAD_SPACECRAFT_ID); + CFE_UtAssert_EVENTSENT(CFE_TBL_SPACECRAFT_ID_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); #else - UT_Report(__FILE__, __LINE__, true, "CFE_TBL_ReadHeaders", "*Not tested* Invalid spacecraft ID "); + UtAssert_NA("*Not tested* Invalid spacecraft ID "); #endif #if (CFE_PLATFORM_TBL_VALID_PRID_COUNT > 0) @@ -3997,12 +3564,12 @@ void Test_CFE_TBL_Internal(void) UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); strncpy(Filename, "MyTestInputFilename", sizeof(Filename) - 1); Filename[sizeof(Filename) - 1] = '\0'; - RtnCode = CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename); - EventsCorrect = (UT_EventIsInHistory(CFE_TBL_PROCESSOR_ID_ERR_EID) == true && UT_GetNumEventsSent() == 1); - UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_BAD_PROCESSOR_ID && EventsCorrect, "CFE_TBL_ReadHeaders", - "Invalid processor ID"); + UtAssert_INT32_EQ(CFE_TBL_ReadHeaders(FileDescriptor, &StdFileHeader, &TblFileHeader, Filename), + CFE_TBL_ERR_BAD_PROCESSOR_ID); + CFE_UtAssert_EVENTSENT(CFE_TBL_PROCESSOR_ID_ERR_EID); + CFE_UtAssert_EVENTCOUNT(1); #else - UT_Report(__FILE__, __LINE__, true, "CFE_TBL_ReadHeaders", "*Not tested* Invalid processor ID "); + UtAssert_NA("*Not tested* Invalid processor ID "); #endif } diff --git a/modules/time/ut-coverage/time_UT.c b/modules/time/ut-coverage/time_UT.c index 161851d7d..7623b7f1a 100644 --- a/modules/time/ut-coverage/time_UT.c +++ b/modules/time/ut-coverage/time_UT.c @@ -195,8 +195,7 @@ void Test_Main(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); CFE_TIME_TaskMain(); - UT_Report(__FILE__, __LINE__, UT_SyslogIsInHistory(TIME_SYSLOG_MSGS[1]), "CFE_TIME_TaskMain", - "Command pipe read error"); + CFE_UtAssert_SYSLOG(TIME_SYSLOG_MSGS[1]); } /* @@ -228,33 +227,32 @@ void Test_Init(void) /* account for 1Hz command, which is always enabled */ ExpRtn++; CFE_TIME_EarlyInit(); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_MSG_Init)) == ExpRtn, "CFE_TIME_EarlyInit", "Successful"); + UtAssert_STUB_COUNT(CFE_MSG_Init, ExpRtn); /* Test successful time task initialization */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == CFE_SUCCESS, "CFE_TIME_Task_Init", "Successful"); + CFE_UtAssert_SUCCESS(CFE_TIME_TaskInit()); /* Test response to a failure creating the first child task */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_CreateChildTask), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -1, "CFE_TIME_Task_Init", "Child task 1 create failure"); + UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -1); /* Test response to a failure creating the second child task */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_CreateChildTask), 2, -3); - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -3, "CFE_TIME_Task_Init", "Child task 2 create failure"); + UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -3); /* Test response to an error creating a command pipe */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -1, "CFE_TIME_Task_Init", "Create pipe failure"); + UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -1); /* Test response to failure of the HK request subscription */ UT_InitData(); SubErrCnt++; UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), SubErrCnt, -SubErrCnt); - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -SubErrCnt, "CFE_TIME_Task_Init", - "HK request subscription failure"); + UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -SubErrCnt); /* Test response to failure of the tone commands subscription */ UT_InitData(); @@ -272,8 +270,7 @@ void Test_Init(void) ExpRtn = -SubLocalErrCnt; #endif - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == ExpRtn, "CFE_TIME_Task_Init", - "Tone commands subscription failure (client)"); + UtAssert_INT32_EQ(CFE_TIME_TaskInit(), ExpRtn); /* Test response to failure of the time at the tone "data" commands * subscription @@ -293,8 +290,7 @@ void Test_Init(void) ExpRtn = -SubLocalErrCnt; #endif - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == ExpRtn, "CFE_TIME_Task_Init", - "Time data command subscription failure"); + UtAssert_INT32_EQ(CFE_TIME_TaskInit(), ExpRtn); /* Test response to failure of the fake tone signal commands * subscription @@ -315,11 +311,9 @@ void Test_Init(void) ExpRtn = -SubLocalErrCnt; #endif - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == ExpRtn, "CFE_TIME_Task_Init", - "Fake tone signal commands subscription failure"); + UtAssert_INT32_EQ(CFE_TIME_TaskInit(), ExpRtn); #else - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_Task_Init", - "*Not tested* Fake tone signal commands subscription failure"); + UtAssert_NA("*Not tested* Fake tone signal commands subscription failure"); #endif /* Test response to failure of the time at tone signal commands @@ -331,12 +325,10 @@ void Test_Init(void) SubErrCnt++; UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), SubErrCnt, -SubErrCnt); ExpRtn = -SubErrCnt; - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == ExpRtn, "CFE_TIME_Task_Init", - "Time at tone signal commands subscription failure"); + UtAssert_INT32_EQ(CFE_TIME_TaskInit(), ExpRtn); #else SubErrCnt++; - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_Task_Init", - "*Not tested* Time at tone signal commands subscription failure"); + UtAssert_NA("*Not tested* Time at tone signal commands subscription failure"); #endif /* Test response to failure of the time task ground commands @@ -346,35 +338,33 @@ void Test_Init(void) SubErrCnt++; UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), SubErrCnt, -SubErrCnt); ExpRtn = -SubErrCnt; - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == ExpRtn, "CFE_TIME_Task_Init", - "Time task ground commands subscription failure"); + UtAssert_INT32_EQ(CFE_TIME_TaskInit(), ExpRtn); /* Test response to failure creating a tone semaphore */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_BinSemCreate), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -1, "CFE_TIME_Task_Init", "Tone semaphore create failure"); + UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -1); /* Test response to failure creating a local semaphore */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_BinSemCreate), 2, -2); - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -2, "CFE_TIME_Task_Init", "Local semaphore create failure"); + UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -2); /* Test response to an EVS register failure */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -1, "CFE_TIME_Task_Init", "EVS register failure"); + UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -1); /* Test response to an error sending an initialization event */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_TIME_TaskInit() == -1, "CFE_TIME_Task_Init", "Send initialization event error"); + UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -1); /* Test response to a failure to get the ID by name */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_TimeBaseGetIdByName), OS_ERROR); CFE_TIME_TaskInit(); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 0, "CFE_TIME_Task_Init", - "Get ID by name failure"); + UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 0); /* Test response to an error setting up the 1Hz callback. * Note that this is only a SysLog message, it does not return the @@ -383,16 +373,14 @@ void Test_Init(void) UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_TimerAdd), OS_ERROR); CFE_TIME_TaskInit(); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1 && UT_SyslogIsInHistory(TIME_SYSLOG_MSGS[3]), - "CFE_TIME_Task_Init", "1Hz OS_TimerAdd failure"); + UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1); + CFE_UtAssert_SYSLOG(TIME_SYSLOG_MSGS[3]); UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_TimerSet), OS_ERROR); CFE_TIME_TaskInit(); - UT_Report(__FILE__, __LINE__, - UT_GetStubCount(UT_KEY(CFE_ES_WriteToSysLog)) == 1 && UT_SyslogIsInHistory((TIME_SYSLOG_MSGS[4])), - "CFE_TIME_Task_Init", "1Hz OS_TimerSet failure"); + UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1); + CFE_UtAssert_SYSLOG((TIME_SYSLOG_MSGS[4])); } /* @@ -401,14 +389,12 @@ void Test_Init(void) void Test_GetTime(void) { int result; - uint16 StateFlags, ActFlags; - char testDesc[UT_MAX_MESSAGE_LENGTH]; + uint16 StateFlags; char timeBuf[sizeof("yyyy-ddd-hh:mm:ss.xxxxx_")]; /* Note: Time is in seconds + microseconds since 1980-001-00:00:00:00000 */ /* The time below equals 2013-001-02:03:04.56789 */ - int seconds = 1041472984; - int microsecs = 567890; - int actual; + int seconds = 1041472984; + int microsecs = 567890; const char * expectedMET = "2013-001-02:03:14.56789"; const char * expectedTAI = "2013-001-03:03:14.56789"; const char * expectedUTC = "2013-001-03:02:42.56789"; @@ -435,51 +421,39 @@ void Test_GetTime(void) RefState->ClockSetState = CFE_TIME_SetState_NOT_SET; /* Force invalid time */ CFE_TIME_FinishReferenceUpdate(RefState); CFE_TIME_Print(timeBuf, CFE_TIME_GetMET()); - result = !strcmp(timeBuf, expectedMET); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %s, actual = %s", expectedMET, timeBuf); - UT_Report(__FILE__, __LINE__, result, "CFE_TIME_GetMET", testDesc); + CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedMET, strlen(expectedMET)); /* Test successfully retrieving the mission elapsed time (seconds * portion) */ UT_InitData(); UT_SetBSP_Time(seconds, microsecs); - actual = CFE_TIME_GetMETseconds(); result = seconds + RefState->AtToneMET.Seconds - RefState->AtToneLatch.Seconds; - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %d, actual = %d", result, actual); - UT_Report(__FILE__, __LINE__, result == actual, "CFE_TIME_GetMETseconds", testDesc); + UtAssert_INT32_EQ(CFE_TIME_GetMETseconds(), result); /* Test successfully retrieving the mission elapsed time (sub-seconds * portion) */ UT_InitData(); UT_SetBSP_Time(seconds, microsecs); - actual = CFE_TIME_GetMETsubsecs(); result = CFE_TIME_Micro2SubSecs(microsecs) + RefState->AtToneMET.Subseconds - RefState->AtToneLatch.Subseconds; - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %d, actual = %d", result, actual); - UT_Report(__FILE__, __LINE__, result == actual, "CFE_TIME_GetMETsubsecs", testDesc); + UtAssert_INT32_EQ(CFE_TIME_GetMETsubsecs(), result); /* Test successfully retrieving the leap seconds */ UT_InitData(); - actual = CFE_TIME_GetLeapSeconds(); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %d, actual = %d", RefState->AtToneLeapSeconds, actual); - UT_Report(__FILE__, __LINE__, actual == RefState->AtToneLeapSeconds, "CFE_TIME_GetLeapSeconds", testDesc); + UtAssert_INT32_EQ(CFE_TIME_GetLeapSeconds(), RefState->AtToneLeapSeconds); /* Test successfully retrieving the international atomic time (TAI) */ UT_InitData(); UT_SetBSP_Time(seconds, microsecs); CFE_TIME_Print(timeBuf, CFE_TIME_GetTAI()); - result = !strcmp(timeBuf, expectedTAI); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %s, actual = %s", expectedTAI, timeBuf); - UT_Report(__FILE__, __LINE__, result, "CFE_TIME_GetTAI", testDesc); + CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedTAI, strlen(expectedTAI)); /* Test successfully retrieving the coordinated universal time (UTC) */ UT_InitData(); UT_SetBSP_Time(seconds, microsecs); CFE_TIME_Print(timeBuf, CFE_TIME_GetUTC()); - result = !strcmp(timeBuf, expectedUTC); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %s, actual = %s", expectedUTC, timeBuf); - UT_Report(__FILE__, __LINE__, result, "CFE_TIME_GetUTC", testDesc); + CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedUTC, strlen(expectedUTC)); /* Test successfully retrieving the default time (UTC or TAI) */ UT_InitData(); @@ -487,13 +461,10 @@ void Test_GetTime(void) CFE_TIME_Print(timeBuf, CFE_TIME_GetTime()); #if (CFE_MISSION_TIME_CFG_DEFAULT_TAI == true) - result = !strcmp(timeBuf, expectedTAI); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "(Default = TAI) Expected = %s, actual = %s", expectedTAI, timeBuf); + CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedTAI, strlen(expectedTAI)); #else - result = !strcmp(timeBuf, expectedUTC); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "(Default = UTC) Expected = %s, actual = %s", expectedUTC, timeBuf); + CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedUTC, strlen(expectedUTC)); #endif - UT_Report(__FILE__, __LINE__, result, "CFE_TIME_GetTime", testDesc); /* Test successfully retrieving the spacecraft time correlation * factor (SCTF) @@ -501,14 +472,11 @@ void Test_GetTime(void) UT_InitData(); UT_SetBSP_Time(seconds, microsecs); CFE_TIME_Print(timeBuf, CFE_TIME_GetSTCF()); - result = !strcmp(timeBuf, expectedSTCF); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %s, actual = %s", expectedSTCF, timeBuf); - UT_Report(__FILE__, __LINE__, result, "CFE_TIME_GetSTCF", testDesc); + CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedSTCF, strlen(expectedSTCF)); /* Test retrieving the time status (invalid time is expected) */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_GetClockState() == CFE_TIME_ClockState_INVALID, "CFE_TIME_GetClockState", - "Invalid time"); + UtAssert_INT32_EQ(CFE_TIME_GetClockState(), CFE_TIME_ClockState_INVALID); /* Test alternate flag values */ RefState = CFE_TIME_StartReferenceUpdate(); @@ -524,15 +492,13 @@ void Test_GetTime(void) CFE_TIME_Global.IsToneGood = false; CFE_TIME_Global.GetReferenceFail = false; CFE_TIME_FinishReferenceUpdate(RefState); - ActFlags = CFE_TIME_GetClockInfo(); StateFlags = 0; #if (CFE_PLATFORM_TIME_CFG_SERVER == true) StateFlags |= CFE_TIME_FLAG_SERVER; #endif - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = 0x%04X, actual = 0x%04X", StateFlags, ActFlags); - UT_Report(__FILE__, __LINE__, ActFlags == StateFlags, "CFE_TIME_GetClockInfo", testDesc); + UtAssert_UINT32_EQ(CFE_TIME_GetClockInfo(), StateFlags); /* Test successfully converting the clock state data to flag values */ UT_InitData(); @@ -558,9 +524,7 @@ void Test_GetTime(void) StateFlags |= CFE_TIME_FLAG_SERVER; #endif - ActFlags = CFE_TIME_GetClockInfo(); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = 0x%04X, actual = 0x%04X", StateFlags, ActFlags); - UT_Report(__FILE__, __LINE__, ActFlags == StateFlags, "CFE_TIME_GetClockInfo", testDesc); + UtAssert_UINT32_EQ(CFE_TIME_GetClockInfo(), StateFlags); CFE_TIME_Global.GetReferenceFail = false; } @@ -583,21 +547,17 @@ void Test_TimeOp(void) exp_result.Seconds = 0; /* Test adding with both times equal zero */ - UT_InitData(); result = CFE_TIME_Add(time1, time2); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", - "Time A = time B = 0 seconds/subseconds"); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), + "CFE_TIME_Add, Time A = time B = 0 seconds/subseconds"); /* Test subtracting with both times equal zero */ - UT_InitData(); result = CFE_TIME_Subtract(time1, time2); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", - "Time A = time B = 0 seconds/subseconds"); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), + "CFE_TIME_Subtract, Time A = time B = 0 seconds/subseconds"); /* Test comparing with both times equal zero */ - UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time1, time2) == CFE_TIME_EQUAL, "CFE_TIME_Compare", - "Time A = time B = 0 seconds/subseconds"); + UtAssert_INT32_EQ(CFE_TIME_Compare(time1, time2), CFE_TIME_EQUAL); /* Initialize to maximum time values */ time1.Subseconds = 0xffffffff; @@ -606,25 +566,23 @@ void Test_TimeOp(void) time2.Seconds = 0xffffffff; /* Test adding two maximum time values (extreme time rollover case) */ - UT_InitData(); exp_result.Subseconds = 0xfffffffe; exp_result.Seconds = 0xffffffff; - result = CFE_TIME_Add(time1, time2); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", - "Time A = time B = maximum seconds/subseconds (rollover)"); + + result = CFE_TIME_Add(time1, time2); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), + "CFE_TIME_Add, Time A = time B = maximum seconds/subseconds (rollover)"); /* Test subtracting two maximum time values (zero result) */ - UT_InitData(); exp_result.Subseconds = 0; exp_result.Seconds = 0; - result = CFE_TIME_Subtract(time1, time2); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", - "Time A = time B = maximum seconds/subseconds (zero result)"); + + result = CFE_TIME_Subtract(time1, time2); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), + "CFE_TIME_Subtract, Time A = time B = maximum seconds/subseconds (zero result)"); /* Test comparing two maximum time values */ - UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time1, time2) == CFE_TIME_EQUAL, "CFE_TIME_Compare", - "Time A = time B = maximum seconds/subseconds"); + UtAssert_INT32_EQ(CFE_TIME_Compare(time1, time2), CFE_TIME_EQUAL); /* Initialize to single time value at maximum subseconds */ time1.Subseconds = 0xffffffff; @@ -635,50 +593,42 @@ void Test_TimeOp(void) /* Test adding two time values; time A > time B (minimal time * rollover case) */ - UT_InitData(); exp_result.Subseconds = 0; exp_result.Seconds = 0; - result = CFE_TIME_Add(time1, time2); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", - "Time A > time B (rollover)"); + + result = CFE_TIME_Add(time1, time2); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), "CFE_TIME_Add, Time A > time B (rollover)"); /* Test subtracting two time values; time A > time B */ - UT_InitData(); exp_result.Subseconds = 0xfffffffe; exp_result.Seconds = 0xfffe0001; - result = CFE_TIME_Subtract(time1, time2); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", - "Time A > time B"); + + result = CFE_TIME_Subtract(time1, time2); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), "CFE_TIME_Subtract, Time A > time B"); /* Test comparing two time values; time A > time B (assumes time has * rolled over) */ - UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time1, time2) == CFE_TIME_A_LT_B, "CFE_TIME_Compare", - "Time A > time B"); + UtAssert_INT32_EQ(CFE_TIME_Compare(time1, time2), CFE_TIME_A_LT_B); /* Test adding two time values; time A < time B */ - UT_InitData(); exp_result.Subseconds = 0; exp_result.Seconds = 0; - result = CFE_TIME_Add(time2, time1); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", - "Time A < time B"); + + result = CFE_TIME_Add(time2, time1); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), "CFE_TIME_Add, Time A < time B"); /* Test subtracting two time values; time A < time B (rollover) */ - UT_InitData(); exp_result.Subseconds = 0x00000002; exp_result.Seconds = 0x0001fffe; - result = CFE_TIME_Subtract(time2, time1); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", - "Time A < time B (rollover)"); + + result = CFE_TIME_Subtract(time2, time1); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), "CFE_TIME_Subtract, Time A < time B (rollover)"); /* Test comparing two time values; time A < time B (assumes time has * rolled over) */ - UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time2, time1) == CFE_TIME_A_GT_B, "CFE_TIME_Compare", - "Time A < time B"); + UtAssert_INT32_EQ(CFE_TIME_Compare(time2, time1), CFE_TIME_A_GT_B); /* Initialize so that only subseconds are different; seconds are * the same @@ -690,56 +640,52 @@ void Test_TimeOp(void) /* Test adding two time values; time A subseconds > time B subseconds * (seconds same) */ - UT_InitData(); exp_result.Subseconds = 59; exp_result.Seconds = 6; - result = CFE_TIME_Add(time1, time2); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", - "Time A subseconds > time B subseconds (seconds same)"); + + result = CFE_TIME_Add(time1, time2); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), + "CFE_TIME_Add, Time A subseconds > time B subseconds (seconds same)"); /* Test subtracting two time values; time A subseconds > time B * subseconds (seconds same) */ - UT_InitData(); exp_result.Subseconds = 1; exp_result.Seconds = 0; - result = CFE_TIME_Subtract(time1, time2); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", - "Time A subseconds > time B subseconds (seconds same)"); + + result = CFE_TIME_Subtract(time1, time2); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), + "CFE_TIME_Subtract, Time A subseconds > time B subseconds (seconds same)"); /* Test comparing two time values; time A subseconds > time B subseconds * (seconds same) */ - UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time1, time2) == CFE_TIME_A_GT_B, "CFE_TIME_Compare", - "Time A subseconds > time B subseconds (seconds same)"); + UtAssert_INT32_EQ(CFE_TIME_Compare(time1, time2), CFE_TIME_A_GT_B); /* Test adding two time values; time A subseconds < time B subseconds * (seconds same) */ - UT_InitData(); exp_result.Subseconds = 59; exp_result.Seconds = 6; - result = CFE_TIME_Add(time2, time1); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", - "Time A subseconds < time B subseconds (seconds same)"); + + result = CFE_TIME_Add(time2, time1); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), + "CFE_TIME_Add, Time A subseconds < time B subseconds (seconds same)"); /* Test subtracting two time values; time A subseconds < time B * subseconds (seconds same) */ - UT_InitData(); exp_result.Subseconds = 0xffffffff; exp_result.Seconds = 0xffffffff; - result = CFE_TIME_Subtract(time2, time1); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", - "Time A subseconds < time B subseconds (seconds same)"); + + result = CFE_TIME_Subtract(time2, time1); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), + "CFE_TIME_Subtract, Time A subseconds < time B subseconds (seconds same)"); /* Test comparing two time values; time A subseconds < time B subseconds * (seconds same) */ - UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time2, time1) == CFE_TIME_A_LT_B, "CFE_TIME_Compare", - "Time A subseconds < time B subseconds (seconds same)"); + UtAssert_INT32_EQ(CFE_TIME_Compare(time2, time1), CFE_TIME_A_LT_B); /* Initialize so that only seconds are different; subseconds are * the same @@ -752,56 +698,53 @@ void Test_TimeOp(void) /* Test adding two time values; time A seconds > time B seconds * (subseconds same) */ - UT_InitData(); exp_result.Subseconds = 36; exp_result.Seconds = 15; - result = CFE_TIME_Add(time1, time2); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", - "Time A seconds > time B seconds (subseconds same)"); + + result = CFE_TIME_Add(time1, time2); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), + "CFE_TIME_Add, Time A seconds > time B seconds (subseconds same)"); /* Test subtracting two time values; time A seconds > time B seconds * (subseconds same) */ - UT_InitData(); exp_result.Subseconds = 0; exp_result.Seconds = 1; - result = CFE_TIME_Subtract(time1, time2); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", - "Time A seconds > time B seconds (subseconds same)"); + + result = CFE_TIME_Subtract(time1, time2); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), + "CFE_TIME_Subtract, Time A seconds > time B seconds (subseconds same)"); /* Test comparing two time values; time A seconds > time B seconds * (subseconds same) */ - UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time1, time2) == CFE_TIME_A_GT_B, "CFE_TIME_Compare", - "Time A seconds > time B seconds (subseconds same)"); + UtAssert_INT32_EQ(CFE_TIME_Compare(time1, time2), CFE_TIME_A_GT_B); /* Test adding two time values; time A seconds < time B seconds * (subseconds same) */ - UT_InitData(); exp_result.Subseconds = 36; exp_result.Seconds = 15; - result = CFE_TIME_Add(time2, time1); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Add", - "Time A seconds < time B seconds (subseconds same)"); + + result = CFE_TIME_Add(time2, time1); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), + "CFE_TIME_Add, Time A seconds < time B seconds (subseconds same)"); /* Test subtracting two time values; time A seconds < time B seconds * (subseconds same) */ - UT_InitData(); exp_result.Subseconds = 0; exp_result.Seconds = 0xffffffff; - result = CFE_TIME_Subtract(time2, time1); - UT_Report(__FILE__, __LINE__, memcmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t)) == 0, "CFE_TIME_Subtract", - "Time A seconds < time B seconds (subseconds same)"); + + result = CFE_TIME_Subtract(time2, time1); + UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), + "CFE_TIME_Subtract, Time A seconds < time B seconds (subseconds same)"); /* Test comparing two time values; time A seconds < time B seconds * (subseconds same) */ UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Compare(time2, time1) == CFE_TIME_A_LT_B, "CFE_TIME_Compare", - "Time A seconds < time B seconds (subseconds same)"); + UtAssert_INT32_EQ(CFE_TIME_Compare(time2, time1), CFE_TIME_A_LT_B); } /* @@ -809,8 +752,6 @@ void Test_TimeOp(void) */ void Test_ConvertTime(void) { - int result; - char testDesc[UT_MAX_MESSAGE_LENGTH]; char timeBuf[sizeof("yyyy-ddd-hh:mm:ss.xxxxx_")]; CFE_TIME_SysTime_t METTime; volatile CFE_TIME_ReferenceState_t *RefState; @@ -824,9 +765,9 @@ void Test_ConvertTime(void) #endif UtPrintf("Begin Test Convert Time"); + UT_InitData(); /* Test MET to SCTF conversion */ - UT_InitData(); METTime.Seconds = 0; METTime.Subseconds = 0; RefState = CFE_TIME_StartReferenceUpdate(); @@ -837,9 +778,7 @@ void Test_ConvertTime(void) CFE_TIME_Print(timeBuf, CFE_TIME_MET2SCTime(METTime)); /* SC = MET + SCTF [- Leaps for UTC] */ - result = !strcmp(timeBuf, expectedSCTime); - snprintf(testDesc, UT_MAX_MESSAGE_LENGTH, "Expected = %s, actual = %s", expectedSCTime, timeBuf); - UT_Report(__FILE__, __LINE__, result, "CFE_TIME_MET2SCTime", testDesc); + CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedSCTime, strlen(expectedSCTime)); /* NOTE: Microseconds <-> Subseconds conversion routines are implemented * as part of OS_time_t in OSAL, and are coverage tested there. CFE time @@ -850,33 +789,23 @@ void Test_ConvertTime(void) * OSAL coverage test. */ /* Test subseconds to microseconds conversion; zero subsecond value */ - UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Sub2MicroSecs(0) == 0, "CFE_TIME_Sub2MicroSecs", - "Convert 0 subsecond value"); + UtAssert_UINT32_EQ(CFE_TIME_Sub2MicroSecs(0), 0); /* Test subseconds to microseconds conversion; half second */ - UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Sub2MicroSecs(0x80000000) == 500000, "CFE_TIME_Sub2MicroSecs", - "No microsecond adjustment"); + UtAssert_UINT32_EQ(CFE_TIME_Sub2MicroSecs(0x80000000), 500000); /* Test subseconds to microseconds conversion; subseconds exceeds * microseconds limit */ - UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Sub2MicroSecs(0xffffffff) == 999999, "CFE_TIME_Sub2MicroSecs", - "Subseconds exceeds maximum microseconds value (limit ms)"); + UtAssert_UINT32_EQ(CFE_TIME_Sub2MicroSecs(0xffffffff), 999999); /* Test microseconds to subseconds conversion; zero microsecond value */ - UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Micro2SubSecs(0) == 0, "CFE_TIME_Micro2SubSecs", - "Convert 0 microseconds to 0 subseconds"); + UtAssert_UINT32_EQ(CFE_TIME_Micro2SubSecs(0), 0); /* Test microseconds to subseconds conversion; microseconds exceeds * maximum limit */ - UT_InitData(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Micro2SubSecs(0xffffffff) == 0xffffffff, "CFE_TIME_Micro2SubSecs", - "Microseconds exceeds maximum; set maximum subseconds value"); + UtAssert_UINT32_EQ(CFE_TIME_Micro2SubSecs(0xffffffff), 0xffffffff); } /* @@ -888,50 +817,45 @@ void Test_ConvertTime(void) */ void Test_Print(void) { - int result; - char testDesc[1 + UT_MAX_MESSAGE_LENGTH]; + char timeBuf[CFE_TIME_PRINTED_STRING_SIZE]; + char expectedBuf[CFE_TIME_PRINTED_STRING_SIZE]; CFE_TIME_SysTime_t time; UtPrintf("Begin Test Print"); /* Test with zero time value */ - UT_InitData(); time.Subseconds = 0; time.Seconds = 0; - CFE_TIME_Print(testDesc, time); - result = !strcmp(testDesc, "1980-001-00:00:00.00000"); - strncat(testDesc, " Zero time value", UT_MAX_MESSAGE_LENGTH - strlen(testDesc)); - UT_Report(__FILE__, __LINE__, result, "CFE_TIME_Print", testDesc); + + CFE_TIME_Print(timeBuf, time); + strcpy(expectedBuf, "1980-001-00:00:00.00000"); + CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf)); /* Test with a time value that causes seconds >= 60 when * CFE_MISSION_TIME_EPOCH_SECOND > 0 */ - UT_InitData(); time.Subseconds = 0; time.Seconds = 59; - CFE_TIME_Print(testDesc, time); - result = !strcmp(testDesc, "1980-001-00:00:59.00000"); - strncat(testDesc, " Seconds overflow if CFE_MISSION_TIME_EPOCH_SECOND > 0", - UT_MAX_MESSAGE_LENGTH - strlen(testDesc)); - UT_Report(__FILE__, __LINE__, result, "CFE_TIME_Print", testDesc); + + CFE_TIME_Print(timeBuf, time); + strcpy(expectedBuf, "1980-001-00:00:59.00000"); + CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf)); /* Test with mission representative time values */ - UT_InitData(); time.Subseconds = 215000; time.Seconds = 1041472984; - CFE_TIME_Print(testDesc, time); - result = !strcmp(testDesc, "2013-001-02:03:04.00005"); - strncat(testDesc, " Mission representative time", UT_MAX_MESSAGE_LENGTH - strlen(testDesc)); - UT_Report(__FILE__, __LINE__, result, "CFE_TIME_Print", testDesc); + + CFE_TIME_Print(timeBuf, time); + strcpy(expectedBuf, "2013-001-02:03:04.00005"); + CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf)); /* Test with maximum seconds and subseconds values */ - UT_InitData(); time.Subseconds = 0xffffffff; time.Seconds = 0xffffffff; - CFE_TIME_Print(testDesc, time); - result = !strcmp(testDesc, "2116-038-06:28:15.99999"); - strncat(testDesc, " Maximum seconds/subseconds values", UT_MAX_MESSAGE_LENGTH - strlen(testDesc)); - UT_Report(__FILE__, __LINE__, result, "CFE_TIME_Print", testDesc); + + CFE_TIME_Print(timeBuf, time); + strcpy(expectedBuf, "2116-038-06:28:15.99999"); + CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf)); } /* @@ -948,10 +872,10 @@ int32 ut_time_MyCallbackFunc(void) */ void Test_RegisterSyncCallbackTrue(void) { - int32 Result; uint32 AppIndex; UtPrintf("Begin Test Register Synch Callback"); + UT_InitData(); /* * One callback per application is allowed; the first should succeed, @@ -962,8 +886,7 @@ void Test_RegisterSyncCallbackTrue(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, -1); CFE_TIME_Global.SynchCallback[0].Ptr = NULL; - Result = CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, Result == -1, "CFE_TIME_RegisterSynchCallback", "Bad App ID"); + UtAssert_INT32_EQ(CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc), -1); /* Test registering the callback function the maximum number of times, * then attempt registering one more time @@ -974,20 +897,14 @@ void Test_RegisterSyncCallbackTrue(void) * One callback per application is allowed; the first should succeed, * the second should fail. */ - Result = CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, Result == CFE_SUCCESS, "CFE_TIME_RegisterSynchCallback", - "Successfully registered callbacks"); + CFE_UtAssert_SUCCESS(CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc)); - Result = CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, Result == CFE_TIME_TOO_MANY_SYNCH_CALLBACKS, "CFE_TIME_RegisterSynchCallback", - "Too Many registered callbacks"); + UtAssert_INT32_EQ(CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc), CFE_TIME_TOO_MANY_SYNCH_CALLBACKS); AppIndex = 2; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); - Result = CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, Result == CFE_SUCCESS, "CFE_TIME_RegisterSynchCallback", - "Successfully registered callbacks"); + CFE_UtAssert_SUCCESS(CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc)); /* * This test case should not be possible in real flight as ES should never @@ -996,9 +913,7 @@ void Test_RegisterSyncCallbackTrue(void) */ AppIndex = 99999; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); - Result = CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, Result == CFE_TIME_TOO_MANY_SYNCH_CALLBACKS, "CFE_TIME_RegisterSynchCallback", - "App ID out of range"); + UtAssert_INT32_EQ(CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc), CFE_TIME_TOO_MANY_SYNCH_CALLBACKS); } /* @@ -1007,15 +922,16 @@ void Test_RegisterSyncCallbackTrue(void) void Test_ExternalTone(void) { UtPrintf("Begin Test External Tone"); - UT_InitData(); + UT_SetBSP_Time(123, 0); CFE_TIME_Global.ToneSignalLatch.Seconds = 0; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; + CFE_TIME_ExternalTone(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneSignalLatch.Seconds == 123 && CFE_TIME_Global.ToneSignalLatch.Subseconds == 0, - "CFE_TIME_ExternalTone", "External tone"); + + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneSignalLatch.Seconds, 123); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneSignalLatch.Subseconds, 0); } /* @@ -1042,8 +958,7 @@ void Test_External(void) settime.Seconds = 0; settime.Subseconds = 0; CFE_TIME_ExternalMET(settime); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ExternalCount == 1, "CFE_TIME_ExternalMET", - "External MET - external source and clock state not set"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ExternalCount, 1); /* Test setting time data from MET using an external source with the clock * state set and time less than the minimum @@ -1066,8 +981,7 @@ void Test_External(void) CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalMET(settime); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalMET", - "External MET - external source and time out of range (low)"); + UtAssert_UINT32_EQ(CFE_TIME_Global.InternalCount, 1); /* Test setting time data from MET using an external source with the clock * state set and time greater than the maximum @@ -1090,8 +1004,7 @@ void Test_External(void) CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalMET(settime); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalMET", - "External MET - external source and time out of range (high)"); + UtAssert_UINT32_EQ(CFE_TIME_Global.InternalCount, 1); /* Test setting time data from MET (external source, state set) */ UT_InitData(); @@ -1112,33 +1025,20 @@ void Test_External(void) CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalMET(settime); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ExternalCount == 1, "CFE_TIME_ExternalMET", - "External MET - external source and time in range"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ExternalCount, 1); /* Test setting time data from MET (internal source) */ UT_InitData(); CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; CFE_TIME_Global.InternalCount = 0; CFE_TIME_ExternalMET(settime); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalMET", - "External MET (internal source)"); + UtAssert_UINT32_EQ(CFE_TIME_Global.InternalCount, 1); #else - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalMET", - "*Not tested* External MET - external source and clock state " - "not set"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalMET", - "*Not tested* External MET - external source and time out of " - "range (low)"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalMET", - "*Not tested* External MET - external source and time out of " - "range (high)"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalMET", - "*Not tested* External MET - external source and time in range"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalMET", "*Not tested* External MET (internal source)"); + UtAssert_NA("*Not tested* External MET - external source and clock state not set"); + UtAssert_NA("*Not tested* External MET - external source and time out of range (low)"); + UtAssert_NA("*Not tested* External MET - external source and time out of range (high)"); + UtAssert_NA("*Not tested* External MET - external source and time in range"); + UtAssert_NA("*Not tested* External MET (internal source)"); #endif #if (CFE_PLATFORM_TIME_CFG_SRC_GPS == true) @@ -1152,8 +1052,7 @@ void Test_External(void) settime.Seconds = 0; settime.Subseconds = 0; CFE_TIME_ExternalGPS(settime, 0); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ExternalCount == 1, "CFE_TIME_ExternalGPS", - "External GPS - external source and clock state not set"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ExternalCount, 1); /* Test setting time data from GPS using an external source with the clock * state set and time less than the minimum @@ -1178,8 +1077,7 @@ void Test_External(void) CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalGPS(settime, 0); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalGPS", - "External GPS - external source and time out of range (low)"); + UtAssert_UINT32_EQ(CFE_TIME_Global.InternalCount, 1); /* Test setting time data from GPS using an external source with the clock * state set and time greater than the maximum @@ -1204,8 +1102,7 @@ void Test_External(void) CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalGPS(settime, 0); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalGPS", - "External GPS - external source and time out of range (high)"); + UtAssert_UINT32_EQ(CFE_TIME_Global.InternalCount, 1); /* Test setting time data from GPS (external source, state set) */ UT_InitData(); @@ -1228,33 +1125,20 @@ void Test_External(void) CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalGPS(settime, 0); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ExternalCount == 1, "CFE_TIME_ExternalGPS", - "External GPS - external source and time in range"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ExternalCount, 1); /* Test setting time data from GPS (internal source) */ UT_InitData(); CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; CFE_TIME_Global.InternalCount = 0; CFE_TIME_ExternalGPS(settime, 0); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalGPS", - "External GPS (internal source)"); + UtAssert_UINT32_EQ(CFE_TIME_Global.InternalCount, 1); #else - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalGPS", - "*Not tested* External GPS - external source and clock state " - "not set"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalGPS", - "Not tested* External GPS - external source and time out of " - "range (low)"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalGPS", - "*Not tested* External GPS - external source and time out of " - "range (high)"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalGPS", - "*Not tested* External GPS - external source and time in range"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalGPS", "*Not tested* External GPS (internal source)"); + UtAssert_NA("*Not tested* External GPS - external source and clock state not set"); + UtAssert_NA("*Not tested* External GPS - external source and time out of range (low)"); + UtAssert_NA("*Not tested* External GPS - external source and time out of range (high)"); + UtAssert_NA("*Not tested* External GPS - external source and time in range"); + UtAssert_NA("*Not tested* External GPS (internal source)"); #endif #if (CFE_PLATFORM_TIME_CFG_SRC_TIME == true) @@ -1268,8 +1152,7 @@ void Test_External(void) settime.Seconds = 0; settime.Subseconds = 0; CFE_TIME_ExternalTime(settime); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ExternalCount == 1, "CFE_TIME_ExternalTime", - "External Time - external source and clock state not set"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ExternalCount, 1); /* Test setting time data from Time using an external source with the clock * state set and time less than the minimum @@ -1294,8 +1177,7 @@ void Test_External(void) CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalTime(settime); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalTime", - "External Time - external source and time out of range (low)"); + UtAssert_INT32_EQ(CFE_TIME_Global.InternalCount, 1); /* Test setting time data from Time using an external source with the clock * state set and time greater than the maximum @@ -1320,8 +1202,7 @@ void Test_External(void) CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalTime(settime); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalTime", - "External Time - external source and time out of range (high)"); + UtAssert_UINT32_EQ(CFE_TIME_Global.InternalCount, 1); /* Test setting time data from Time (external source, state set) */ UT_InitData(); @@ -1344,33 +1225,20 @@ void Test_External(void) CFE_TIME_Global.MaxLocalClock.Subseconds = 0; UT_SetBSP_Time(0, 0); CFE_TIME_ExternalTime(settime); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ExternalCount == 1, "CFE_TIME_ExternalTime", - "External Time - external source and time in range"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ExternalCount, 1); /* Test setting time data from Time (internal source) */ UT_InitData(); CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; CFE_TIME_Global.InternalCount = 0; CFE_TIME_ExternalTime(settime); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.InternalCount == 1, "CFE_TIME_ExternalTime", - "External Time (internal source)"); + UtAssert_UINT32_EQ(CFE_TIME_Global.InternalCount, 1); #else - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalTime", - "*Not tested* External Time - external source and clock state " - "not set"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalTime", - "Not tested* External Time - external source and time out of " - "range (low)"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalTime", - "*Not tested* External Time - external source and time out of " - "range (high)"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalTime", - "*Not tested* External Time - external source and time in range"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ExternalTime", "*Not tested* External Time (internal source)"); + UtAssert_NA("*Not tested* External Time - external source and clock state not set"); + UtAssert_NA("*Not tested* External Time - external source and time out of range (low)"); + UtAssert_NA("*Not tested* External Time - external source and time out of range (high)"); + UtAssert_NA("*Not tested* External Time - external source and time in range"); + UtAssert_NA("*Not tested* External Time (internal source)"); #endif /* Reset to normal value for subsequent tests */ @@ -1419,23 +1287,21 @@ void Test_PipeCmds(void) UT_InitData(); UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_SEND_HK); - UT_Report(__FILE__, __LINE__, LocalSnapshotData.Count == 1, "CFE_TIME_HousekeepingCmd", - "Housekeeping telemetry request"); + UtAssert_INT32_EQ(LocalSnapshotData.Count, 1); /* Test sending the time at the tone "signal" command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CFE_TIME_Global.ToneSignalCounter = 0; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_TONE_CMD); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneSignalCounter == 1, "CFE_TIME_ToneSignalCmd", - "Time at tone signal"); + UtAssert_INT32_EQ(CFE_TIME_Global.ToneSignalCounter, 1); /* Test sending the time at the tone "data" command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CFE_TIME_Global.ToneDataCounter = 0; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.tonedatacmd), UT_TPID_CFE_TIME_DATA_CMD); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneDataCounter == 1, "CFE_TIME_ToneDataCmd", "Time at tone data"); + UtAssert_INT32_EQ(CFE_TIME_Global.ToneDataCounter, 1); /* Test sending the simulate time at the tone "signal" command */ UT_InitData(); @@ -1444,9 +1310,8 @@ void Test_PipeCmds(void) CFE_TIME_Global.ToneSignalLatch.Seconds = 0; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneSignalLatch.Seconds == 123 && CFE_TIME_Global.ToneSignalLatch.Subseconds == 0, - "CFE_TIME_FakeToneCmd", "Simulated time at tone signal"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneSignalLatch.Seconds, 123); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneSignalLatch.Subseconds, 0); /* Test sending the request time at the tone "data" command */ UT_InitData(); @@ -1459,56 +1324,50 @@ void Test_PipeCmds(void) UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_SEND_CMD); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - UT_Report(__FILE__, __LINE__, - !UT_EventIsInHistory(CFE_TIME_ID_ERR_EID) && CFE_TIME_Global.InternalCount == count + 1, - "CFE_TIME_ToneSendCmd", "Request time at tone data"); + UtAssert_UINT32_EQ(CFE_TIME_Global.InternalCount, count + 1); + CFE_UtAssert_EVENTNOTSENT(CFE_TIME_ID_ERR_EID); #else - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_ID_ERR_EID), "CFE_TIME_ToneSendCmd", - "*Command not available* Request time at tone data"); + CFE_UtAssert_EVENTSENT(CFE_TIME_ID_ERR_EID); #endif /* Test sending the no-op command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_CMD_NOOP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_NOOP_EID), "CFE_TIME_NoopCmd", "No-op"); + CFE_UtAssert_EVENTSENT(CFE_TIME_NOOP_EID); /* Test sending the reset counters command */ UT_InitData(); UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_CMD_RESET_COUNTERS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_RESET_EID), "CFE_TIME_ResetCountersCmd", - "Reset counters"); + CFE_UtAssert_EVENTSENT(CFE_TIME_RESET_EID); /* Test sending the request diagnostics command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_CMD_SEND_DIAGNOSTIC_TLM_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_DIAG_EID), "CFE_TIME_DiagCmd", "Request diagnostics"); + CFE_UtAssert_EVENTSENT(CFE_TIME_DIAG_EID); /* Test sending a clock state = invalid command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.statecmd.Payload.ClockState = CFE_TIME_ClockState_INVALID; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.statecmd), UT_TPID_CFE_TIME_CMD_SET_STATE_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_STATE_EID), "CFE_TIME_SetStateCmd", - "Set clock state = invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_STATE_EID); /* Test sending a clock state = valid command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.statecmd.Payload.ClockState = CFE_TIME_ClockState_VALID; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.statecmd), UT_TPID_CFE_TIME_CMD_SET_STATE_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_STATE_EID), "CFE_TIME_SetStateCmd", - "Set clock state = valid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_STATE_EID); /* Test sending a clock state = flywheel command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.statecmd.Payload.ClockState = CFE_TIME_ClockState_FLYWHEEL; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.statecmd), UT_TPID_CFE_TIME_CMD_SET_STATE_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_STATE_EID), "CFE_TIME_SetStateCmd", - "Set clock state = flywheel"); + CFE_UtAssert_EVENTSENT(CFE_TIME_STATE_EID); /* Test response to sending a clock state command using an * invalid state @@ -1517,8 +1376,7 @@ void Test_PipeCmds(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.statecmd.Payload.ClockState = 99; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.statecmd), UT_TPID_CFE_TIME_CMD_SET_STATE_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_STATE_ERR_EID), "CFE_TIME_SetStateCmd", - "Invalid clock state"); + CFE_UtAssert_EVENTSENT(CFE_TIME_STATE_ERR_EID); /* Test sending the set time source = internal command */ UT_InitData(); @@ -1527,11 +1385,9 @@ void Test_PipeCmds(void) UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.sourcecmd), UT_TPID_CFE_TIME_CMD_SET_SOURCE_CC); #if (CFE_PLATFORM_TIME_CFG_SOURCE == true) - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_SOURCE_EID), "CFE_TIME_SetSourceCmd", - "Set internal source"); + CFE_UtAssert_EVENTSENT(CFE_TIME_SOURCE_EID); #else - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_SOURCE_CFG_EID), "CFE_TIME_SetSourceCmd", - "Set internal source invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_SOURCE_CFG_EID); #endif /* Test sending the set time source = external command */ @@ -1541,11 +1397,9 @@ void Test_PipeCmds(void) UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.sourcecmd), UT_TPID_CFE_TIME_CMD_SET_SOURCE_CC); #if (CFE_PLATFORM_TIME_CFG_SOURCE == true) - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_SOURCE_EID), "CFE_TIME_SetSourceCmd", - "Set external source"); + CFE_UtAssert_EVENTSENT(CFE_TIME_SOURCE_EID); #else - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_SOURCE_CFG_EID), "CFE_TIME_SetSourceCmd", - "Set external source invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_SOURCE_CFG_EID); #endif /* Test response to sending a set time source command using an @@ -1555,8 +1409,7 @@ void Test_PipeCmds(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.sourcecmd.Payload.TimeSource = -1; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.sourcecmd), UT_TPID_CFE_TIME_CMD_SET_SOURCE_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_SOURCE_ERR_EID), "CFE_TIME_SetSourceCmd", - "Invalid time source"); + CFE_UtAssert_EVENTSENT(CFE_TIME_SOURCE_ERR_EID); /* Test sending a set tone signal source = primary command */ UT_InitData(); @@ -1567,14 +1420,13 @@ void Test_PipeCmds(void) UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.signalcmd), UT_TPID_CFE_TIME_CMD_SET_SIGNAL_CC); #if (CFE_PLATFORM_TIME_CFG_SIGNAL == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SIGNAL_EID) && CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetSignalCmd", "Set tone signal source = primary"); + CFE_UtAssert_EVENTSENT(CFE_TIME_SIGNAL_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SIGNAL_CFG_EID) && CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetSignalCmd", "Set tone source = primary invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_SIGNAL_CFG_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1); #endif /* Test sending a set tone signal source = redundant command */ @@ -1586,14 +1438,13 @@ void Test_PipeCmds(void) UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.signalcmd), UT_TPID_CFE_TIME_CMD_SET_SIGNAL_CC); #if (CFE_PLATFORM_TIME_CFG_SIGNAL == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SIGNAL_EID) && CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetSignalCmd", "Set tone signal source = redundant"); + CFE_UtAssert_EVENTSENT(CFE_TIME_SIGNAL_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SIGNAL_CFG_EID) && CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetSignalCmd", "Set tone signal source = redundant invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_SIGNAL_CFG_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1); #endif /* Test response to sending a set tone signal source command using an @@ -1604,9 +1455,8 @@ void Test_PipeCmds(void) CmdBuf.signalcmd.Payload.ToneSource = -1; CFE_TIME_Global.CommandErrorCounter = 0; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.signalcmd), UT_TPID_CFE_TIME_CMD_SET_SIGNAL_CC); - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_SIGNAL_ERR_EID) && CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetSignalCmd", "Invalid tone source"); + CFE_UtAssert_EVENTSENT(CFE_TIME_SIGNAL_ERR_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1); /* Test sending a time tone add delay command */ UT_InitData(); @@ -1618,15 +1468,13 @@ void Test_PipeCmds(void) UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.adddelaycmd), UT_TPID_CFE_TIME_CMD_ADD_DELAY_CC); #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELAY_EID) && CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetDelayCmd", "Set tone add delay"); + CFE_UtAssert_EVENTSENT(CFE_TIME_DELAY_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELAY_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetDelayCmd", "Set tone add delay invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_DELAY_CFG_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1); #endif /* Test sending a time tone subtract delay command */ @@ -1637,15 +1485,13 @@ void Test_PipeCmds(void) UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.subdelaycmd), UT_TPID_CFE_TIME_CMD_SUB_DELAY_CC); #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELAY_EID) && CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetDelayCmd", "Set tone subtract delay"); + CFE_UtAssert_EVENTSENT(CFE_TIME_DELAY_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELAY_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetDelayCmd", "Set subtract delay invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_DELAY_CFG_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1); #endif /* Test sending a set time command */ @@ -1656,15 +1502,13 @@ void Test_PipeCmds(void) UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.settimecmd), UT_TPID_CFE_TIME_CMD_SET_TIME_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_TIME_EID) && CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetTimeCmd", "Set time"); + CFE_UtAssert_EVENTSENT(CFE_TIME_TIME_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_TIME_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetTimeCmd", "Set time invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_TIME_CFG_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1); #endif /* Test sending a set MET command */ @@ -1675,15 +1519,13 @@ void Test_PipeCmds(void) UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.setmetcmd), UT_TPID_CFE_TIME_CMD_SET_MET_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_MET_EID) && CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetMETCmd", "Set MET"); + CFE_UtAssert_EVENTSENT(CFE_TIME_MET_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_MET_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetMETCmd", "Set MET invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_MET_CFG_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1); #endif /* Test sending a set STCF command */ @@ -1694,15 +1536,13 @@ void Test_PipeCmds(void) UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.setstcfcmd), UT_TPID_CFE_TIME_CMD_SET_STCF_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_STCF_EID) && CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetSTCFCmd", "Set STCF"); + CFE_UtAssert_EVENTSENT(CFE_TIME_STCF_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_STCF_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetSTCFCmd", "Set STCF invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_STCF_CFG_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1); #endif /* Test sending an adjust STCF positive command */ @@ -1713,15 +1553,13 @@ void Test_PipeCmds(void) UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.addadjcmd), UT_TPID_CFE_TIME_CMD_ADD_ADJUST_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELTA_EID) && CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_AdjustCmd", "Set STCF adjust positive"); + CFE_UtAssert_EVENTSENT(CFE_TIME_DELTA_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELTA_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_AdjustCmd", "Set STCF adjust positive invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_DELTA_CFG_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1); #endif /* Test sending an adjust STCF negative command */ @@ -1732,15 +1570,13 @@ void Test_PipeCmds(void) UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.subadjcmd), UT_TPID_CFE_TIME_CMD_SUB_ADJUST_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELTA_EID) && CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_AdjustCmd", "Set STCF adjust negative"); + CFE_UtAssert_EVENTSENT(CFE_TIME_DELTA_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_DELTA_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_AdjustCmd", "Set STCF adjust negative invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_DELTA_CFG_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1); #endif /* Test sending an adjust STCF 1 Hz positive command */ @@ -1752,15 +1588,13 @@ void Test_PipeCmds(void) UT_TPID_CFE_TIME_CMD_ADD_1HZ_ADJUSTMENT_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_1HZ_EID) && CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_1HzAdjCmd", "Set STCF 1Hz adjust positive"); + CFE_UtAssert_EVENTSENT(CFE_TIME_1HZ_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_1HZ_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_1HzAdjCmd", "Set STCF 1Hz adjust positive invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_1HZ_CFG_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1); #endif /* Test sending an adjust STCF 1 Hz negative command */ @@ -1772,15 +1606,13 @@ void Test_PipeCmds(void) UT_TPID_CFE_TIME_CMD_SUB_1HZ_ADJUSTMENT_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_1HZ_EID) && CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_1HzAdjCmd", "Set STCF 1Hz adjust negative"); + CFE_UtAssert_EVENTSENT(CFE_TIME_1HZ_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_1HZ_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_1HzAdjCmd", "Set STCF 1Hz adjust negative invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_1HZ_CFG_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1); #endif /* Test response to sending a tone delay command using an invalid time */ @@ -1788,37 +1620,35 @@ void Test_PipeCmds(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.adddelaycmd.Payload.MicroSeconds = 1000001; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.adddelaycmd), UT_TPID_CFE_TIME_CMD_ADD_DELAY_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_DELAY_ERR_EID), "CFE_TIME_SetDelayCmd", - "Invalid tone delay"); + CFE_UtAssert_EVENTSENT(CFE_TIME_DELAY_ERR_EID); /* Test response to sending a set time command using an invalid time */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.settimecmd.Payload.MicroSeconds = 1000001; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.settimecmd), UT_TPID_CFE_TIME_CMD_SET_TIME_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_TIME_ERR_EID), "CFE_TIME_SetTimeCmd", "Invalid time"); + CFE_UtAssert_EVENTSENT(CFE_TIME_TIME_ERR_EID); /* Test response to sending a set MET command using an invalid time */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.setmetcmd.Payload.MicroSeconds = 1000001; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.setmetcmd), UT_TPID_CFE_TIME_CMD_SET_MET_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_MET_ERR_EID), "CFE_TIME_SetMETCmd", "Invalid MET"); + CFE_UtAssert_EVENTSENT(CFE_TIME_MET_ERR_EID); /* Test response to sending a set STCF command using an invalid time */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.setstcfcmd.Payload.MicroSeconds = 1000001; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.setstcfcmd), UT_TPID_CFE_TIME_CMD_SET_STCF_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_STCF_ERR_EID), "CFE_TIME_SetSTCFCmd", "Invalid STCF"); + CFE_UtAssert_EVENTSENT(CFE_TIME_STCF_ERR_EID); /* Test response to sending an adjust STCF command using an invalid time */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.setstcfcmd.Payload.MicroSeconds = 1000001; UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.addadjcmd), UT_TPID_CFE_TIME_CMD_ADD_ADJUST_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_DELTA_ERR_EID), "CFE_TIME_AdjustCmd", - "Invalid STCF adjust"); + CFE_UtAssert_EVENTSENT(CFE_TIME_DELTA_ERR_EID); /* Test sending a set leap seconds commands */ UT_InitData(); @@ -1830,42 +1660,38 @@ void Test_PipeCmds(void) UT_TPID_CFE_TIME_CMD_SET_LEAP_SECONDS_CC); #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_LEAPS_EID) && CFE_TIME_Global.CommandCounter == 1 && - CFE_TIME_Global.CommandErrorCounter == 0, - "CFE_TIME_SetLeapSecondsCmd", "Set leap seconds"); + CFE_UtAssert_EVENTSENT(CFE_TIME_LEAPS_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0); #else - UT_Report(__FILE__, __LINE__, - UT_EventIsInHistory(CFE_TIME_LEAPS_CFG_EID) && CFE_TIME_Global.CommandCounter == 0 && - CFE_TIME_Global.CommandErrorCounter == 1, - "CFE_TIME_SetLeapSecondsCmd", "Set leap seconds invalid"); + CFE_UtAssert_EVENTSENT(CFE_TIME_LEAPS_CFG_EID); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0); + UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1); #endif /* Test response to sending an invalid command */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_CMD_INVALID_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_CC_ERR_EID), "CFE_TIME_TaskPipe", - "Invalid command code"); + CFE_UtAssert_EVENTSENT(CFE_TIME_CC_ERR_EID); /* Test response to sending a command using an invalid message ID */ UT_InitData(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_INVALID_MID); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_ID_ERR_EID), "CFE_TIME_TaskPipe", "Invalid message ID"); + CFE_UtAssert_EVENTSENT(CFE_TIME_ID_ERR_EID); /* Test response to sending a command with a bad length */ UT_InitData(); UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, 0, UT_TPID_CFE_TIME_CMD_SET_LEAP_SECONDS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_TIME_LEN_ERR_EID), "CFE_TIME_TaskPipe", "Invalid message ID"); + CFE_UtAssert_EVENTSENT(CFE_TIME_LEN_ERR_EID); /* Call the Task Pipe with the 1Hz command. */ /* In the 1Hz state machine it should call PSP GetTime as part, of latching the clock. This is tested only to see that the latch executed. */ UT_InitData(); UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.cmd), UT_TPID_CFE_TIME_1HZ_CMD); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_GetTime)) > 0, "CFE_TIME_TaskPipe", - "Invoke 1Hz state machine via SB"); + UtAssert_NONZERO(UT_GetStubCount(UT_KEY(CFE_PSP_GetTime))); } /* @@ -1883,43 +1709,37 @@ void Test_ResetArea(void) CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY; UT_GetResetDataPtr()->TimeResetVars.ClockSignal = CFE_TIME_ToneSignalSelect_REDUNDANT; CFE_TIME_UpdateResetVars(&Reference); - UT_Report(__FILE__, __LINE__, UT_GetResetDataPtr()->TimeResetVars.ClockSignal == CFE_TIME_Global.ClockSignal, - "CFE_TIME_UpdateResetVars", "Successful update"); + UtAssert_INT32_EQ(UT_GetResetDataPtr()->TimeResetVars.ClockSignal, CFE_TIME_Global.ClockSignal); /* Tests existing and good Reset Area */ UT_InitData(); UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_TIME_QueryResetVars(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.DataStoreStatus == CFE_TIME_RESET_AREA_EXISTING, - "CFE_TIME_QueryResetVars", "Initialize times using an existing reset area; time tone PRI"); + UtAssert_INT32_EQ(CFE_TIME_Global.DataStoreStatus, CFE_TIME_RESET_AREA_EXISTING); /* Tests existing and good Reset Area */ UT_InitData(); UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_REDUNDANT); CFE_TIME_QueryResetVars(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.DataStoreStatus == CFE_TIME_RESET_AREA_EXISTING, - "CFE_TIME_QueryResetVars", "Initialize times using an existing reset area; time tone RED"); + UtAssert_INT32_EQ(CFE_TIME_Global.DataStoreStatus, CFE_TIME_RESET_AREA_EXISTING); /* Test response to a bad reset area */ UT_InitData(); UT_SetStatusBSPResetArea(OS_ERROR, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_TIME_QueryResetVars(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.DataStoreStatus == CFE_TIME_RESET_AREA_BAD, "CFE_TIME_QueryResetVars", - "Reset area error"); + UtAssert_INT32_EQ(CFE_TIME_Global.DataStoreStatus, CFE_TIME_RESET_AREA_BAD); /* Test initializing to default time values */ UT_InitData(); UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE + 1, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_TIME_QueryResetVars(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.DataStoreStatus == CFE_TIME_RESET_AREA_NEW, "CFE_TIME_QueryResetVars", - "Initialize to default values"); + UtAssert_INT32_EQ(CFE_TIME_Global.DataStoreStatus, CFE_TIME_RESET_AREA_NEW); /* Test response to a bad clock signal selection parameter */ UT_InitData(); UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_REDUNDANT + 1); CFE_TIME_QueryResetVars(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.DataStoreStatus == CFE_TIME_RESET_AREA_NEW, "CFE_TIME_QueryResetVars", - "Bad clock signal selection"); + UtAssert_INT32_EQ(CFE_TIME_Global.DataStoreStatus, CFE_TIME_RESET_AREA_NEW); /* Test response to a reset area error */ UT_InitData(); @@ -1927,8 +1747,7 @@ void Test_ResetArea(void) CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY; UT_GetResetDataPtr()->TimeResetVars.ClockSignal = CFE_TIME_ToneSignalSelect_REDUNDANT; CFE_TIME_UpdateResetVars(&Reference); - UT_Report(__FILE__, __LINE__, UT_GetResetDataPtr()->TimeResetVars.ClockSignal != CFE_TIME_Global.ClockSignal, - "CFE_TIME_UpdateResetVars", "Reset area error"); + UtAssert_INT32_EQ(UT_GetResetDataPtr()->TimeResetVars.ClockSignal, CFE_TIME_ToneSignalSelect_REDUNDANT); /* Test failure to get reset area updating the reset area */ UT_InitData(); @@ -1937,8 +1756,7 @@ void Test_ResetArea(void) CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY; UT_GetResetDataPtr()->TimeResetVars.ClockSignal = CFE_TIME_ToneSignalSelect_REDUNDANT; CFE_TIME_UpdateResetVars(&Reference); - UT_Report(__FILE__, __LINE__, UT_GetResetDataPtr()->TimeResetVars.ClockSignal != CFE_TIME_Global.ClockSignal, - "CFE_TIME_UpdateResetVars", "Get reset area fail"); + UtAssert_INT32_EQ(UT_GetResetDataPtr()->TimeResetVars.ClockSignal, CFE_TIME_ToneSignalSelect_REDUNDANT); } /* @@ -1947,7 +1765,6 @@ void Test_ResetArea(void) void Test_State(void) { uint16 flag; - int16 ExpState; CFE_TIME_Reference_t Reference; volatile CFE_TIME_ReferenceState_t *RefState; @@ -1960,9 +1777,7 @@ void Test_State(void) Reference.ClockSetState = CFE_TIME_SetState_WAS_SET; Reference.ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_NO_FLY; - ExpState = CFE_TIME_ClockState_VALID; - UT_Report(__FILE__, __LINE__, CFE_TIME_CalculateState(&Reference) == ExpState, "CFE_TIME_CalculateState", - "Valid time state; server state - no flywheel"); + UtAssert_INT32_EQ(CFE_TIME_CalculateState(&Reference), CFE_TIME_ClockState_VALID); /* Test determining if the clock state is valid with the server state * in "flywheel" @@ -1972,24 +1787,20 @@ void Test_State(void) Reference.ClockFlyState = CFE_TIME_FlywheelState_NO_FLY; CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_IS_FLY; #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) - ExpState = CFE_TIME_ClockState_FLYWHEEL; + UtAssert_INT32_EQ(CFE_TIME_CalculateState(&Reference), CFE_TIME_ClockState_FLYWHEEL); #else - ExpState = CFE_TIME_ClockState_VALID; + UtAssert_INT32_EQ(CFE_TIME_CalculateState(&Reference), CFE_TIME_ClockState_VALID); #endif - UT_Report(__FILE__, __LINE__, CFE_TIME_CalculateState(&Reference) == ExpState, "CFE_TIME_CalculateState", - "Valid time state; server state - flywheel"); /* Test determining if the clock state = flywheel */ UT_InitData(); Reference.ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; - UT_Report(__FILE__, __LINE__, CFE_TIME_CalculateState(&Reference) == CFE_TIME_ClockState_FLYWHEEL, - "CFE_TIME_CalculateState", "Flywheel time state"); + UtAssert_INT32_EQ(CFE_TIME_CalculateState(&Reference), CFE_TIME_ClockState_FLYWHEEL); /* Test determining if the clock state = invalid */ UT_InitData(); Reference.ClockSetState = CFE_TIME_ClockState_INVALID; - UT_Report(__FILE__, __LINE__, CFE_TIME_CalculateState(&Reference) == CFE_TIME_ClockState_INVALID, - "CFE_TIME_CalculateState", "Invalid time state"); + UtAssert_INT32_EQ(CFE_TIME_CalculateState(&Reference), CFE_TIME_ClockState_INVALID); /* Test alternate flag values */ UT_InitData(); @@ -2010,14 +1821,15 @@ void Test_State(void) * The function should return the same flags as the previous call, even though * the global data has been updated with new values. */ - UT_Report(__FILE__, __LINE__, CFE_TIME_GetClockInfo() == flag, "CFE_TIME_GetStateFlags", - "State data atomic update before finish"); + UtAssert_INT32_EQ(CFE_TIME_GetClockInfo(), flag); /* Now finish the update and the flags should be different */ CFE_TIME_FinishReferenceUpdate(RefState); - UT_Report(__FILE__, __LINE__, CFE_TIME_GetClockInfo() != flag, "CFE_TIME_GetStateFlags", - "State data atomic update after finish"); + flag &= ~CFE_TIME_FLAG_CLKSET; + flag &= ~CFE_TIME_FLAG_FLYING; + flag &= ~CFE_TIME_FLAG_ADDTCL; + UtAssert_INT32_EQ(CFE_TIME_GetClockInfo(), flag); CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL; CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_REDUNDANT; @@ -2027,11 +1839,12 @@ void Test_State(void) CFE_TIME_Global.OneHzDirection = CFE_TIME_AdjustDirection_SUBTRACT; flag = CFE_TIME_GetClockInfo(); - UT_Report(__FILE__, __LINE__, CFE_TIME_GetClockInfo() == flag, "CFE_TIME_GetStateFlags", - "State data with alternate flags"); RefState = CFE_TIME_StartReferenceUpdate(); RefState->ClockFlyState = CFE_TIME_FlywheelState_IS_FLY; + + UtAssert_INT32_EQ(CFE_TIME_GetClockInfo(), flag); + CFE_TIME_FinishReferenceUpdate(RefState); CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; } @@ -2064,8 +1877,8 @@ void Test_GetReference(void) /* CurrentMET = AtToneMET + MaxLocalClock - AtToneLatch + * BSP_Time [+ or - AtToneDelay] */ - UT_Report(__FILE__, __LINE__, Reference.CurrentMET.Seconds == 1010 && Reference.CurrentMET.Subseconds == 0, - "CFE_TIME_GetReference", "Local clock < latch at tone time"); + UtAssert_UINT32_EQ(Reference.CurrentMET.Seconds, 1010); + UtAssert_UINT32_EQ(Reference.CurrentMET.Subseconds, 0); /* Test without local clock rollover */ UT_InitData(); @@ -2083,8 +1896,8 @@ void Test_GetReference(void) CFE_TIME_GetReference(&Reference); /* CurrentMET = AtToneMET + BSP_Time - AtToneLatch [+ or - AtToneDelay] */ - UT_Report(__FILE__, __LINE__, Reference.CurrentMET.Seconds == 25 && Reference.CurrentMET.Subseconds == 0, - "CFE_TIME_GetReference", "Local clock > latch at tone time"); + UtAssert_UINT32_EQ(Reference.CurrentMET.Seconds, 25); + UtAssert_UINT32_EQ(Reference.CurrentMET.Subseconds, 0); /* Use a hook function to test the behavior when the read needs to be retried */ /* This just causes a single retry, the process should still succeed */ @@ -2161,16 +1974,11 @@ void Test_Tone(void) #endif #ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds == CFE_MAKE_BIG32(seconds) && - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds == - CFE_MAKE_BIG32(0), /* yes, I know, 0 is 0 in all endians */ - "CFE_TIME_ToneSend", "Send tone, flywheel ON"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds, CFE_MAKE_BIG32(seconds)); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds, CFE_MAKE_BIG32(0)); #else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds == seconds && - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds == 0, - "CFE_TIME_ToneSend", "Send tone, flywheel ON"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds, seconds); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds, 0); #endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ /* Test time at the tone when not in flywheel mode */ @@ -2186,28 +1994,17 @@ void Test_Tone(void) #endif #ifdef CFE_PLATFORM_TIME_CFG_BIGENDIAN - - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds == CFE_MAKE_BIG32(virtualSeconds) && - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds == - CFE_MAKE_BIG32(0), /* yes, I know, 0 is 0 in all endians */ - "CFE_TIME_ToneSend", "Send tone, flywheel OFF"); - -#else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ - - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds == virtualSeconds && - CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds == 0, - "CFE_TIME_ToneSend", "Send tone, flywheel OFF"); - + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds, CFE_MAKE_BIG32(virtualSeconds)); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds, CFE_MAKE_BIG32(0)); +#else /* !CFE_PLATFORM_TIME_CFG_BIGENDIAN */ + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Seconds, virtualSeconds); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneDataCmd.Payload.AtToneMET.Subseconds, 0); #endif /* CFE_PLATFORM_TIME_CFG_BIGENDIAN */ #else /* Added to prevent a missing test */ - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ToneSend", "*Not tested* Send tone, flywheel ON"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ToneSend", - "*Not tested* Send tone, flywheel OFF"); /* Added to prevent a missing test # */ + UtAssert_NA("*Not tested* Send tone, flywheel ON"); + UtAssert_NA("*Not tested* Send tone, flywheel OFF"); #endif time1.Seconds = 10; @@ -2227,23 +2024,20 @@ void Test_Tone(void) CFE_TIME_Global.ToneMatchCounter = 0; CFE_TIME_Global.Forced2Fly = false; /* Exercises '!ForcedToFly' path */ CFE_TIME_ToneVerify(time1, time2); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.LastVersionCounter > VersionSave && CFE_TIME_Global.ToneMatchCounter == 1, - "CFE_TIME_ToneVerify", "Time 1 < time 2, Forced2Fly false"); + UtAssert_UINT32_EQ(CFE_TIME_Global.LastVersionCounter, VersionSave + 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneMatchCounter, 1); /* Test tone validation when time 1 equals the previous time 1 value */ UT_InitData(); CFE_TIME_Global.ToneMatchErrorCounter = 0; CFE_TIME_ToneVerify(time1, time1); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneMatchErrorCounter == 1, "CFE_TIME_ToneVerify", - "Time 1 same as previous time 1"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneMatchErrorCounter, 1); /* Test tone validation when time 2 equals the previous time 2 value */ UT_InitData(); CFE_TIME_Global.ToneMatchErrorCounter = 0; CFE_TIME_ToneVerify(time2, time1); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneMatchErrorCounter == 1, "CFE_TIME_ToneVerify", - "Time 2 same as previous time 2"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneMatchErrorCounter, 1); /* Test tone validation with time 1 > time 2 value (clock rollover) */ UT_InitData(); @@ -2255,8 +2049,7 @@ void Test_Tone(void) CFE_TIME_Global.MaxLocalClock.Subseconds = 0; CFE_TIME_Global.ToneMatchCounter = 0; CFE_TIME_ToneVerify(time1, time2); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneMatchCounter == 1, "CFE_TIME_ToneVerify", - "Time 1 > time 2 (clock rollover)"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneMatchCounter, 1); /* Test tone validation when time between packet and tone is out of * limits (seconds) @@ -2268,8 +2061,7 @@ void Test_Tone(void) time2.Subseconds = 0; CFE_TIME_Global.ToneMatchErrorCounter = 0; CFE_TIME_ToneVerify(time2, time1); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneMatchErrorCounter == 1, "CFE_TIME_ToneVerify", - "Elapsed time out of limits (seconds)"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneMatchErrorCounter, 1); /* Test tone validation when time between packet and tone is out of * limits (subseconds low) @@ -2283,8 +2075,7 @@ void Test_Tone(void) CFE_TIME_Global.MaxElapsed = 30; CFE_TIME_Global.ToneMatchErrorCounter = 0; CFE_TIME_ToneVerify(time1, time2); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneMatchErrorCounter == 1, "CFE_TIME_ToneVerify", - "Elapsed time out of limits (subseconds low)"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneMatchErrorCounter, 1); /* Test tone validation when time between packet and tone is out of * limits (subseconds high) @@ -2298,8 +2089,7 @@ void Test_Tone(void) CFE_TIME_Global.MaxElapsed = 30; CFE_TIME_Global.ToneMatchErrorCounter = 0; CFE_TIME_ToneVerify(time1, time2); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneMatchErrorCounter == 1, "CFE_TIME_ToneVerify", - "Elapsed time out of limits (subseconds high)"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneMatchErrorCounter, 1); CFE_TIME_Global.MinElapsed = MinElapsed; CFE_TIME_Global.MaxElapsed = MaxElapsed; @@ -2320,10 +2110,9 @@ void Test_Tone(void) CFE_TIME_Global.VirtualMET = 5; CFE_TIME_Global.PendingMET.Seconds = CFE_TIME_Global.VirtualMET; CFE_TIME_ToneVerify(time1, time2); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.LastVersionCounter > VersionSave && CFE_TIME_Global.ToneMatchCounter == 1 && - CFE_TIME_Global.VirtualMET == 5, - "CFE_TIME_ToneVerify", "Time 1 < time 2, Forced2Fly false, Clock EXTERN"); + UtAssert_UINT32_EQ(CFE_TIME_Global.LastVersionCounter, VersionSave + 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneMatchCounter, 1); + UtAssert_UINT32_EQ(CFE_TIME_Global.VirtualMET, 5); CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL; @@ -2334,23 +2123,19 @@ void Test_Tone(void) CFE_TIME_Global.ClockSetState = CFE_TIME_SetState_WAS_SET; CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_IS_FLY; CFE_TIME_ToneUpdate(); - UT_Report(__FILE__, __LINE__, - CFE_TIME_Global.ClockSetState == CFE_TIME_SetState_NOT_SET && - CFE_TIME_Global.ServerFlyState == CFE_TIME_FlywheelState_NO_FLY, - "CFE_TIME_ToneUpdate", "Invalid pending state"); + UtAssert_INT32_EQ(CFE_TIME_Global.ClockSetState, CFE_TIME_SetState_NOT_SET); + UtAssert_INT32_EQ(CFE_TIME_Global.ServerFlyState, CFE_TIME_FlywheelState_NO_FLY); /* Test tone update using FLYWHEEL as the pending state */ UT_InitData(); CFE_TIME_Global.PendingState = CFE_TIME_ClockState_FLYWHEEL; CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_NO_FLY; CFE_TIME_ToneUpdate(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ServerFlyState == CFE_TIME_FlywheelState_IS_FLY, - "CFE_TIME_ToneUpdate", "Pending state is FLYWHEEL"); + UtAssert_INT32_EQ(CFE_TIME_Global.ServerFlyState, CFE_TIME_FlywheelState_IS_FLY); #else - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ToneUpdate", "*Not tested* Invalid pending state"); - - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_ToneUpdate", "*Not tested* Pending state is FLYWHEEL"); + UtAssert_NA("*Not tested* Invalid pending state"); + UtAssert_NA("*Not tested* Pending state is FLYWHEEL"); #endif } @@ -2379,20 +2164,20 @@ void Test_1Hz(void) CFE_TIME_Set1HzAdj(time1, CFE_TIME_AdjustDirection_ADD); CFE_TIME_Local1HzStateMachine(); RefState = CFE_TIME_GetReferenceState(); - UT_Report(__FILE__, __LINE__, RefState->AtToneSTCF.Seconds == 30 && RefState->AtToneSTCF.Subseconds == 90, - "CFE_TIME_Set1HzAdj", "Positive adjustment"); + UtAssert_UINT32_EQ(RefState->AtToneSTCF.Seconds, 30); + UtAssert_UINT32_EQ(RefState->AtToneSTCF.Subseconds, 90); /* Test 1Hz STCF adjustment in negative direction */ UT_InitData(); CFE_TIME_Set1HzAdj(time1, CFE_TIME_AdjustDirection_SUBTRACT); CFE_TIME_Local1HzStateMachine(); RefState = CFE_TIME_GetReferenceState(); - UT_Report(__FILE__, __LINE__, RefState->AtToneSTCF.Seconds == 20 && RefState->AtToneSTCF.Subseconds == 60, - "CFE_TIME_Set1HzAdj", "Negative adjustment"); + UtAssert_UINT32_EQ(RefState->AtToneSTCF.Seconds, 20); + UtAssert_UINT32_EQ(RefState->AtToneSTCF.Subseconds, 60); #else /* These prevent missing tests when CFE_PLATFORM_TIME_CFG_SERVER is false */ - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_Local1HzISR", "(*Not tested*) Positive adjustment"); - UT_Report(__FILE__, __LINE__, true, "CFE_TIME_Local1HzISR", "(*Not tested*) Negative adjustment"); + UtAssert_NA("(*Not tested*) Positive adjustment"); + UtAssert_NA("(*Not tested*) Negative adjustment"); #endif /* Test local 1Hz interrupt when enough time has elapsed (seconds) since @@ -2411,8 +2196,7 @@ void Test_1Hz(void) CFE_TIME_Global.MaxLocalClock.Seconds = CFE_PLATFORM_TIME_CFG_LATCH_FLY - 1; CFE_TIME_Global.MaxLocalClock.Subseconds = 0; CFE_TIME_Local1HzStateMachine(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.AutoStartFly == true, "CFE_TIME_Local1HzISR", - "Auto start flywheel (seconds)"); + CFE_UtAssert_TRUE(CFE_TIME_Global.AutoStartFly); /* Test local 1Hz interrupt when enough time has elapsed since receiving a * time update to automatically update the MET @@ -2436,10 +2220,9 @@ void Test_1Hz(void) CFE_TIME_FinishReferenceUpdate(RefState); CFE_TIME_Local1HzStateMachine(); RefState = CFE_TIME_GetReferenceState(); - UT_Report(__FILE__, __LINE__, - RefState->AtToneMET.Seconds == time1.Seconds + CFE_PLATFORM_TIME_CFG_LATCH_FLY + delSec - time2.Seconds && - RefState->AtToneLatch.Seconds == 0, - "CFE_TIME_Local1HzISR", "Auto update MET"); + UtAssert_UINT32_EQ(RefState->AtToneMET.Seconds, + time1.Seconds + CFE_PLATFORM_TIME_CFG_LATCH_FLY + delSec - time2.Seconds); + UtAssert_UINT32_EQ(RefState->AtToneLatch.Seconds, 0); /* Test the tone signal ISR when the tone doesn't occur ~1 second after * the previous one @@ -2450,8 +2233,7 @@ void Test_1Hz(void) CFE_TIME_Global.ToneSignalLatch.Seconds = 1; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.IsToneGood == false, "CFE_TIME_Tone1HzISR", - "Invalid tone signal interrupt"); + CFE_UtAssert_FALSE(CFE_TIME_Global.IsToneGood); /* Test the tone signal ISR call to the application synch callback * function by verifying the number of callbacks made matches the number @@ -2473,8 +2255,7 @@ void Test_1Hz(void) } ut_time_CallbackCalled = 0; CFE_TIME_Tone1HzISR(); - UT_Report(__FILE__, __LINE__, ut_time_CallbackCalled == 3, "CFE_TIME_Tone1HzISR", - "Proper number of callbacks made"); + UtAssert_INT32_EQ(ut_time_CallbackCalled, 3); /* Test the local 1Hz task where the binary semaphore take fails on the * second call @@ -2484,8 +2265,7 @@ void Test_1Hz(void) CFE_TIME_Global.LocalTaskCounter = 0; UT_SetDeferredRetcode(UT_KEY(OS_BinSemTake), 2, OS_ERROR); CFE_TIME_Local1HzTask(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.LocalTaskCounter == 1, "CFE_TIME_Local1HzTask", - "Semaphore creation pass, then fail"); + UtAssert_UINT32_EQ(CFE_TIME_Global.LocalTaskCounter, 1); /* Test the tone 1Hz task where the binary semaphore take fails on the * second call @@ -2494,8 +2274,7 @@ void Test_1Hz(void) CFE_TIME_Global.ToneTaskCounter = 0; UT_SetDeferredRetcode(UT_KEY(OS_BinSemTake), 2, OS_ERROR); CFE_TIME_Tone1HzTask(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.ToneTaskCounter == 1, "CFE_TIME_Tone1HzTask", - "Semaphore creation pass, then fail"); + UtAssert_UINT32_EQ(CFE_TIME_Global.ToneTaskCounter, 1); /* Test the tone 1Hz task with the tone signal over the time limit */ UT_InitData(); @@ -2506,8 +2285,7 @@ void Test_1Hz(void) CFE_TIME_Global.ToneSignalLatch.Seconds = 0; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.IsToneGood == false, "CFE_TIME_Tone1HzISR", - "Invalid tone signal interrupt; tolerance over limit"); + CFE_UtAssert_FALSE(CFE_TIME_Global.IsToneGood); /* Test the tone 1Hz task with the tone signal within the time limits */ UT_InitData(); @@ -2516,8 +2294,7 @@ void Test_1Hz(void) CFE_TIME_Global.ToneSignalLatch.Seconds = 0; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.IsToneGood == true, "CFE_TIME_Tone1HzISR", - "Valid tone signal interrupt, tolerance in limits"); + CFE_UtAssert_TRUE(CFE_TIME_Global.IsToneGood); /* Test the tone 1Hz task with the tone signal under the time limit */ UT_InitData(); @@ -2526,8 +2303,7 @@ void Test_1Hz(void) CFE_TIME_Global.ToneSignalLatch.Seconds = 0; CFE_TIME_Global.ToneSignalLatch.Subseconds = 0; CFE_TIME_Tone1HzISR(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.IsToneGood == false, "CFE_TIME_Tone1HzISR", - "Valid tone signal interrupt, tolerance under limits"); + CFE_UtAssert_FALSE(CFE_TIME_Global.IsToneGood); /* Test local 1Hz interrupt when enough time has elapsed (subseconds) since * receiving a time update to automatically change the state to flywheel @@ -2543,8 +2319,7 @@ void Test_1Hz(void) CFE_TIME_FinishReferenceUpdate(RefState); UT_SetBSP_Time(0, 0); CFE_TIME_Local1HzStateMachine(); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.AutoStartFly == true, "CFE_TIME_Local1HzISR", - "Auto start flywheel (subseconds)"); + CFE_UtAssert_TRUE(CFE_TIME_Global.AutoStartFly); /* Test local 1Hz interrupt when enough time has not elapsed since * receiving a time update to automatically change the state to flywheel @@ -2558,8 +2333,7 @@ void Test_1Hz(void) UT_SetBSP_Time(1, 0); CFE_TIME_Local1HzStateMachine(); RefState = CFE_TIME_GetReferenceState(); - UT_Report(__FILE__, __LINE__, RefState->ClockFlyState == CFE_TIME_FlywheelState_NO_FLY, "CFE_TIME_Local1HzISR", - "Do not auto start flywheel"); + UtAssert_INT32_EQ(RefState->ClockFlyState, CFE_TIME_FlywheelState_NO_FLY); /* Test the local 1Hz task where auto start flywheel is disabled */ UT_InitData(); @@ -2568,9 +2342,8 @@ void Test_1Hz(void) UT_SetDeferredRetcode(UT_KEY(OS_BinSemTake), 2, OS_ERROR); CFE_TIME_Local1HzTask(); RefState = CFE_TIME_GetReferenceState(); - UT_Report(__FILE__, __LINE__, - RefState->ClockFlyState == CFE_TIME_FlywheelState_NO_FLY && !UT_EventIsInHistory(CFE_TIME_FLY_ON_EID), - "CFE_TIME_Local1HzTask", "Do not auto start flywheel"); + UtAssert_INT32_EQ(RefState->ClockFlyState, CFE_TIME_FlywheelState_NO_FLY); + CFE_UtAssert_EVENTNOTSENT(CFE_TIME_FLY_ON_EID); /* Test the CFE_TIME_Local1HzTimerCallback function */ UT_InitData(); @@ -2582,8 +2355,7 @@ void Test_1Hz(void) CFE_TIME_FinishReferenceUpdate(RefState); UT_SetBSP_Time(0, 0); CFE_TIME_Local1HzTimerCallback(OS_ObjectIdFromInteger(123), &Arg); - UT_Report(__FILE__, __LINE__, CFE_TIME_Global.LocalIntCounter == 2, "CFE_TIME_Local1HzTimerCallback", - "Pass through to CFE_TIME_Local1HzISR"); + UtAssert_UINT32_EQ(CFE_TIME_Global.LocalIntCounter, 2); } /* @@ -2592,7 +2364,6 @@ void Test_1Hz(void) void Test_UnregisterSynchCallback(void) { uint32 i = 0; - int32 Result; uint32 AppIndex; ut_time_CallbackCalled = 0; @@ -2620,10 +2391,7 @@ void Test_UnregisterSynchCallback(void) /* App ID 4 should not have a callback */ AppIndex = 4; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); - - Result = CFE_TIME_UnregisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, Result == CFE_TIME_CALLBACK_NOT_REGISTERED, "CFE_TIME_UnregisterSynchCallback", - "Unregistered result with no callback"); + UtAssert_INT32_EQ(CFE_TIME_UnregisterSynchCallback(&ut_time_MyCallbackFunc), CFE_TIME_CALLBACK_NOT_REGISTERED); /* * One callback per application is allowed; the first should succeed, @@ -2633,20 +2401,15 @@ void Test_UnregisterSynchCallback(void) AppIndex = 2; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); - Result = CFE_TIME_UnregisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, Result == CFE_SUCCESS, "CFE_TIME_UnregisterSynchCallback", - "Successfully unregister callback"); + CFE_UtAssert_SUCCESS(CFE_TIME_UnregisterSynchCallback(&ut_time_MyCallbackFunc)); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); - Result = CFE_TIME_UnregisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, Result == CFE_TIME_CALLBACK_NOT_REGISTERED, "CFE_TIME_UnregisterSynchCallback", - "Unregistered result after successful unregister"); + UtAssert_INT32_EQ(CFE_TIME_UnregisterSynchCallback(&ut_time_MyCallbackFunc), CFE_TIME_CALLBACK_NOT_REGISTERED); /* Test unregistering the callback function with a bad application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, -1); - Result = CFE_TIME_UnregisterSynchCallback(&ut_time_MyCallbackFunc); - UT_Report(__FILE__, __LINE__, Result == -1, "CFE_TIME_UnregisterSynchCallback", "Bad application ID"); + UtAssert_INT32_EQ(CFE_TIME_UnregisterSynchCallback(&ut_time_MyCallbackFunc), -1); /* Test tone notification with an invalid time synch application */ UT_InitData(); @@ -2656,8 +2419,7 @@ void Test_UnregisterSynchCallback(void) CFE_TIME_Global.SynchCallback[i].Ptr = NULL; } CFE_TIME_NotifyTimeSynchApps(); - UT_Report(__FILE__, __LINE__, ut_time_CallbackCalled == 0, "CFE_TIME_NotifyTimeSynchApps", - "Invalid time synch application"); + UtAssert_INT32_EQ(ut_time_CallbackCalled, 0); } /* @@ -2667,7 +2429,6 @@ void Test_CleanUpApp(void) { uint16 i; uint16 Count; - int32 Status = CFE_SUCCESS; uint32 AppIndex; CFE_ES_AppId_t TestAppId; @@ -2696,8 +2457,7 @@ void Test_CleanUpApp(void) /* Clean up an app which did not have a callback */ AppIndex = 4; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); - Status = CFE_TIME_CleanUpApp(TestAppId); - UT_Report(__FILE__, __LINE__, Status == CFE_SUCCESS, "CFE_TIME_CleanUpApp", "Successful result"); + CFE_UtAssert_SUCCESS(CFE_TIME_CleanUpApp(TestAppId)); Count = 0; for (i = 0; i < (sizeof(CFE_TIME_Global.SynchCallback) / sizeof(CFE_TIME_Global.SynchCallback[0])); i++) @@ -2709,13 +2469,12 @@ void Test_CleanUpApp(void) } /* should not have affected the callback table */ - UT_Report(__FILE__, __LINE__, Count == 3, "CFE_TIME_CleanUpApp", "No Sync Callback entry cleared"); + UtAssert_UINT32_EQ(Count, 3); /* Clean up an app which did have a callback */ AppIndex = 2; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); - Status = CFE_TIME_CleanUpApp(TestAppId); - UT_Report(__FILE__, __LINE__, Status == CFE_SUCCESS, "CFE_TIME_CleanUpApp", "Successful result"); + CFE_UtAssert_SUCCESS(CFE_TIME_CleanUpApp(TestAppId)); Count = 0; for (i = 0; i < (sizeof(CFE_TIME_Global.SynchCallback) / sizeof(CFE_TIME_Global.SynchCallback[0])); i++) @@ -2726,13 +2485,11 @@ void Test_CleanUpApp(void) } } - UT_Report(__FILE__, __LINE__, Count == 2, "CFE_TIME_CleanUpApp", "Sync Callback entry cleared"); + UtAssert_UINT32_EQ(Count, 2); /* Test response to a bad application ID - * This is effectively a no-op but here for coverage */ AppIndex = 99999; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false); - Status = CFE_TIME_CleanUpApp(CFE_ES_APPID_UNDEFINED); - UT_Report(__FILE__, __LINE__, Status == CFE_TIME_CALLBACK_NOT_REGISTERED, "CFE_TIME_CleanUpApp", - "Bad application ID"); + UtAssert_INT32_EQ(CFE_TIME_CleanUpApp(CFE_ES_APPID_UNDEFINED), CFE_TIME_CALLBACK_NOT_REGISTERED); }