Skip to content

Commit

Permalink
Merge pull request #1891 from skliper/fix1890-rid_coverage
Browse files Browse the repository at this point in the history
Fix #1890, Improve resource ID branch coverage
  • Loading branch information
astrogeco committed Aug 30, 2021
2 parents bb16216 + 18ffb99 commit d145434
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions modules/resourceid/ut-coverage/test_cfe_resourceid.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ void TestResourceID(void)
UtAssert_True(TestIndex == RefIndex, "ID index after search: id=%lx, expected=%lu, got=%lu",
CFE_ResourceId_ToInteger(Id), (unsigned long)RefIndex, (unsigned long)TestIndex);

/* For valid Id check other invalid inputs */
UtAssert_INT32_EQ(CFE_ResourceId_ToIndex(Id, RefBase, 1, NULL), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ResourceId_ToIndex(Id, RefBase, 0, &TestIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_ResourceId_ToIndex(Id, ~RefBase, 1, &TestIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID);

/* Validate off-nominal inputs */
Id = CFE_ResourceId_FindNext(CFE_RESOURCEID_UNDEFINED, 0, UT_ResourceId_CheckIdSlotUsed);
UtAssert_True(CFE_ResourceId_Equal(Id, CFE_RESOURCEID_UNDEFINED), "CFE_ResourceId_FindNext() bad input: id=%lx",
Expand All @@ -171,10 +176,6 @@ void TestResourceID(void)
Id = CFE_ResourceId_FindNext(LastId, 0, NULL);
UtAssert_True(CFE_ResourceId_Equal(Id, CFE_RESOURCEID_UNDEFINED), "CFE_ResourceId_FindNext() bad input: id=%lx",
CFE_ResourceId_ToInteger(Id));

UtAssert_INT32_EQ(CFE_ResourceId_ToIndex(Id, RefBase, 1, NULL), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ResourceId_ToIndex(Id, RefBase, 0, &TestIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID);
UtAssert_INT32_EQ(CFE_ResourceId_ToIndex(Id, ~RefBase, 1, &TestIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID);
}

void UtTest_Setup(void)
Expand Down

0 comments on commit d145434

Please sign in to comment.