Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #115, Clean up minor bugs in the CS unit tests #116

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fsw/src/cs_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void CS_ZeroAppTempValues(void)

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* CS Zero out the temp chcksum values ofthe cFE core */
/* CS Zero out the temp chcksum values of the cFE core */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_ZeroCfeCoreTempValues(void)
Expand Down
24 changes: 6 additions & 18 deletions unit-test/cs_app_cmds_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ void CS_EnableAppCmd_Test(void)

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

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",
Expand Down Expand Up @@ -254,8 +252,6 @@ void CS_ReportBaselineAppCmd_Test_NoBaseline(void)

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

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",
Expand Down Expand Up @@ -315,12 +311,13 @@ void CS_ReportBaselineAppCmd_Test_OneShot(void)

UT_SetDeferredRetcode(UT_KEY(CS_VerifyCmdLength), 1, true);

/* Execute the function being tested */
CS_RecomputeBaselineAppCmd(&CmdPacket);
UT_SetDeferredRetcode(UT_KEY(CS_GetAppResTblEntryByName), 1, true);
UT_SetHandlerFunction(UT_KEY(CS_GetAppResTblEntryByName), CS_APP_CMDS_TEST_CS_GetAppResTblEntryByNameHandler1,
NULL);

/* Execute the function being tested */
CS_RecomputeBaselineAppCmd(&CmdPacket);

/* Verify results */
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_RECOMPUTE_APP_CHDTASK_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
Expand Down Expand Up @@ -377,8 +374,6 @@ void CS_RecomputeBaselineAppCmd_Test_Nominal(void)

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

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",
Expand Down Expand Up @@ -487,12 +482,13 @@ void CS_RecomputeBaselineAppCmd_Test_RecomputeInProgress(void)

UT_SetDeferredRetcode(UT_KEY(CS_VerifyCmdLength), 1, true);

/* Execute the function being tested */
CS_RecomputeBaselineAppCmd(&CmdPacket);
UT_SetDeferredRetcode(UT_KEY(CS_GetAppResTblEntryByName), 1, true);
UT_SetHandlerFunction(UT_KEY(CS_GetAppResTblEntryByName), CS_APP_CMDS_TEST_CS_GetAppResTblEntryByNameHandler1,
NULL);

/* Execute the function being tested */
CS_RecomputeBaselineAppCmd(&CmdPacket);

/* Verify results */
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, CS_RECOMPUTE_APP_CHDTASK_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
Expand Down Expand Up @@ -549,8 +545,6 @@ void CS_DisableNameAppCmd_Test_Nominal(void)

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

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",
Expand Down Expand Up @@ -605,8 +599,6 @@ void CS_DisableNameAppCmd_Test_UpdateAppsDefinitionTableError(void)

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

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",
Expand Down Expand Up @@ -711,8 +703,6 @@ void CS_EnableNameAppCmd_Test_Nominal(void)

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

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",
Expand Down Expand Up @@ -767,8 +757,6 @@ void CS_EnableNameAppCmd_Test_UpdateAppsDefinitionTableError(void)

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

UtAssert_True(CS_AppData.HkPacket.Payload.CmdCounter == 1, "CS_AppData.HkPacket.Payload.CmdCounter == 1");

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",
Expand Down
3 changes: 0 additions & 3 deletions unit-test/cs_app_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,6 @@ void CS_AppMain_Test_RcvNullBufPtr(void)
/* Set to make CS_AppPipe return -1 */
UT_SetDeferredRetcode(UT_KEY(CS_HandleRoutineTableUpdates), 1, -1);

/* Set to satisfy subsequent condition "BufPtr == NULL" */
UT_SetDataBuffer(UT_KEY(CFE_SB_ReceiveBuffer), Packet, sizeof(CS_NoArgsCmd_t), false);

/* Execute the function being tested */
CS_AppMain();

Expand Down
Loading