diff --git a/unit-test/fm_dispatch_tests.c b/unit-test/fm_dispatch_tests.c index 466e76b..0e19861 100644 --- a/unit-test/fm_dispatch_tests.c +++ b/unit-test/fm_dispatch_tests.c @@ -57,8 +57,11 @@ void Test_FM_ProcessCmd_NoopCmdCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_NOOP_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_NoopCmd_t); @@ -66,7 +69,7 @@ void Test_FM_ProcessCmd_NoopCmdCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_NoopCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -79,8 +82,11 @@ void Test_FM_ProcessCmd_ResetCountersCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_RESET_COUNTERS_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_ResetCountersCmd_t); @@ -88,7 +94,7 @@ void Test_FM_ProcessCmd_ResetCountersCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_ResetCountersCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -101,8 +107,11 @@ void Test_FM_ProcessCmd_CopyFileCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_COPY_FILE_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_CopyFileCmd_t); @@ -110,7 +119,7 @@ void Test_FM_ProcessCmd_CopyFileCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_CopyFileCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -123,8 +132,11 @@ void Test_FM_ProcessCmd_MoveFileCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_MOVE_FILE_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_MoveFileCmd_t); @@ -132,7 +144,7 @@ void Test_FM_ProcessCmd_MoveFileCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_MoveFileCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -145,8 +157,11 @@ void Test_FM_ProcessCmd_RenameFileCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_RENAME_FILE_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_RenameFileCmd_t); @@ -154,7 +169,7 @@ void Test_FM_ProcessCmd_RenameFileCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_RenameFileCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -167,8 +182,11 @@ void Test_FM_ProcessCmd_DeleteFileCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_DELETE_FILE_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_DeleteFileCmd_t); @@ -176,7 +194,7 @@ void Test_FM_ProcessCmd_DeleteFileCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_DeleteFileCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -189,8 +207,11 @@ void Test_FM_ProcessCmd_DeleteAllFilesCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_DELETE_ALL_FILES_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_DeleteAllFilesCmd_t); @@ -198,7 +219,7 @@ void Test_FM_ProcessCmd_DeleteAllFilesCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_DeleteAllFilesCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -211,8 +232,11 @@ void Test_FM_ProcessCmd_DecompressFileCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_DECOMPRESS_FILE_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_DecompressFileCmd_t); @@ -220,7 +244,7 @@ void Test_FM_ProcessCmd_DecompressFileCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_DecompressFileCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -233,8 +257,11 @@ void Test_FM_ProcessCmd_ConcatFilesCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_CONCAT_FILES_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_ConcatFilesCmd_t); @@ -242,7 +269,7 @@ void Test_FM_ProcessCmd_ConcatFilesCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_ConcatFilesCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -255,8 +282,11 @@ void Test_FM_ProcessCmd_GetFileInfoCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_GET_FILE_INFO_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_GetFileInfoCmd_t); @@ -264,7 +294,7 @@ void Test_FM_ProcessCmd_GetFileInfoCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_GetFileInfoCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -277,8 +307,11 @@ void Test_FM_ProcessCmd_GetOpenFilesCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_GET_OPEN_FILES_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_GetOpenFilesCmd_t); @@ -286,7 +319,7 @@ void Test_FM_ProcessCmd_GetOpenFilesCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_GetOpenFilesCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -299,8 +332,11 @@ void Test_FM_ProcessCmd_CreateDirectoryCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_CREATE_DIRECTORY_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_CreateDirectoryCmd_t); @@ -308,7 +344,7 @@ void Test_FM_ProcessCmd_CreateDirectoryCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_CreateDirectoryCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -321,8 +357,11 @@ void Test_FM_ProcessCmd_DeleteDirectoryCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_DELETE_DIRECTORY_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_DeleteDirectoryCmd_t); @@ -330,7 +369,7 @@ void Test_FM_ProcessCmd_DeleteDirectoryCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_DeleteDirectoryCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -343,8 +382,11 @@ void Test_FM_ProcessCmd_GetDirListFileCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_GET_DIR_LIST_FILE_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_GetDirListFileCmd_t); @@ -352,7 +394,7 @@ void Test_FM_ProcessCmd_GetDirListFileCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListFileCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -365,8 +407,11 @@ void Test_FM_ProcessCmd_GetDirListPktCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_GET_DIR_LIST_PKT_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_GetDirListPktCmd_t); @@ -374,7 +419,7 @@ void Test_FM_ProcessCmd_GetDirListPktCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListPktCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -387,8 +432,11 @@ void Test_FM_ProcessCmd_MonitorFilesystemSpaceCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_MONITOR_FILESYSTEM_SPACE_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_MonitorFilesystemSpaceCmd_t); @@ -396,7 +444,7 @@ void Test_FM_ProcessCmd_MonitorFilesystemSpaceCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_MonitorFilesystemSpaceCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -409,8 +457,11 @@ void Test_FM_ProcessCmd_SetTableStateCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_SET_TABLE_STATE_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_SetTableStateCmd_t); @@ -418,7 +469,7 @@ void Test_FM_ProcessCmd_SetTableStateCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_SetTableStateCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -431,8 +482,11 @@ void Test_FM_ProcessCmd_SetPermissionsCCReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + fcn_code = FM_SET_PERMISSIONS_CC; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); length = sizeof(FM_SetPermissionsCmd_t); @@ -440,7 +494,7 @@ void Test_FM_ProcessCmd_SetPermissionsCCReturn(void) UT_SetDefaultReturnValue(UT_KEY(FM_SetPermissionsCmd), true); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -453,12 +507,15 @@ void Test_FM_ProcessCmd_DefaultReturn(void) { /* Arrange */ CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; + + memset(&utbuf, 0, sizeof(utbuf)); fcn_code = -1; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); /* Act */ - UtAssert_VOIDCALL(FM_ProcessCmd(NULL)); + UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); @@ -535,8 +592,11 @@ void Test_FM_ProcessPkt_CheckMessageReturnHKRequest(void) /* Arrange */ CFE_SB_MsgId_t msgid = CFE_SB_ValueToMsgId(FM_SEND_HK_MID); CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; size_t length; + memset(&utbuf, 0, sizeof(utbuf)); + msgid = CFE_SB_ValueToMsgId(FM_SEND_HK_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &msgid, sizeof(msgid), false); fcn_code = 0; @@ -545,7 +605,7 @@ void Test_FM_ProcessPkt_CheckMessageReturnHKRequest(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false); /* Act */ - UtAssert_VOIDCALL(FM_ProcessPkt(NULL)); + UtAssert_VOIDCALL(FM_ProcessPkt(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); @@ -556,13 +616,16 @@ void Test_FM_ProcessPkt_CheckMessageReturnGroundCommand(void) /* Arrange */ CFE_SB_MsgId_t msgid = CFE_SB_ValueToMsgId(FM_CMD_MID); CFE_MSG_FcnCode_t fcn_code; + CFE_SB_Buffer_t utbuf; + + memset(&utbuf, 0, sizeof(utbuf)); fcn_code = -1; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &msgid, sizeof(msgid), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false); /* Act */ - UtAssert_VOIDCALL(FM_ProcessPkt(NULL)); + UtAssert_VOIDCALL(FM_ProcessPkt(&utbuf)); /* Assert */ UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 1); @@ -576,11 +639,14 @@ void Test_FM_ProcessPkt_CheckDefaultSwitchMessage(void) { /* Arrange */ CFE_SB_MsgId_t msgid = CFE_SB_INVALID_MSG_ID; + CFE_SB_Buffer_t utbuf; + + memset(&utbuf, 0, sizeof(utbuf)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &msgid, sizeof(msgid), false); /* Act */ - UtAssert_VOIDCALL(FM_ProcessPkt(NULL)); + UtAssert_VOIDCALL(FM_ProcessPkt(&utbuf)); /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);