-
Notifications
You must be signed in to change notification settings - Fork 30
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 #29, Fix #14, update code coverage, #34
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Just a couple minor requested changes.
unit-test/ds_cmds_tests.c
Outdated
int32 strCmpResult; | ||
char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove (along with noted sections below). Checking a constant event string adds very little value. Checking the Event ID is sufficient and easier to maintain.
unit-test/ds_cmds_tests.c
Outdated
size_t forced_Size = sizeof(DS_CloseAllCmd_t); | ||
|
||
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &forced_Size, sizeof(forced_Size), false); | ||
snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "DEST CLOSE ALL command"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
unit-test/ds_cmds_tests.c
Outdated
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
unit-test/ds_cmds_tests.c
Outdated
UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec); | ||
|
||
/* Verify command struct size minus header is at least explicitly padded to 32-bit boundaries */ | ||
UtAssert_True(CMD_STRUCT_DATA_IS_32_ALIGNED(DS_CloseAllCmd_t), "DS_CloseAllCmd_t is 32-bit aligned"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid ever using UtAssert_True. UtAssert_BOOL_TRUE is the preferred macro.
unit-test/ds_file_tests.c
Outdated
UtAssert_True(DS_AppData.FileStatus[FileIndex].FileAge == 0, "DS_AppData.FileStatus[FileIndex].FileAge == 0"); | ||
UtAssert_True(DS_AppData.FileStatus[FileIndex].FileSize == 0, "DS_AppData.FileStatus[FileIndex].FileSize == 0"); | ||
UtAssert_True(DS_AppData.FileStatus[FileIndex].FileName[0] == 0, | ||
"DS_AppData.FileStatus[FileIndex].FileName[0] == 0"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could be UtAssert_UINT32_EQ
Removes comments about DS_AppProcessHK_Test_SnprintfFail, Adds DS_CmdCloseAll_Test_CloseAll, Adds coverage of null filename with no "/" to DS_FileCloseDest Adds coverage of !OS_ObjectDefined 2nd check in DS_FileSetupWrite() Adds coverage of StringTerminator branch in DS_FileCreateDest_Test() Adds coverage of MaxPathnameLength branch in DS_FileCreatName_Test() Adds PathBaseSeqTooLarge in DS_FileCreatName_Test() Adds PathBaseSeqExtTooLarge in DS_FileCreatName_Test() Adds ExtensionZero in DS_FileCreatName_Test() Adds UtAssert fixes according to PR review
Removes comments about DS_AppProcessHK_Test_SnprintfFail,
Adds DS_CmdCloseAll_Test_CloseAll,
Adds coverage of null filename with no "/" to DS_FileCloseDest
Adds coverage of !OS_ObjectDefined 2nd check in DS_FileSetupWrite()
Adds coverage of StringTerminator branch in DS_FileCreateDest_Test()
Adds coverage of MaxPathnameLength branch in DS_FileCreatName_Test()
Adds PathBaseSeqTooLarge in DS_FileCreatName_Test()
Adds PathBaseSeqExtTooLarge in DS_FileCreatName_Test()
Adds ExtensionZero in DS_FileCreatName_Test()
Checklist (Please check before submitting)
Describe the contribution
A clear and concise description of what the contribution is.
Testing performed
Expected behavior changes
100% code coverage
System(s) tested on
Ubuntu 18.04
Additional context
100% coverage depends on the resolution of #32
Afterwards, .github/workflows/unit-test-coverage.yml will need to be updated in this pull request to account for no missing branch coverage.
Third party code
If included, identify any third party code and provide text file of license
Contributor Info - All information REQUIRED for consideration of pull request
Justin Figueroa, ASRC Federal