Skip to content

Commit 322e43f

Browse files
committed
Updates to address code coverage errors
1 parent a29cb32 commit 322e43f

3 files changed

Lines changed: 32 additions & 4 deletions

File tree

modules/tbl/fsw/src/cfe_tbl_task_cmds.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,9 @@ CFE_Status_t CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data)
404404
/* Locate specified table in registry (wrapped in a lock) */
405405
/* NOTE: The header reading code ensures null term on the table name string, so its OK to pass direct */
406406
CFE_TBL_TxnLockRegistry(&Txn);
407-
Status = CFE_TBL_TxnFindRegByName(&Txn, Header.Tbl.TableName);
407+
CFE_TBL_TxnFindRegByName(&Txn, Header.Tbl.TableName);
408408
CFE_TBL_TxnUnlockRegistry(&Txn);
409-
}
410409

411-
if (Status == CFE_SUCCESS)
412-
{
413410
Status = CFE_TBL_ValidateFileIsLoadable(&Txn, &Header.Tbl);
414411
}
415412

modules/tbl/ut-coverage/tbl_UT.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ void UtTest_Setup(void)
143143
UT_TBL_ADD_TEST(Test_CFE_TBL_Internal3);
144144

145145
UT_TBL_RegisterCodecTests();
146+
147+
UT_TBL_ADD_TEST(Test_CFE_TBL_HandleConversions);
146148
}
147149

148150
/*
@@ -4209,3 +4211,29 @@ void Test_CFE_TBL_TxnEvents(void)
42094211
UtAssert_VOIDCALL(CFE_TBL_TxnClearEvents(&Txn));
42104212
UtAssert_ZERO(CFE_TBL_TxnGetEventCount(&Txn));
42114213
}
4214+
4215+
void Test_CFE_TBL_HandleConversions(void)
4216+
{
4217+
/* Test case for:
4218+
* CFE_TBL_HandleId_t CFE_TBL_HandleToID(CFE_TBL_Handle_t TblHandle)
4219+
* CFE_TBL_Handle_t CFE_TBL_HandleFromID(CFE_TBL_HandleId_t TblId)
4220+
*/
4221+
4222+
CFE_TBL_HandleId_t TblId;
4223+
CFE_TBL_Handle_t TblHandle;
4224+
4225+
TblId = CFE_TBL_HandleToID(CFE_TBL_BAD_TABLE_HANDLE);
4226+
UtAssert_BOOL_FALSE(CFE_TBL_HandleID_IsDefined(TblId));
4227+
4228+
TblHandle = CFE_TBL_HandleFromID(CFE_TBL_HANDLEID_UNDEFINED);
4229+
UtAssert_BOOL_FALSE(CFE_TBL_HANDLE_IS_VALID(TblHandle));
4230+
4231+
TblId = CFE_TBL_HANDLEID_C(CFE_ResourceId_FromInteger(CFE_TBL_HANDLE_BASE + 1));
4232+
UtAssert_BOOL_TRUE(CFE_TBL_HandleID_IsDefined(TblId));
4233+
4234+
TblHandle = CFE_TBL_HandleFromID(TblId);
4235+
UtAssert_BOOL_TRUE(CFE_TBL_HANDLE_IS_VALID(TblHandle));
4236+
4237+
UtAssert_UINT32_EQ(CFE_TBL_HandleID_AsInt(CFE_TBL_HandleToID(TblHandle)),CFE_TBL_HandleID_AsInt(TblId));
4238+
4239+
}

modules/tbl/ut-coverage/tbl_UT.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,4 +685,7 @@ void Test_CFE_TBL_TableLoadCommon(void);
685685
void Test_CFE_TBL_TableLoadCodec(void);
686686
void Test_CFE_TBL_TableDumpCommon(void);
687687

688+
/* Handle conversion tests */
689+
void Test_CFE_TBL_HandleConversions(void);
690+
688691
#endif /* TBL_UT_H */

0 commit comments

Comments
 (0)