Skip to content

Implement 100% branch coverage with return verification #791

@skliper

Description

@skliper

Is your feature request related to a problem? Please describe.
See OS_ConsoleAPI_Init test, called once with no return checking... doesn't meet expectations for coverage (current minimum goal is all lines, all branches). Note future standards may require MC/DC.

void Test_OS_ConsoleAPI_Init(void)
{
/*
* Test Case For:
* int32 OS_ConsoleAPI_Init(void)
*/
uint32 CallCount = 0;
OS_object_token_t token;
/* make a custom token to force use of array index 0 */
token.lock_mode = OS_LOCK_MODE_NONE;
token.obj_type = OS_OBJECT_TYPE_OS_CONSOLE;
token.obj_idx = UT_INDEX_0;
token.obj_id = UT_OBJID_1;
UT_SetDataBuffer(UT_KEY(OS_ObjectIdAllocateNew), &token, sizeof(token), false);
/* call for coverage */
OS_ConsoleAPI_Init();
CallCount = UT_GetStubCount(UT_KEY(OS_ConsoleCreate_Impl));
UtAssert_True(CallCount == 1, "OS_ConsoleCreate_Impl() call count (%lu) == 1", (unsigned long)CallCount);
}

Describe the solution you'd like
Add full branch coverage to unit tests

Describe alternatives you've considered
Add MC/DC coverage to unit tests

Additional context
#790, #792

Requester Info
Jacob Hageman - NASA/GSFC

Metadata

Metadata

Assignees

Labels

unit-testTickets related to the OSAL unit testing (functional and/or coverage)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions