diff --git a/docs/cs_FunctionalRequirements.csv b/docs/cs_FunctionalRequirements.csv index bdc52ca..edf6eb7 100644 --- a/docs/cs_FunctionalRequirements.csv +++ b/docs/cs_FunctionalRequirements.csv @@ -63,26 +63,26 @@ a) Generate an event message containing the baseline CRC b) Set the Recompute In Progress Flag to FALSE",Gives the ground indication not only that the CRC baseline was calculated but what the value is CS3009.2,CS3009.2,"If CS is already processing a Recompute CRC command or a One Shot CRC command, CS shall reject the command.",Only able to process one recompute one at a time CS3010,CS3010,"Upon receipt of a Report cFE code segment CRC command, CS shall send an event message containing the baseline cFE code segment CRC.",Provides the ability to view the cFE code segment baseline CRC -CS4000,CS4000,"Checksum shall calculate CRCs for each Table-Defined Application's code segment and compare them against the corresponding Application's baseline code segment CRC if: +CS4000,CS4000,"Checksum shall calculate CRCs for each Table-Defined Application or Library's code segment and compare them against the corresponding Application's baseline code segment CRC if: a) Checksumming (as a whole) is Enabled b) App code segment checksumming is Enabled -c) Checksumming of the individual Application Code Segment is Enabled",Need to verify each Application’s code segment. Note that CS depends on ES to provide the information as to which applications are running -CS4000.1,CS4000.1,"If the Application's code segment CRC is not equal to the corresponding Application's baseline code segment CRC, CS shall increment the Application Code Segment CRC Miscompare Counter and send an event message.","In practice, when a new application is being loaded, checksumming of Application code segments should be disabled prior to the load and then enabled after the load." -CS4000.2,CS4000.2,"If the table-defined Application code segment is invalid, CS shall send an event message and skip that Application code segment.",This may be a result of an invalid Application code segment table or a deleted application. -CS4001,CS4001,"Upon receipt of a Enable Application checksumming command, CS shall enable checksumming of all Application Code segments.",Enable checksumming of all of the Application code segments defined in the table -CS4002,CS4002,"Upon receipt of a Disable Application checksumming command, CS shall Disable checksumming of all Application Code segments.",Disable checksumming of all of the Application code segments defined in the table -CS4003,CS4003,"Upon receipt of a Enable Application code segment command, CS shall enable checksumming of the command-specified Application.",Enable checksumming of a particular Application code segment -CS4004,CS4004,"Upon receipt of a Disable Application code segment command, CS shall Disable checksumming of the command-specified Application.",Disable checksumming of a particular Application Code segment. This may be particularly useful when reloading an existing application. +c) Checksumming of the individual Application or Library Code Segment is Enabled",Need to verify each Application or Library’s code segment. Note that CS depends on ES to provide the information as to which applications are running +CS4000.1,CS4000.1,"If the Application or Library's code segment CRC is not equal to the corresponding Application or Library's baseline code segment CRC, CS shall increment the Application Code Segment CRC Miscompare Counter and send an event message.","In practice, when a new application or library is being loaded, checksumming of Application or Library code segments should be disabled prior to the load and then enabled after the load." +CS4000.2,CS4000.2,"If the table-defined Application or Library code segment is invalid, CS shall send an event message and skip that Application or Library code segment.",This may be a result of an invalid Application or Library code segment table or a deleted application. +CS4001,CS4001,"Upon receipt of a Enable Application checksumming command, CS shall enable checksumming of all Application and Library Code segments.",Enable checksumming of all of the Application and Library code segments defined in the table +CS4002,CS4002,"Upon receipt of a Disable Application checksumming command, CS shall Disable checksumming of all Application and Library Code segments.",Disable checksumming of all of the Application and Library code segments defined in the table +CS4003,CS4003,"Upon receipt of a Enable Application code segment command, CS shall enable checksumming of the command-specified Application or Library.",Enable checksumming of a particular Application or Library code segment +CS4004,CS4004,"Upon receipt of a Disable Application code segment command, CS shall Disable checksumming of the command-specified Application or Library.",Disable checksumming of a particular Application or Library Code segment. This may be particularly useful when reloading an existing application. CS4005,CS4005,"Upon receipt of a Recompute Application Code Segment CRC command, CS shall: -a) Recompute the baseline CRC for the Application -b) Set the Recompute In Progress Flag to TRUE",Would be used after an Application code segment is updated in order to regenerate the baseline +a) Recompute the baseline CRC for the Application or Library +b) Set the Recompute In Progress Flag to TRUE",Would be used after an Application or Library code segment is updated in order to regenerate the baseline CS4005.1,CS4005.1,"Once the baseline CRC is computed, CS shall: a) Generate an event message containing the baseline CRC b) Set the Recompute In Progress Flag to FALSE",Gives the ground indication not only that the CRC baseline was calculated but what the value is. CS4005.2,CS4005.2,"If CS is already processing a Recompute CRC command or a One Shot CRC command, CS shall reject the command.",Can only support one recompute CRC at a time -CS4006,CS4006,"Upon receipt of a Report Application code segment CRC command, CS shall send an event message containing the baseline Application code segment CRC",Provides the ground with the baseline being used. -CS4007,CS4007,"If the command-specified Application is invalid (for any Application Code Segment command where the Application is a command argument, CS shall reject the command and send an event message",Need to handle the case where an invalid Application is specified for any of the Application code segment commands -CS4008,CS4008,CS shall provide the ability to dump the baseline CRCs and status for the Application code segment memory segments via a dump-only table,Need the ability to get all of the application code segment checksums. Easiest to use the cFE Table services dump-only table feature +CS4006,CS4006,"Upon receipt of a Report Application code segment CRC command, CS shall send an event message containing the baseline Application or Library code segment CRC",Provides the ground with the baseline being used. +CS4007,CS4007,"If the command-specified Application or Library is invalid (for any Application Code Segment command where the Application/Library is a command argument, CS shall reject the command and send an event message",Need to handle the case where an invalid Application or Library is specified for any of the Application code segment commands +CS4008,CS4008,CS shall provide the ability to dump the baseline CRCs and status for the Application or Library code segment memory segments via a dump-only table,Need the ability to get all of the application code segment checksums. Easiest to use the cFE Table services dump-only table feature CS5000,CS5000,"Checksum shall calculate CRCs for each Table-Defined Table and compare them against the corresponding Table's baseline CRC if: a) Checksumming (as a whole) is Enabled b) Table checksumming is Enabled @@ -186,7 +186,7 @@ a) enabled b) disabled c) empty",Table validation includes verifying that the table contains valid intial states. CS9004,CS9004,"Upon a cFE Power On Reset, if the Non-Volatile Power-On Initialization state is set to Enabled, CS shall compute the baseline CRC for the total of all of non-volatile segments.",Need to have a checksum for the entire image. Note that the CRCs for each of the non-volatile segments specified in the table are added together to arrive at this number. -CS9005,CS9005,"Upon a cFE Power On Reset, if the Application Power-On Initialization state is set to Enabled, CS shall compute baseline CRCs for the Application code segments region based on the corresponding table definition for up to a Applications",Need to compute baselines for the Applications specified in the table. The platform-defined value could be equal to the max number of apps defined by cFE ES but could be less +CS9005,CS9005,"Upon a cFE Power On Reset, if the Application Power-On Initialization state is set to Enabled, CS shall compute baseline CRCs for the Application or Library code segments region based on the corresponding table definition for up to a Applications and Libraries",Need to compute baselines for the Applications and Libraries specified in the table. The platform-defined value could be equal to the max number of apps defined by cFE ES but could be less CS9005.1,CS9005.1,"CS shall send an event message and disable Application code segment Checksumming, if the state is not one of the following: a) enabled b) disabled diff --git a/fsw/src/cs_compute.c b/fsw/src/cs_compute.c index d0917dc..b622eaa 100644 --- a/fsw/src/cs_compute.c +++ b/fsw/src/cs_compute.c @@ -316,12 +316,12 @@ int32 CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *ComputedCSVa uint32 NewChecksumValue = 0; int32 Status = CS_SUCCESS; int32 Result; - int32 ResultGetAppID = CS_ERROR; - int32 ResultGetAppInfo = CS_ERROR; - int32 ResultAddressValid = false; + int32 ResultGetResourceID = CS_ERROR; + int32 ResultGetResourceInfo = CS_ERROR; + int32 ResultAddressValid = false; /* variables to get applications address */ - CFE_ES_AppId_t AppID = CFE_ES_APPID_UNDEFINED; + CFE_ES_ResourceId_t ResourceID = CFE_ES_APPID_UNDEFINED; CFE_ES_AppInfo_t AppInfo; /* By the time we get here, we know we have an enabled entry */ @@ -329,20 +329,25 @@ int32 CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *ComputedCSVa /* set the done flag to false originally */ *DoneWithEntry = false; - ResultGetAppID = CFE_ES_GetAppIDByName(&AppID, ResultsEntry->Name); - Result = ResultGetAppID; + ResultGetResourceID = CFE_ES_GetAppIDByName(&ResourceID, ResultsEntry->Name); + if (ResultGetResourceID == CFE_ES_ERR_NAME_NOT_FOUND) + { + /* Also check for a matching library name */ + ResultGetResourceID = CFE_ES_GetLibIDByName(&ResourceID, ResultsEntry->Name); + } + Result = ResultGetResourceID; if (Result == CFE_SUCCESS) { - /* We got a valid AppID, so get the App info */ + /* We got a valid ResourceID, so get the Resource info */ - ResultGetAppInfo = CFE_ES_GetAppInfo(&AppInfo, AppID); - Result = ResultGetAppInfo; + ResultGetResourceInfo = CFE_ES_GetModuleInfo(&AppInfo, ResourceID); + Result = ResultGetResourceInfo; } if (Result == CFE_SUCCESS) { - /* We got a valid AppID and good App info, so check the for valid addresses */ + /* We got a valid ResourceID and good App info, so check the for valid addresses */ if (AppInfo.AddressesAreValid == false) { @@ -363,7 +368,7 @@ int32 CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *ComputedCSVa if (Result == CFE_SUCCESS) { - /* We got valid AppID, good info, and valid addresses, so run the checksum */ + /* We got valid ResourceID, good info, and valid addresses, so run the checksum */ OffsetIntoCurrEntry = ResultsEntry->ByteOffset; FirstAddrThisCycle = ResultsEntry->StartAddress + OffsetIntoCurrEntry; @@ -417,11 +422,11 @@ int32 CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *ComputedCSVa } /* end if got module id ok */ else { - /* Something failed -- either invalid AppID, bad App info, or invalid addresses, so notify ground */ + /* Something failed -- either invalid ResourceID, bad App info, or invalid addresses, so notify ground */ CFE_EVS_SendEvent( CS_COMPUTE_APP_ERR_EID, CFE_EVS_EventType_ERROR, - "CS Apps: Problems getting app %s info, GetAppID: 0x%08X, GetAppInfo: 0x%08X, AddressValid: %d", - ResultsEntry->Name, (unsigned int)ResultGetAppID, (unsigned int)ResultGetAppInfo, + "CS Apps: Problems getting module %s info, GetResourceID: 0x%08X, GetModuleInfo: 0x%08X, AddressValid: %d", + ResultsEntry->Name, (unsigned int)ResultGetResourceID, (unsigned int)ResultGetResourceInfo, (unsigned int)ResultAddressValid); Status = CS_ERR_NOT_FOUND; diff --git a/unit-test/cs_compute_tests.c b/unit-test/cs_compute_tests.c index 60e898e..1335b0b 100644 --- a/unit-test/cs_compute_tests.c +++ b/unit-test/cs_compute_tests.c @@ -69,7 +69,7 @@ void CS_COMPUTE_TEST_CFE_TBL_ShareHandler(void *UserObj, UT_EntryKey_t FuncKey, *TblHandlePtr = 99; } -void CS_COMPUTE_TEST_CFE_ES_GetAppInfoHandler1(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +void CS_COMPUTE_TEST_CFE_ES_GetModuleInfoHandler1(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { CFE_ES_AppInfo_t *AppInfo = (CFE_ES_AppInfo_t *)UT_Hook_GetArgValueByName(Context, "AppInfo", CFE_ES_AppInfo_t *); @@ -78,7 +78,7 @@ void CS_COMPUTE_TEST_CFE_ES_GetAppInfoHandler1(void *UserObj, UT_EntryKey_t Func AppInfo->AddressesAreValid = true; } -void CS_COMPUTE_TEST_CFE_ES_GetAppInfoHandler2(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +void CS_COMPUTE_TEST_CFE_ES_GetModuleInfoHandler2(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { CFE_ES_AppInfo_t *AppInfo = (CFE_ES_AppInfo_t *)UT_Hook_GetArgValueByName(Context, "AppInfo", CFE_ES_AppInfo_t *); @@ -87,7 +87,6 @@ void CS_COMPUTE_TEST_CFE_ES_GetAppInfoHandler2(void *UserObj, UT_EntryKey_t Func void CS_ComputeEepromMemory_Test_Nominal(void) { - int32 Result; CS_Res_EepromMemory_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = false; @@ -105,23 +104,17 @@ void CS_ComputeEepromMemory_Test_Nominal(void) UT_SetDefaultReturnValue(UT_KEY(CFE_ES_CalculateCRC), 1); /* Execute the function being tested */ - Result = CS_ComputeEepromMemory(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeEepromMemory(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CFE_SUCCESS); /* Verify results */ - UtAssert_True(DoneWithEntry == true, "DoneWithEntry == true"); + UtAssert_BOOL_TRUE(DoneWithEntry); - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end CS_ComputeEepromMemory_Test_Nominal */ void CS_ComputeEepromMemory_Test_Error(void) { - int32 Result; CS_Res_EepromMemory_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = false; @@ -139,23 +132,17 @@ void CS_ComputeEepromMemory_Test_Error(void) UT_SetDefaultReturnValue(UT_KEY(CFE_ES_CalculateCRC), 1); /* Execute the function being tested */ - Result = CS_ComputeEepromMemory(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeEepromMemory(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CS_ERROR); /* Verify results */ - UtAssert_True(DoneWithEntry == true, "DoneWithEntry == true"); - - UtAssert_True(Result == CS_ERROR, "Result == CS_ERROR"); + UtAssert_BOOL_TRUE(DoneWithEntry); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end CS_ComputeEepromMemory_Test_Error */ void CS_ComputeEepromMemory_Test_FirstTimeThrough(void) { - int32 Result; CS_Res_EepromMemory_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = false; @@ -171,29 +158,23 @@ void CS_ComputeEepromMemory_Test_FirstTimeThrough(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_CalculateCRC), 1, 1); /* Execute the function being tested */ - Result = CS_ComputeEepromMemory(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeEepromMemory(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CFE_SUCCESS); /* Verify results */ - UtAssert_True(DoneWithEntry == true, "DoneWithEntry == true"); - - UtAssert_True(ResultsEntry.ComputedYet == true, "ResultsEntry.ComputedYet == true"); - UtAssert_True(ResultsEntry.ComparisonValue == 1, "ResultsEntry.ComparisonValue == 1"); - UtAssert_True(ComputedCSValue == 1, "ComputedCSValue == 1"); - UtAssert_True(ResultsEntry.ByteOffset == 0, "ResultsEntry.ByteOffset == 0"); - UtAssert_True(ResultsEntry.TempChecksumValue == 0, "ResultsEntry.TempChecksumValue == 0"); + UtAssert_BOOL_TRUE(DoneWithEntry); - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); + UtAssert_BOOL_TRUE(ResultsEntry.ComputedYet); + UtAssert_UINT32_EQ(ResultsEntry.ComparisonValue, 1); + UtAssert_UINT32_EQ(ComputedCSValue, 1); + UtAssert_UINT32_EQ(ResultsEntry.ByteOffset, 0); + UtAssert_UINT32_EQ(ResultsEntry.TempChecksumValue, 0); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end CS_ComputeEepromMemory_Test_FirstTimeThrough */ void CS_ComputeEepromMemory_Test_NotFinished(void) { - int32 Result; CS_Res_EepromMemory_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = false; @@ -209,28 +190,21 @@ void CS_ComputeEepromMemory_Test_NotFinished(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_CalculateCRC), 1, 1); /* Execute the function being tested */ - Result = CS_ComputeEepromMemory(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeEepromMemory(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CFE_SUCCESS); /* Verify results */ - UtAssert_True(ResultsEntry.ByteOffset == 1, "ResultsEntry.ByteOffset == 1"); - UtAssert_True(ResultsEntry.TempChecksumValue == 1, "ResultsEntry.TempChecksumValue == 1"); - - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); + UtAssert_UINT32_EQ(ResultsEntry.ByteOffset, 1); + UtAssert_UINT32_EQ(ResultsEntry.TempChecksumValue, 1); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end CS_ComputeEepromMemory_Test_NotFinished */ void CS_ComputeTables_Test_TableNeverLoaded(void) { - int32 Result; CS_Res_Tables_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = true; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&ResultsEntry, 0, sizeof(ResultsEntry)); @@ -246,34 +220,25 @@ void CS_ComputeTables_Test_TableNeverLoaded(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 1, CFE_TBL_ERR_NEVER_LOADED); /* Execute the function being tested */ - Result = CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CS_ERR_NOT_FOUND); /* Verify results */ - UtAssert_True(DoneWithEntry == false, "DoneWithEntry == false"); - - UtAssert_True(Result == CS_ERR_NOT_FOUND, "Result == CS_ERR_NOT_FOUND"); + UtAssert_BOOL_FALSE(DoneWithEntry); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_COMPUTE_TABLES_ERR_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_ComputeTables_Test_TableNeverLoaded */ void CS_ComputeTables_Test_TableUnregisteredAndNeverLoaded(void) { - int32 Result; CS_Res_Tables_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = true; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&ResultsEntry, 0, sizeof(ResultsEntry)); @@ -295,38 +260,29 @@ void CS_ComputeTables_Test_TableUnregisteredAndNeverLoaded(void) UT_SetDeferredRetcode(UT_KEY(CS_AttemptTableReshare), 1, -1); /* Execute the function being tested */ - Result = CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CS_ERR_NOT_FOUND); /* Verify results */ - UtAssert_True(DoneWithEntry == false, "DoneWithEntry == false"); + UtAssert_BOOL_FALSE(DoneWithEntry); - UtAssert_True(ResultsEntry.ComparisonValue == 0, "ResultsEntry.ComparisonValue == 0"); - UtAssert_True(ResultsEntry.StartAddress == 0, "ResultsEntry.StartAddress == 0"); - UtAssert_True(ResultsEntry.NumBytesToChecksum == 0, "ResultsEntry.NumBytesToChecksum == 0"); - - UtAssert_True(Result == CS_ERR_NOT_FOUND, "Result == CS_ERR_NOT_FOUND"); + UtAssert_UINT32_EQ(ResultsEntry.ComparisonValue, 0); + UtAssert_UINT32_EQ(ResultsEntry.StartAddress, 0); + UtAssert_UINT32_EQ(ResultsEntry.NumBytesToChecksum, 0); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_COMPUTE_TABLES_ERR_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_ComputeTables_Test_TableUnregisteredAndNeverLoaded */ void CS_ComputeTables_Test_ResultShareNotSuccess(void) { - int32 Result; CS_Res_Tables_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = true; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&ResultsEntry, 0, sizeof(ResultsEntry)); @@ -349,33 +305,24 @@ void CS_ComputeTables_Test_ResultShareNotSuccess(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 1, CFE_TBL_ERR_UNREGISTERED); /* Execute the function being tested */ - Result = CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CS_ERR_NOT_FOUND); /* Verify results */ - UtAssert_True(DoneWithEntry == false, "DoneWithEntry == false"); - - UtAssert_True(ResultsEntry.TblHandle == CFE_TBL_BAD_TABLE_HANDLE, - "ResultsEntry.TblHandle == CFE_TBL_BAD_TABLE_HANDLE"); + UtAssert_BOOL_FALSE(DoneWithEntry); - UtAssert_True(Result == CS_ERR_NOT_FOUND, "Result == CS_ERR_NOT_FOUND"); + UtAssert_INT16_EQ(ResultsEntry.TblHandle, CFE_TBL_BAD_TABLE_HANDLE); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_COMPUTE_TABLES_ERR_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_ComputeTables_Test_ResultShareNotSuccess */ void CS_ComputeTables_Test_TblInfoUpdated(void) { - int32 Result; CS_Res_Tables_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = true; @@ -398,31 +345,25 @@ void CS_ComputeTables_Test_TblInfoUpdated(void) UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_TBL_INFO_UPDATED); /* Execute the function being tested */ - Result = CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CFE_SUCCESS); /* Verify results */ - UtAssert_True(DoneWithEntry == false, "DoneWithEntry == false"); + UtAssert_BOOL_FALSE(DoneWithEntry); - UtAssert_True(ResultsEntry.NumBytesToChecksum == 5, "ResultsEntry.NumBytesToChecksum == 5"); - UtAssert_True(ResultsEntry.StartAddress == 0, "ResultsEntry.StartAddress == 0"); - UtAssert_True(ComputedCSValue == 0, "ComputedCSValue == 0"); - UtAssert_True(ResultsEntry.ComputedYet == false, "ResultsEntry.ComputedYet == false"); - UtAssert_True(ResultsEntry.ComparisonValue == 0, "ResultsEntry.ComparisonValue == 0"); - UtAssert_True(ResultsEntry.ByteOffset == 0, "ResultsEntry.ByteOffset == 0"); - UtAssert_True(ResultsEntry.TempChecksumValue == 0, "ResultsEntry.TempChecksumValue == 0"); + UtAssert_UINT32_EQ(ResultsEntry.NumBytesToChecksum, 5); + UtAssert_UINT32_EQ(ResultsEntry.StartAddress, 0); + UtAssert_UINT32_EQ(ComputedCSValue, 0); + UtAssert_BOOL_FALSE(ResultsEntry.ComputedYet); + UtAssert_UINT32_EQ(ResultsEntry.ComparisonValue, 0); + UtAssert_UINT32_EQ(ResultsEntry.ByteOffset, 0); + UtAssert_UINT32_EQ(ResultsEntry.TempChecksumValue, 0); - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end CS_ComputeTables_Test_TblInfoUpdated */ void CS_ComputeTables_Test_GetInfoResult(void) { - int32 Result; CS_Res_Tables_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = true; @@ -446,31 +387,25 @@ void CS_ComputeTables_Test_GetInfoResult(void) UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_TBL_INFO_UPDATED); /* Execute the function being tested */ - Result = CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CFE_SUCCESS); /* Verify results */ - UtAssert_True(DoneWithEntry == false, "DoneWithEntry == false"); - - UtAssert_True(ResultsEntry.NumBytesToChecksum == 0, "ResultsEntry.NumBytesToChecksum == 0"); - UtAssert_True(ResultsEntry.StartAddress == 0, "ResultsEntry.StartAddress == 0"); - UtAssert_True(ComputedCSValue == 0, "ComputedCSValue == 0"); - UtAssert_True(ResultsEntry.ComputedYet == false, "ResultsEntry.ComputedYet == false"); - UtAssert_True(ResultsEntry.ComparisonValue == 0, "ResultsEntry.ComparisonValue == 0"); - UtAssert_True(ResultsEntry.ByteOffset == 0, "ResultsEntry.ByteOffset == 0"); - UtAssert_True(ResultsEntry.TempChecksumValue == 0, "ResultsEntry.TempChecksumValue == 0"); - - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); + UtAssert_BOOL_FALSE(DoneWithEntry); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_UINT32_EQ(ResultsEntry.NumBytesToChecksum, 0); + UtAssert_UINT32_EQ(ResultsEntry.StartAddress, 0); + UtAssert_UINT32_EQ(ComputedCSValue, 0); + UtAssert_BOOL_FALSE(ResultsEntry.ComputedYet); + UtAssert_UINT32_EQ(ResultsEntry.ComparisonValue, 0); + UtAssert_UINT32_EQ(ResultsEntry.ByteOffset, 0); + UtAssert_UINT32_EQ(ResultsEntry.TempChecksumValue, 0); - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end CS_ComputeTables_Test_GetInfoResult */ void CS_ComputeTables_Test_CSError(void) { - int32 Result; CS_Res_Tables_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = false; @@ -500,29 +435,23 @@ void CS_ComputeTables_Test_CSError(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_CalculateCRC), 1, 2); /* Execute the function being tested */ - Result = CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CS_ERROR); /* Verify results */ - UtAssert_True(DoneWithEntry == true, "DoneWithEntry == true"); + UtAssert_BOOL_TRUE(DoneWithEntry); - UtAssert_True(ResultsEntry.NumBytesToChecksum == 5, "ResultsEntry.NumBytesToChecksum == 5"); - UtAssert_True(ResultsEntry.StartAddress == 0, "ResultsEntry.StartAddress == 0"); - UtAssert_True(ComputedCSValue == 2, "ComputedCSValue == 2"); - UtAssert_True(ResultsEntry.ByteOffset == 0, "ResultsEntry.ByteOffset == 0"); - UtAssert_True(ResultsEntry.TempChecksumValue == 0, "ResultsEntry.TempChecksumValue == 0"); + UtAssert_UINT32_EQ(ResultsEntry.NumBytesToChecksum, 5); + UtAssert_UINT32_EQ(ResultsEntry.StartAddress, 0); + UtAssert_UINT32_EQ(ComputedCSValue, 2); + UtAssert_UINT32_EQ(ResultsEntry.ByteOffset, 0); + UtAssert_UINT32_EQ(ResultsEntry.TempChecksumValue, 0); - UtAssert_True(Result == CS_ERROR, "Result == CS_ERROR"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end CS_ComputeTables_Test_CSError */ void CS_ComputeTables_Test_NominalBadTableHandle(void) { - int32 Result; CS_Res_Tables_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = false; @@ -555,31 +484,25 @@ void CS_ComputeTables_Test_NominalBadTableHandle(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_CalculateCRC), 1, 2); /* Execute the function being tested */ - Result = CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CFE_SUCCESS); /* Verify results */ - UtAssert_True(DoneWithEntry == true, "DoneWithEntry == true"); - - UtAssert_True(ResultsEntry.TblHandle == 99, "ResultsEntry.TblHandle == 99"); - - UtAssert_True(ResultsEntry.NumBytesToChecksum == 5, "ResultsEntry.NumBytesToChecksum == 5"); - UtAssert_True(ResultsEntry.StartAddress == 0, "ResultsEntry.StartAddress == 0"); - UtAssert_True(ComputedCSValue == 2, "ComputedCSValue == 2"); - UtAssert_True(ResultsEntry.ByteOffset == 0, "ResultsEntry.ByteOffset == 0"); - UtAssert_True(ResultsEntry.TempChecksumValue == 0, "ResultsEntry.TempChecksumValue == 0"); + UtAssert_BOOL_TRUE(DoneWithEntry); - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); + UtAssert_INT16_EQ(ResultsEntry.TblHandle, 99); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_UINT32_EQ(ResultsEntry.NumBytesToChecksum, 5); + UtAssert_UINT32_EQ(ResultsEntry.StartAddress, 0); + UtAssert_UINT32_EQ(ComputedCSValue, 2); + UtAssert_UINT32_EQ(ResultsEntry.ByteOffset, 0); + UtAssert_UINT32_EQ(ResultsEntry.TempChecksumValue, 0); - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end CS_ComputeTables_Test_NominalBadTableHandle */ void CS_ComputeTables_Test_FirstTimeThrough(void) { - int32 Result; CS_Res_Tables_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = false; @@ -612,35 +535,29 @@ void CS_ComputeTables_Test_FirstTimeThrough(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_CalculateCRC), 1, 3); /* Execute the function being tested */ - Result = CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CFE_SUCCESS); /* Verify results */ - UtAssert_True(DoneWithEntry == true, "DoneWithEntry == true"); + UtAssert_BOOL_TRUE(DoneWithEntry); - UtAssert_True(ResultsEntry.TblHandle == 99, "ResultsEntry.TblHandle == 99"); + UtAssert_INT16_EQ(ResultsEntry.TblHandle, 99); - UtAssert_True(ResultsEntry.NumBytesToChecksum == 5, "ResultsEntry.NumBytesToChecksum == 5"); - UtAssert_True(ResultsEntry.StartAddress == 0, "ResultsEntry.StartAddress == 0"); + UtAssert_UINT32_EQ(ResultsEntry.NumBytesToChecksum, 5); + UtAssert_UINT32_EQ(ResultsEntry.StartAddress, 0); - UtAssert_True(ResultsEntry.ComputedYet == true, "ResultsEntry.ComputedYet == true"); - UtAssert_True(ResultsEntry.ComparisonValue == 3, "ResultsEntry.ComparisonValue == 3"); + UtAssert_BOOL_TRUE(ResultsEntry.ComputedYet); + UtAssert_UINT32_EQ(ResultsEntry.ComparisonValue, 3); - UtAssert_True(ComputedCSValue == 3, "ComputedCSValue == 3"); - UtAssert_True(ResultsEntry.ByteOffset == 0, "ResultsEntry.ByteOffset == 0"); - UtAssert_True(ResultsEntry.TempChecksumValue == 0, "ResultsEntry.TempChecksumValue == 0"); + UtAssert_UINT32_EQ(ComputedCSValue, 3); + UtAssert_UINT32_EQ(ResultsEntry.ByteOffset, 0); + UtAssert_UINT32_EQ(ResultsEntry.TempChecksumValue, 0); - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end CS_ComputeTables_Test_FirstTimeThrough */ void CS_ComputeTables_Test_EntryNotFinished(void) { - int32 Result; CS_Res_Tables_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = true; @@ -673,37 +590,30 @@ void CS_ComputeTables_Test_EntryNotFinished(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_CalculateCRC), 1, 3); /* Execute the function being tested */ - Result = CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CFE_SUCCESS); /* Verify results */ - UtAssert_True(DoneWithEntry == false, "DoneWithEntry == false"); - - UtAssert_True(ResultsEntry.TblHandle == 99, "ResultsEntry.TblHandle == 99"); - - UtAssert_True(ResultsEntry.NumBytesToChecksum == 5, "ResultsEntry.NumBytesToChecksum == 5"); - UtAssert_True(ResultsEntry.StartAddress == 0, "ResultsEntry.StartAddress == 0"); + UtAssert_BOOL_FALSE(DoneWithEntry); - UtAssert_True(ResultsEntry.ByteOffset == 3, "ResultsEntry.ByteOffset == 3"); - UtAssert_True(ResultsEntry.TempChecksumValue == 3, "ResultsEntry.TempChecksumValue == 3"); - UtAssert_True(ComputedCSValue == 3, "ComputedCSValue == 3"); + UtAssert_INT16_EQ(ResultsEntry.TblHandle, 99); - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); + UtAssert_UINT32_EQ(ResultsEntry.NumBytesToChecksum, 5); + UtAssert_UINT32_EQ(ResultsEntry.StartAddress, 0); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_UINT32_EQ(ComputedCSValue, 3); + UtAssert_UINT32_EQ(ResultsEntry.ByteOffset, 3); + UtAssert_UINT32_EQ(ResultsEntry.TempChecksumValue, 3); - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end CS_ComputeTables_Test_EntryNotFinished */ void CS_ComputeTables_Test_ComputeTablesReleaseError(void) { - int32 Result; CS_Res_Tables_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = true; CFE_TBL_Info_t TblInfo; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&ResultsEntry, 0, sizeof(ResultsEntry)); @@ -741,44 +651,35 @@ void CS_ComputeTables_Test_ComputeTablesReleaseError(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_ReleaseAddress), 1, -1); /* Execute the function being tested */ - Result = CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CFE_SUCCESS); /* Verify results */ - UtAssert_True(DoneWithEntry == false, "DoneWithEntry == false"); + UtAssert_BOOL_FALSE(DoneWithEntry); - UtAssert_True(ResultsEntry.TblHandle == 99, "ResultsEntry.TblHandle == 99"); + UtAssert_INT16_EQ(ResultsEntry.TblHandle, 99); - UtAssert_True(ResultsEntry.NumBytesToChecksum == 5, "ResultsEntry.NumBytesToChecksum == 5"); - UtAssert_True(ResultsEntry.StartAddress == 0, "ResultsEntry.StartAddress == 0"); + UtAssert_UINT32_EQ(ResultsEntry.NumBytesToChecksum, 5); + UtAssert_UINT32_EQ(ResultsEntry.StartAddress, 0); - UtAssert_True(ResultsEntry.ByteOffset == 3, "ResultsEntry.ByteOffset == 3"); - UtAssert_True(ResultsEntry.TempChecksumValue == 3, "ResultsEntry.TempChecksumValue == 3"); - UtAssert_True(ComputedCSValue == 3, "ComputedCSValue == 3"); - - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); + UtAssert_UINT32_EQ(ResultsEntry.ByteOffset, 3); + UtAssert_UINT32_EQ(ResultsEntry.TempChecksumValue, 3); + UtAssert_UINT32_EQ(ComputedCSValue, 3); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_COMPUTE_TABLES_RELEASE_ERR_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_ComputeTables_Test_ComputeTablesReleaseError */ void CS_ComputeTables_Test_ComputeTablesError(void) { - int32 Result; CS_Res_Tables_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = true; CFE_TBL_Info_t TblInfo; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&ResultsEntry, 0, sizeof(ResultsEntry)); @@ -803,30 +704,22 @@ void CS_ComputeTables_Test_ComputeTablesError(void) UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), -1); /* Execute the function being tested */ - Result = CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeTables(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CS_ERR_NOT_FOUND); /* Verify results */ - UtAssert_True(DoneWithEntry == false, "DoneWithEntry == false"); - - UtAssert_True(Result == CS_ERR_NOT_FOUND, "Result == CS_ERR_NOT_FOUND"); + UtAssert_BOOL_FALSE(DoneWithEntry); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_COMPUTE_TABLES_ERR_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_ComputeTables_Test_ComputeTablesError */ -void CS_ComputeApp_Test_Nominal(void) +void CS_ComputeApp_Test_NominalApp(void) { - int32 Result; CS_Res_App_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = false; @@ -841,122 +734,141 @@ void CS_ComputeApp_Test_Nominal(void) /* Sets AppInfo.CodeSize = 5, sets AppInfo.CodeAddress = 1, AppInfo.AddressesAreValid = true, and returns * CFE_SUCCESS */ - UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppInfo), CS_COMPUTE_TEST_CFE_ES_GetAppInfoHandler1, NULL); + UT_SetHandlerFunction(UT_KEY(CFE_ES_GetModuleInfo), CS_COMPUTE_TEST_CFE_ES_GetModuleInfoHandler1, NULL); /* Set to fail condition "NewChecksumValue != ResultsEntry -> ComparisonValue" */ UT_SetDeferredRetcode(UT_KEY(CFE_ES_CalculateCRC), 1, 2); /* Execute the function being tested */ - Result = CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CFE_SUCCESS); /* Verify results */ - UtAssert_True(DoneWithEntry == true, "DoneWithEntry == true"); + UtAssert_BOOL_TRUE(DoneWithEntry); + + UtAssert_UINT32_EQ(ResultsEntry.NumBytesToChecksum, 5); + UtAssert_UINT32_EQ(ResultsEntry.StartAddress, 1); + + UtAssert_UINT32_EQ(ComputedCSValue, 2); + UtAssert_UINT32_EQ(ResultsEntry.ByteOffset, 0); + UtAssert_UINT32_EQ(ResultsEntry.TempChecksumValue, 0); + + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); + +} /* end CS_ComputeApp_Test_NominalApp */ + +void CS_ComputeApp_Test_NominalLib(void) +{ + CS_Res_App_Table_Entry_t ResultsEntry; + uint32 ComputedCSValue = 0; + bool DoneWithEntry = false; + + memset(&ResultsEntry, 0, sizeof(ResultsEntry)); + + CS_AppData.MaxBytesPerCycle = 5; + + ResultsEntry.ComputedYet = true; + + ResultsEntry.ComparisonValue = 2; + + /* Set to generate error CS_COMPUTE_APP_ERR_EID */ + UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppIDByName), 1, -1); + + /* Sets AppInfo.CodeSize = 5, sets AppInfo.CodeAddress = 1, AppInfo.AddressesAreValid = true, and returns + * CFE_SUCCESS */ + UT_SetHandlerFunction(UT_KEY(CFE_ES_GetModuleInfo), CS_COMPUTE_TEST_CFE_ES_GetModuleInfoHandler1, NULL); + + /* Set to fail condition "NewChecksumValue != ResultsEntry -> ComparisonValue" */ + UT_SetDeferredRetcode(UT_KEY(CFE_ES_CalculateCRC), 1, 2); - UtAssert_True(ResultsEntry.NumBytesToChecksum == 5, "ResultsEntry.NumBytesToChecksum == 5"); - UtAssert_True(ResultsEntry.StartAddress == 1, "ResultsEntry.StartAddress == 1"); + /* Execute the function being tested */ + UtAssert_UINT32_EQ(CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CFE_SUCCESS); - UtAssert_True(ComputedCSValue == 2, "ComputedCSValue == 2"); - UtAssert_True(ResultsEntry.ByteOffset == 0, "ResultsEntry.ByteOffset == 0"); - UtAssert_True(ResultsEntry.TempChecksumValue == 0, "ResultsEntry.TempChecksumValue == 0"); + /* Verify results */ + UtAssert_BOOL_TRUE(DoneWithEntry); - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); + UtAssert_UINT32_EQ(ResultsEntry.NumBytesToChecksum, 5); + UtAssert_UINT32_EQ(ResultsEntry.StartAddress, 1); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_UINT32_EQ(ComputedCSValue, 2); + UtAssert_UINT32_EQ(ResultsEntry.ByteOffset, 0); + UtAssert_UINT32_EQ(ResultsEntry.TempChecksumValue, 0); - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); -} /* end CS_ComputeApp_Test_Nominal */ +} /* end CS_ComputeApp_Test_NominalLib */ -void CS_ComputeApp_Test_GetAppIDByNameError(void) +void CS_ComputeApp_Test_GetAppAndLibIDByNameError(void) { - int32 Result; CS_Res_App_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = true; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&ResultsEntry, 0, sizeof(ResultsEntry)); snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, - "CS Apps: Problems getting app %%s info, GetAppID: 0x%%08X, GetAppInfo: 0x%%08X, AddressValid: %%d"); + "CS Apps: Problems getting module %%s info, GetAppID: 0x%%08X, GetModuleInfo: 0x%%08X, AddressValid: %%d"); strncpy(ResultsEntry.Name, "name", 10); /* Set to generate error CS_COMPUTE_APP_ERR_EID */ UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppIDByName), 1, -1); + /* Set to generate error CS_COMPUTE_APP_ERR_EID */ + UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetLibIDByName), 1, -1); + /* Execute the function being tested */ - Result = CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CS_ERR_NOT_FOUND); /* Verify results */ - UtAssert_True(DoneWithEntry == false, "DoneWithEntry == false"); - - UtAssert_True(Result == CS_ERR_NOT_FOUND, "Result == CS_ERR_NOT_FOUND"); + UtAssert_BOOL_FALSE(DoneWithEntry); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_COMPUTE_APP_ERR_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); -} /* end CS_ComputeApp_Test_GetAppIDByNameError */ +} /* end CS_ComputeApp_Test_GetAppAndLibIDByNameError */ -void CS_ComputeApp_Test_GetAppInfoError(void) +void CS_ComputeApp_Test_GetModuleInfoError(void) { - int32 Result; CS_Res_App_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = true; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&ResultsEntry, 0, sizeof(ResultsEntry)); snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, - "CS Apps: Problems getting app %%s info, GetAppID: 0x%%08X, GetAppInfo: 0x%%08X, AddressValid: %%d"); + "CS Apps: Problems getting module %%s info, GetAppID: 0x%%08X, GetModuleInfo: 0x%%08X, AddressValid: %%d"); strncpy(ResultsEntry.Name, "name", 10); /* Set to generate error CS_COMPUTE_APP_ERR_EID */ - UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppInfo), 1, -1); + UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetModuleInfo), 1, -1); /* Execute the function being tested */ - Result = CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CS_ERR_NOT_FOUND); /* Verify results */ - UtAssert_True(DoneWithEntry == false, "DoneWithEntry == false"); - - UtAssert_True(Result == CS_ERR_NOT_FOUND, "Result == CS_ERR_NOT_FOUND"); + UtAssert_BOOL_FALSE(DoneWithEntry); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_COMPUTE_APP_ERR_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); - -} /* end CS_ComputeApp_Test_GetAppInfoError */ +} /* end CS_ComputeApp_Test_GetModuleInfoError */ void CS_ComputeApp_Test_ComputeAppPlatformError(void) { - int32 Result; CS_Res_App_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = true; - int32 strCmpResult; char ExpectedEventString[2][CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&ResultsEntry, 0, sizeof(ResultsEntry)); @@ -965,47 +877,35 @@ void CS_ComputeApp_Test_ComputeAppPlatformError(void) "CS cannot get a valid address for %%s, due to the platform"); snprintf(ExpectedEventString[1], CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, - "CS Apps: Problems getting app %%s info, GetAppID: 0x%%08X, GetAppInfo: 0x%%08X, AddressValid: %%d"); + "CS Apps: Problems getting module %%s info, GetAppID: 0x%%08X, GetModuleInfo: 0x%%08X, AddressValid: %%d"); strncpy(ResultsEntry.Name, "name", 10); /* Sets AppInfo.AddressesAreValid = false and returns CFE_SUCCESS */ - UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppInfo), CS_COMPUTE_TEST_CFE_ES_GetAppInfoHandler2, NULL); + UT_SetHandlerFunction(UT_KEY(CFE_ES_GetModuleInfo), CS_COMPUTE_TEST_CFE_ES_GetModuleInfoHandler2, NULL); /* Execute the function being tested */ - Result = CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CS_ERR_NOT_FOUND); /* Verify results */ - UtAssert_True(DoneWithEntry == false, "DoneWithEntry == false"); - - UtAssert_True(Result == CS_ERR_NOT_FOUND, "Result == CS_ERR_NOT_FOUND"); + UtAssert_BOOL_FALSE(DoneWithEntry); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_COMPUTE_APP_PLATFORM_DBG_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_DEBUG); - strCmpResult = - strncmp(ExpectedEventString[0], context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); + UtAssert_StrnCmp(ExpectedEventString[0], context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventID, CS_COMPUTE_APP_ERR_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventType, CFE_EVS_EventType_ERROR); - strCmpResult = - strncmp(ExpectedEventString[1], context_CFE_EVS_SendEvent[1].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[1].Spec); + UtAssert_StrnCmp(ExpectedEventString[1], context_CFE_EVS_SendEvent[1].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 2, "CFE_EVS_SendEvent was called %u time(s), expected 2", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 2); } /* end CS_ComputeApp_Test_ComputeAppPlatformError */ void CS_ComputeApp_Test_DifferFromSavedValue(void) { - int32 Result; CS_Res_App_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = false; @@ -1020,32 +920,26 @@ void CS_ComputeApp_Test_DifferFromSavedValue(void) /* Sets AppInfo.CodeSize = 5, sets AppInfo.CodeAddress = 1, AppInfo.AddressesAreValid = true, and returns * CFE_SUCCESS */ - UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppInfo), CS_COMPUTE_TEST_CFE_ES_GetAppInfoHandler1, NULL); + UT_SetHandlerFunction(UT_KEY(CFE_ES_GetModuleInfo), CS_COMPUTE_TEST_CFE_ES_GetModuleInfoHandler1, NULL); /* Set to fail condition "NewChecksumValue != ResultsEntry -> ComparisonValue" */ UT_SetDeferredRetcode(UT_KEY(CFE_ES_CalculateCRC), 1, 2); /* Execute the function being tested */ - Result = CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CS_ERROR); /* Verify results */ - UtAssert_True(DoneWithEntry == true, "DoneWithEntry == true"); - - UtAssert_True(ResultsEntry.NumBytesToChecksum == 5, "ResultsEntry.NumBytesToChecksum == 5"); - UtAssert_True(ResultsEntry.StartAddress == 1, "ResultsEntry.StartAddress == 1"); - - UtAssert_True(Result == CS_ERROR, "Result == CS_ERROR"); + UtAssert_BOOL_TRUE(DoneWithEntry); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_UINT32_EQ(ResultsEntry.NumBytesToChecksum, 5); + UtAssert_UINT32_EQ(ResultsEntry.StartAddress, 1); - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end CS_ComputeApp_Test_DifferFromSavedValue */ void CS_ComputeApp_Test_FirstTimeThrough(void) { - int32 Result; CS_Res_App_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = false; @@ -1060,39 +954,33 @@ void CS_ComputeApp_Test_FirstTimeThrough(void) /* Sets AppInfo.CodeSize = 5, sets AppInfo.CodeAddress = 1, AppInfo.AddressesAreValid = true, and returns * CFE_SUCCESS */ - UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppInfo), CS_COMPUTE_TEST_CFE_ES_GetAppInfoHandler1, NULL); + UT_SetHandlerFunction(UT_KEY(CFE_ES_GetModuleInfo), CS_COMPUTE_TEST_CFE_ES_GetModuleInfoHandler1, NULL); /* Set to fail condition "NewChecksumValue != ResultsEntry -> ComparisonValue" */ UT_SetDeferredRetcode(UT_KEY(CFE_ES_CalculateCRC), 1, 2); /* Execute the function being tested */ - Result = CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CFE_SUCCESS); /* Verify results */ - UtAssert_True(DoneWithEntry == true, "DoneWithEntry == true"); + UtAssert_BOOL_TRUE(DoneWithEntry); - UtAssert_True(ResultsEntry.NumBytesToChecksum == 5, "ResultsEntry.NumBytesToChecksum == 5"); - UtAssert_True(ResultsEntry.StartAddress == 1, "ResultsEntry.StartAddress == 1"); + UtAssert_UINT32_EQ(ResultsEntry.NumBytesToChecksum, 5); + UtAssert_UINT32_EQ(ResultsEntry.StartAddress, 1); - UtAssert_True(ResultsEntry.ComputedYet == true, "ResultsEntry.ComputedYet == true"); - UtAssert_True(ResultsEntry.ComparisonValue == 2, "ResultsEntry.ComparisonValue == 2"); + UtAssert_BOOL_TRUE(ResultsEntry.ComputedYet); + UtAssert_UINT32_EQ(ResultsEntry.ComparisonValue, 2); - UtAssert_True(ComputedCSValue == 2, "ComputedCSValue == 2"); - UtAssert_True(ResultsEntry.ByteOffset == 0, "ResultsEntry.ByteOffset == 0"); - UtAssert_True(ResultsEntry.TempChecksumValue == 0, "ResultsEntry.TempChecksumValue == 0"); + UtAssert_UINT32_EQ(ComputedCSValue, 2); + UtAssert_UINT32_EQ(ResultsEntry.ByteOffset, 0); + UtAssert_UINT32_EQ(ResultsEntry.TempChecksumValue, 0); - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end CS_ComputeApp_Test_FirstTimeThrough */ void CS_ComputeApp_Test_EntryNotFinished(void) { - int32 Result; CS_Res_App_Table_Entry_t ResultsEntry; uint32 ComputedCSValue = 0; bool DoneWithEntry = true; @@ -1109,7 +997,7 @@ void CS_ComputeApp_Test_EntryNotFinished(void) /* Sets AppInfo.CodeSize = 5, sets AppInfo.CodeAddress = 1, AppInfo.AddressesAreValid = true, and returns * CFE_SUCCESS */ - UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppInfo), CS_COMPUTE_TEST_CFE_ES_GetAppInfoHandler1, NULL); + UT_SetHandlerFunction(UT_KEY(CFE_ES_GetModuleInfo), CS_COMPUTE_TEST_CFE_ES_GetModuleInfoHandler1, NULL); TblInfo.Size = 5; @@ -1121,23 +1009,18 @@ void CS_ComputeApp_Test_EntryNotFinished(void) UT_SetDeferredRetcode(UT_KEY(CFE_ES_CalculateCRC), 1, 2); /* Execute the function being tested */ - Result = CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry); + UtAssert_UINT32_EQ(CS_ComputeApp(&ResultsEntry, &ComputedCSValue, &DoneWithEntry), CFE_SUCCESS); /* Verify results */ - UtAssert_True(DoneWithEntry == false, "DoneWithEntry == false"); - - UtAssert_True(ResultsEntry.StartAddress == 1, "ResultsEntry.StartAddress == 1"); - - UtAssert_True(ResultsEntry.ByteOffset == 3, "ResultsEntry.ByteOffset == 3"); - UtAssert_True(ResultsEntry.TempChecksumValue == 2, "ResultsEntry.TempChecksumValue == 2"); - UtAssert_True(ComputedCSValue == 2, "ComputedCSValue == 2"); + UtAssert_BOOL_FALSE(DoneWithEntry); - UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); + UtAssert_UINT32_EQ(ResultsEntry.StartAddress, 1); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_UINT32_EQ(ResultsEntry.ByteOffset, 3); + UtAssert_UINT32_EQ(ResultsEntry.TempChecksumValue, 2); + UtAssert_UINT32_EQ(ComputedCSValue, 2); - UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end CS_ComputeApp_Test_EntryNotFinished */ @@ -1145,7 +1028,6 @@ void CS_RecomputeEepromMemoryChildTask_Test_EEPROMTable(void) { CS_Res_EepromMemory_Table_Entry_t RecomputeEepromMemoryEntry; CS_Def_EepromMemory_Table_Entry_t DefEepromTbl[10]; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&RecomputeEepromMemoryEntry, 0, sizeof(RecomputeEepromMemoryEntry)); @@ -1179,30 +1061,20 @@ void CS_RecomputeEepromMemoryChildTask_Test_EEPROMTable(void) CS_RecomputeEepromMemoryChildTask(); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == false, "CS_AppData.HkPacket.RecomputeInProgress == false"); - - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99, - "CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99"); - UtAssert_True(CS_AppData.DefEepromTblPtr[CS_AppData.ChildTaskEntryID].State == 1, - "CS_AppData.DefEepromTblPtr[CS_AppData.ChildTaskEntryID].State == 1"); + UtAssert_BOOL_FALSE(CS_AppData.HkPacket.RecomputeInProgress); + + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue, 0); + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset, 0); + UtAssert_BOOL_TRUE(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet); + UtAssert_UINT16_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->State, 99); + UtAssert_UINT16_EQ(CS_AppData.DefEepromTblPtr[CS_AppData.ChildTaskEntryID].State, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_RECOMPUTE_FINISH_EEPROM_MEMORY_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_RecomputeEepromMemoryChildTask_Test_EEPROMTable */ @@ -1210,7 +1082,6 @@ void CS_RecomputeEepromMemoryChildTask_Test_MemoryTable(void) { CS_Res_EepromMemory_Table_Entry_t RecomputeEepromMemoryEntry; CS_Def_EepromMemory_Table_Entry_t DefMemoryTbl[10]; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&RecomputeEepromMemoryEntry, 0, sizeof(RecomputeEepromMemoryEntry)); @@ -1244,30 +1115,20 @@ void CS_RecomputeEepromMemoryChildTask_Test_MemoryTable(void) CS_RecomputeEepromMemoryChildTask(); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == false, "CS_AppData.HkPacket.RecomputeInProgress == false"); - - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99, - "CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99"); - UtAssert_True(CS_AppData.DefMemoryTblPtr[CS_AppData.ChildTaskEntryID].State == 1, - "CS_AppData.DefMemoryTblPtr[CS_AppData.ChildTaskEntryID].State == 1"); + UtAssert_BOOL_FALSE(CS_AppData.HkPacket.RecomputeInProgress); + + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue, 0); + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset, 0); + UtAssert_BOOL_TRUE(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet); + UtAssert_UINT16_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->State, 99); + UtAssert_UINT16_EQ(CS_AppData.DefEepromTblPtr[CS_AppData.ChildTaskEntryID].State, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_RECOMPUTE_FINISH_EEPROM_MEMORY_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_RecomputeEepromMemoryChildTask_Test_MemoryTable */ @@ -1275,7 +1136,6 @@ void CS_RecomputeEepromMemoryChildTask_Test_CFECore(void) { CS_Res_EepromMemory_Table_Entry_t RecomputeEepromMemoryEntry; CS_Def_EepromMemory_Table_Entry_t DefMemoryTbl[10]; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&RecomputeEepromMemoryEntry, 0, sizeof(RecomputeEepromMemoryEntry)); @@ -1309,32 +1169,22 @@ void CS_RecomputeEepromMemoryChildTask_Test_CFECore(void) CS_RecomputeEepromMemoryChildTask(); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == false, "CS_AppData.HkPacket.RecomputeInProgress == false"); - - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99, - "CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99"); - UtAssert_True(CS_AppData.DefMemoryTblPtr[CS_AppData.ChildTaskEntryID].State == 1, - "CS_AppData.DefMemoryTblPtr[CS_AppData.ChildTaskEntryID].State == 1"); + UtAssert_BOOL_FALSE(CS_AppData.HkPacket.RecomputeInProgress); + + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue, 0); + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset, 0); + UtAssert_BOOL_TRUE(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet); + UtAssert_UINT16_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->State, 99); + UtAssert_UINT16_EQ(CS_AppData.DefEepromTblPtr[CS_AppData.ChildTaskEntryID].State, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_RECOMPUTE_FINISH_EEPROM_MEMORY_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - UtAssert_True(CS_AppData.HkPacket.CfeCoreBaseline == 1, "CS_AppData.HkPacket.CfeCoreBaseline == 1"); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_UINT32_EQ(CS_AppData.HkPacket.CfeCoreBaseline, 1); - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_RecomputeEepromMemoryChildTask_Test_CFECore */ @@ -1342,7 +1192,6 @@ void CS_RecomputeEepromMemoryChildTask_Test_OSCore(void) { CS_Res_EepromMemory_Table_Entry_t RecomputeEepromMemoryEntry; CS_Def_EepromMemory_Table_Entry_t DefMemoryTbl[10]; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&RecomputeEepromMemoryEntry, 0, sizeof(RecomputeEepromMemoryEntry)); @@ -1376,32 +1225,22 @@ void CS_RecomputeEepromMemoryChildTask_Test_OSCore(void) CS_RecomputeEepromMemoryChildTask(); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == false, "CS_AppData.HkPacket.RecomputeInProgress == false"); - - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99, - "CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99"); - UtAssert_True(CS_AppData.DefMemoryTblPtr[CS_AppData.ChildTaskEntryID].State == 1, - "CS_AppData.DefMemoryTblPtr[CS_AppData.ChildTaskEntryID].State == 1"); + UtAssert_BOOL_FALSE(CS_AppData.HkPacket.RecomputeInProgress); + + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue, 0); + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset, 0); + UtAssert_BOOL_TRUE(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet); + UtAssert_UINT16_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->State, 99); + UtAssert_UINT16_EQ(CS_AppData.DefEepromTblPtr[CS_AppData.ChildTaskEntryID].State, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_RECOMPUTE_FINISH_EEPROM_MEMORY_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - UtAssert_True(CS_AppData.HkPacket.OSBaseline == 1, "CS_AppData.HkPacket.OSBaseline == 1"); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_UINT32_EQ(CS_AppData.HkPacket.OSBaseline, 1); - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_RecomputeEepromMemoryChildTask_Test_OSCore */ @@ -1409,7 +1248,6 @@ void CS_RecomputeEepromMemoryChildTask_Test_EEPROMTableEntryId(void) { CS_Res_EepromMemory_Table_Entry_t RecomputeEepromMemoryEntry; CS_Def_EepromMemory_Table_Entry_t DefEepromTbl[10]; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&RecomputeEepromMemoryEntry, 0, sizeof(RecomputeEepromMemoryEntry)); @@ -1443,28 +1281,19 @@ void CS_RecomputeEepromMemoryChildTask_Test_EEPROMTableEntryId(void) CS_RecomputeEepromMemoryChildTask(); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == false, "CS_AppData.HkPacket.RecomputeInProgress == false"); + UtAssert_BOOL_FALSE(CS_AppData.HkPacket.RecomputeInProgress); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99, - "CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99"); + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue, 0); + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset, 0); + UtAssert_BOOL_TRUE(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet); + UtAssert_UINT16_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->State, 99); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_RECOMPUTE_FINISH_EEPROM_MEMORY_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_RecomputeEepromMemoryChildTask_Test_EEPROMTableEntryId */ @@ -1472,7 +1301,6 @@ void CS_RecomputeEepromMemoryChildTask_Test_EEPROMTableStartAddress(void) { CS_Res_EepromMemory_Table_Entry_t RecomputeEepromMemoryEntry; CS_Def_EepromMemory_Table_Entry_t DefEepromTbl[10]; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&RecomputeEepromMemoryEntry, 0, sizeof(RecomputeEepromMemoryEntry)); @@ -1506,30 +1334,20 @@ void CS_RecomputeEepromMemoryChildTask_Test_EEPROMTableStartAddress(void) CS_RecomputeEepromMemoryChildTask(); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == false, "CS_AppData.HkPacket.RecomputeInProgress == false"); - - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99, - "CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99"); - UtAssert_True(CS_AppData.DefEepromTblPtr[CS_AppData.ChildTaskEntryID].State == 1, - "CS_AppData.DefEepromTblPtr[CS_AppData.ChildTaskEntryID].State == 1"); + UtAssert_BOOL_FALSE(CS_AppData.HkPacket.RecomputeInProgress); + + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue, 0); + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset, 0); + UtAssert_BOOL_TRUE(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet); + UtAssert_UINT16_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->State, 99); + UtAssert_UINT16_EQ(CS_AppData.DefEepromTblPtr[CS_AppData.ChildTaskEntryID].State, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_RECOMPUTE_FINISH_EEPROM_MEMORY_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_RecomputeEepromMemoryChildTask_Test_EEPROMTableStartAddress */ @@ -1537,7 +1355,6 @@ void CS_RecomputeEepromMemoryChildTask_Test_EEPROMTableState(void) { CS_Res_EepromMemory_Table_Entry_t RecomputeEepromMemoryEntry; CS_Def_EepromMemory_Table_Entry_t DefEepromTbl[10]; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&RecomputeEepromMemoryEntry, 0, sizeof(RecomputeEepromMemoryEntry)); @@ -1571,30 +1388,20 @@ void CS_RecomputeEepromMemoryChildTask_Test_EEPROMTableState(void) CS_RecomputeEepromMemoryChildTask(); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == false, "CS_AppData.HkPacket.RecomputeInProgress == false"); - - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset == 0"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true, - "CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet == true"); - UtAssert_True(CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99, - "CS_AppData.RecomputeEepromMemoryEntryPtr->State == 99"); - UtAssert_True(CS_AppData.DefEepromTblPtr[CS_AppData.ChildTaskEntryID].State == CS_STATE_EMPTY, - "CS_AppData.DefEepromTblPtr[CS_AppData.ChildTaskEntryID].State == CS_STATE_EMPTY"); + UtAssert_BOOL_FALSE(CS_AppData.HkPacket.RecomputeInProgress); + + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->TempChecksumValue, 0); + UtAssert_UINT32_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->ByteOffset, 0); + UtAssert_BOOL_TRUE(CS_AppData.RecomputeEepromMemoryEntryPtr->ComputedYet); + UtAssert_UINT16_EQ(CS_AppData.RecomputeEepromMemoryEntryPtr->State, 99); + UtAssert_UINT16_EQ(CS_AppData.DefEepromTblPtr[CS_AppData.ChildTaskEntryID].State, CS_STATE_EMPTY); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_RECOMPUTE_FINISH_EEPROM_MEMORY_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_RecomputeEepromMemoryChildTask_Test_EEPROMTableState */ @@ -1602,7 +1409,6 @@ void CS_RecomputeAppChildTask_Test_Nominal(void) { CS_Res_App_Table_Entry_t RecomputeAppEntry; CS_Def_App_Table_Entry_t DefAppTbl[10]; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&RecomputeAppEntry, 0, sizeof(RecomputeAppEntry)); @@ -1633,34 +1439,26 @@ void CS_RecomputeAppChildTask_Test_Nominal(void) /* Sets AppInfo.CodeSize = 5, sets AppInfo.CodeAddress = 1, AppInfo.AddressesAreValid = true, and returns * CFE_SUCCESS */ - UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppInfo), CS_COMPUTE_TEST_CFE_ES_GetAppInfoHandler1, NULL); + UT_SetHandlerFunction(UT_KEY(CFE_ES_GetModuleInfo), CS_COMPUTE_TEST_CFE_ES_GetModuleInfoHandler1, NULL); /* Execute the function being tested */ CS_RecomputeAppChildTask(); /* Verify results */ - UtAssert_True(CS_AppData.RecomputeAppEntryPtr->State == 99, "CS_AppData.RecomputeAppEntryPtr->State == 99"); - UtAssert_True(CS_AppData.DefAppTblPtr[CS_AppData.ChildTaskEntryID].State == 1, - "CS_AppData.DefAppTblPtr[CS_AppData.ChildTaskEntryID].State == 1"); - UtAssert_True(CS_AppData.RecomputeAppEntryPtr->TempChecksumValue == 0, - "CS_AppData.RecomputeAppEntryPtr->TempChecksumValue == 0"); - UtAssert_True(CS_AppData.RecomputeAppEntryPtr->ByteOffset == 0, "CS_AppData.RecomputeAppEntryPtr->ByteOffset == 0"); - UtAssert_True(CS_AppData.RecomputeAppEntryPtr->ComputedYet == true, - "CS_AppData.RecomputeAppEntryPtr->ComputedYet == true"); + UtAssert_UINT16_EQ(CS_AppData.RecomputeAppEntryPtr->State, 99); + UtAssert_UINT16_EQ(CS_AppData.DefAppTblPtr[CS_AppData.ChildTaskEntryID].State, 1); + UtAssert_UINT32_EQ(CS_AppData.RecomputeAppEntryPtr->TempChecksumValue, 0); + UtAssert_UINT32_EQ(CS_AppData.RecomputeAppEntryPtr->ByteOffset, 0); + UtAssert_BOOL_TRUE(CS_AppData.RecomputeAppEntryPtr->ComputedYet); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_RECOMPUTE_FINISH_APP_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == false, "CS_AppData.HkPacket.RecomputeInProgress == false"); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_BOOL_FALSE(CS_AppData.HkPacket.RecomputeInProgress); - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_RecomputeAppChildTask_Test_Nominal */ @@ -1689,10 +1487,11 @@ void CS_RecomputeAppChildTask_Test_CouldNotGetAddress(void) /* Set to cause CS_ComputeApp to return CS_ERR_NOT_FOUND */ UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppIDByName), 1, -1); + UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetLibIDByName), 1, -1); /* Sets AppInfo.CodeSize = 5, sets AppInfo.CodeAddress = 1, AppInfo.AddressesAreValid = true, and returns * CFE_SUCCESS */ - UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppInfo), CS_COMPUTE_TEST_CFE_ES_GetAppInfoHandler1, NULL); + UT_SetHandlerFunction(UT_KEY(CFE_ES_GetModuleInfo), CS_COMPUTE_TEST_CFE_ES_GetModuleInfoHandler1, NULL); /* Execute the function being tested */ CS_RecomputeAppChildTask(); @@ -1718,7 +1517,6 @@ void CS_RecomputeAppChildTask_Test_DefEntryId(void) { CS_Res_App_Table_Entry_t RecomputeAppEntry; CS_Def_App_Table_Entry_t DefAppTbl[10]; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&RecomputeAppEntry, 0, sizeof(RecomputeAppEntry)); @@ -1748,7 +1546,7 @@ void CS_RecomputeAppChildTask_Test_DefEntryId(void) /* Sets AppInfo.CodeSize = 5, sets AppInfo.CodeAddress = 1, AppInfo.AddressesAreValid = true, and returns * CFE_SUCCESS */ - UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppInfo), CS_COMPUTE_TEST_CFE_ES_GetAppInfoHandler1, NULL); + UT_SetHandlerFunction(UT_KEY(CFE_ES_GetAppInfo), CS_COMPUTE_TEST_CFE_ES_GetModuleInfoHandler1, NULL); /* Execute the function being tested */ CS_RecomputeAppChildTask(); @@ -1763,16 +1561,11 @@ void CS_RecomputeAppChildTask_Test_DefEntryId(void) UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_RECOMPUTE_FINISH_APP_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == false, "CS_AppData.HkPacket.RecomputeInProgress == false"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_BOOL_FALSE(CS_AppData.HkPacket.RecomputeInProgress); - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_RecomputeAppChildTask_Test_DefEntryId */ @@ -1781,7 +1574,6 @@ void CS_RecomputeTablesChildTask_Test_Nominal(void) CS_Res_Tables_Table_Entry_t RecomputeTablesEntry; CS_Def_Tables_Table_Entry_t DefTablesTbl[10]; CFE_TBL_Info_t TblInfo; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&RecomputeTablesEntry, 0, sizeof(RecomputeTablesEntry)); @@ -1835,29 +1627,20 @@ void CS_RecomputeTablesChildTask_Test_Nominal(void) CS_RecomputeTablesChildTask(); /* Verify results */ - UtAssert_True(CS_AppData.RecomputeTablesEntryPtr->State == 99, "CS_AppData.RecomputeTablesEntryPtr->State == 99"); - UtAssert_True(CS_AppData.DefTablesTblPtr[CS_AppData.ChildTaskEntryID].State == 1, - "CS_AppData.DefTablesTblPtr[CS_AppData.ChildTaskEntryID].State == 1"); - UtAssert_True(CS_AppData.RecomputeTablesEntryPtr->TempChecksumValue == 0, - "CS_AppData.RecomputeTablesEntryPtr->TempChecksumValue == 0"); - UtAssert_True(CS_AppData.RecomputeTablesEntryPtr->ByteOffset == 0, - "CS_AppData.RecomputeTablesEntryPtr->ByteOffset == 0"); - UtAssert_True(CS_AppData.RecomputeTablesEntryPtr->ComputedYet == true, - "CS_AppData.RecomputeTablesEntryPtr->ComputedYet == true"); + UtAssert_UINT16_EQ(CS_AppData.RecomputeAppEntryPtr->State, 99); + UtAssert_UINT16_EQ(CS_AppData.DefAppTblPtr[CS_AppData.ChildTaskEntryID].State, 1); + UtAssert_UINT32_EQ(CS_AppData.RecomputeAppEntryPtr->TempChecksumValue, 0); + UtAssert_UINT32_EQ(CS_AppData.RecomputeAppEntryPtr->ByteOffset, 0); + UtAssert_BOOL_TRUE(CS_AppData.RecomputeAppEntryPtr->ComputedYet); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_RECOMPUTE_FINISH_TABLES_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == false, "CS_AppData.ChildTaskInUse == false"); - - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_BOOL_FALSE(CS_AppData.HkPacket.RecomputeInProgress); - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_RecomputeTablesChildTask_Test_Nominal */ @@ -1914,7 +1697,6 @@ void CS_RecomputeTablesChildTask_Test_DefEntryId(void) CS_Res_Tables_Table_Entry_t RecomputeTablesEntry; CS_Def_Tables_Table_Entry_t DefTablesTbl[10]; CFE_TBL_Info_t TblInfo; - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; memset(&RecomputeTablesEntry, 0, sizeof(RecomputeTablesEntry)); @@ -1976,22 +1758,16 @@ void CS_RecomputeTablesChildTask_Test_DefEntryId(void) UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_RECOMPUTE_FINISH_TABLES_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); - - UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == false, "CS_AppData.ChildTaskInUse == false"); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); + UtAssert_BOOL_FALSE(CS_AppData.HkPacket.RecomputeInProgress); - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_RecomputeTablesChildTask_Test_DefEntryId*/ void CS_OneShotChildTask_Test_Nominal(void) { - int32 strCmpResult; char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, @@ -2009,23 +1785,18 @@ void CS_OneShotChildTask_Test_Nominal(void) CS_OneShotChildTask(); /* Verify results */ - UtAssert_True(CS_AppData.HkPacket.LastOneShotChecksum == 1, "CS_AppData.HkPacket.LastOneShotChecksum == 1"); + UtAssert_UINT32_EQ(CS_AppData.HkPacket.LastOneShotChecksum, 1); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_ONESHOT_FINISHED_INF_EID); UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION); - strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - - UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); + UtAssert_StrnCmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH); - UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == false, "CS_AppData.HkPacket.RecomputeInProgress == false"); - UtAssert_True(CS_AppData.HkPacket.OneShotInProgress == false, "CS_AppData.HkPacket.OneShotInProgress == false"); + UtAssert_BOOL_FALSE(CS_AppData.HkPacket.RecomputeInProgress); + UtAssert_BOOL_FALSE(CS_AppData.HkPacket.OneShotInProgress); UtAssert_BOOL_FALSE(CFE_RESOURCEID_TEST_DEFINED(CS_AppData.ChildTaskID)); - call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); - - UtAssert_True(call_count_CFE_EVS_SendEvent == 1, "CFE_EVS_SendEvent was called %u time(s), expected 1", - call_count_CFE_EVS_SendEvent); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); } /* end CS_OneShotChildTask_Test_Nominal */ @@ -2061,11 +1832,12 @@ void UtTest_Setup(void) UtTest_Add(CS_ComputeTables_Test_ComputeTablesError, CS_Test_Setup, CS_Test_TearDown, "CS_ComputeTables_Test_ComputeTablesError"); - UtTest_Add(CS_ComputeApp_Test_Nominal, CS_Test_Setup, CS_Test_TearDown, "CS_ComputeApp_Test_Nominal"); - UtTest_Add(CS_ComputeApp_Test_GetAppIDByNameError, CS_Test_Setup, CS_Test_TearDown, - "CS_ComputeApp_Test_GetAppIDByNameError"); - UtTest_Add(CS_ComputeApp_Test_GetAppInfoError, CS_Test_Setup, CS_Test_TearDown, - "CS_ComputeApp_Test_GetAppInfoError"); + UtTest_Add(CS_ComputeApp_Test_NominalApp, CS_Test_Setup, CS_Test_TearDown, "CS_ComputeApp_Test_NominalApp"); + UtTest_Add(CS_ComputeApp_Test_NominalLib, CS_Test_Setup, CS_Test_TearDown, "CS_ComputeApp_Test_NominalLib"); + UtTest_Add(CS_ComputeApp_Test_GetAppAndLibIDByNameError, CS_Test_Setup, CS_Test_TearDown, + "CS_ComputeApp_Test_GetAppAndLibIDByNameError"); + UtTest_Add(CS_ComputeApp_Test_GetModuleInfoError, CS_Test_Setup, CS_Test_TearDown, + "CS_ComputeApp_Test_GetModuleInfoError"); UtTest_Add(CS_ComputeApp_Test_ComputeAppPlatformError, CS_Test_Setup, CS_Test_TearDown, "CS_ComputeApp_Test_ComputeAppPlatformError"); UtTest_Add(CS_ComputeApp_Test_DifferFromSavedValue, CS_Test_Setup, CS_Test_TearDown,