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 #199, Add test for missing branch in SAMPLE_APP_Process() #200

Merged
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
26 changes: 24 additions & 2 deletions unit-test/coveragetest/coveragetest_sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,13 @@ void Test_SAMPLE_APP_ProcessCC(void)
UT_SetDataBuffer(UT_KEY(CFE_TBL_GetAddress), &TblPtr, sizeof(TblPtr), false);
UtAssert_INT32_EQ(SAMPLE_APP_Process(&TestMsg), CFE_SUCCESS);

/*
* Successful operation results in two calls to CFE_ES_WriteToSysLog() - one
* in this function reporting the table values, and one through
* SAMPLE_APP_GetCrc().
*/
UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 2);

/*
* Confirm that the CFE_TBL_GetAddress() call was done
*/
Expand All @@ -505,11 +512,26 @@ void Test_SAMPLE_APP_ProcessCC(void)
UtAssert_STUB_COUNT(SAMPLE_LIB_Function, 1);

/*
* Configure the CFE_TBL_GetAddress function to return an error
* Exercise the error return path
* Configure the CFE_TBL_GetAddress function to return an error.
* Exercise the error return path.
* Error at this point should add only one additional call to
* CFE_ES_WriteToSysLog() through the CFE_TBL_GetAddress() error path.
*/
UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_TBL_ERR_UNREGISTERED);
UtAssert_INT32_EQ(SAMPLE_APP_Process(&TestMsg), CFE_TBL_ERR_UNREGISTERED);
UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 3);

/*
* Configure CFE_TBL_ReleaseAddress() to return an error, exercising the
* error return path.
* Confirm three additional calls to CFE_ES_WriteToSysLog() - one
* reporting the table values, one through SAMPLE_APP_GetCrc() and one
* through the CFE_TBL_ReleaseAddress() error path.
*/
UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_SUCCESS);
UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_ReleaseAddress), CFE_TBL_ERR_NO_ACCESS);
UtAssert_INT32_EQ(SAMPLE_APP_Process(&TestMsg), CFE_TBL_ERR_NO_ACCESS);
UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 6);
}

void Test_SAMPLE_APP_VerifyCmdLength(void)
Expand Down