Skip to content

Commit

Permalink
Merge pull request #2602 from avan989:Fix-2597-sb-coverage-test-failure
Browse files Browse the repository at this point in the history
Fix #2597, fix sb coverage test failure
  • Loading branch information
dzbaker committed Oct 3, 2024
2 parents 561ff53 + ebeb8f3 commit fa4088c
Showing 1 changed file with 82 additions and 14 deletions.
96 changes: 82 additions & 14 deletions modules/sb/ut-coverage/sb_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -4629,56 +4629,124 @@ void Test_CFE_SB_ValidateMsgId(void)

void Test_CFE_SB_CmdTopicIdToMsgId(void)
{
CFE_SB_MsgId_Atom_t MsgIdVal;
CFE_SB_MsgId_Atom_t MsgIdVal1;
CFE_SB_MsgId_Atom_t MsgIdVal2;
bool ReturnCode1 = false;
bool ReturnCode2 = false;

MsgIdVal1 = CFE_SB_CmdTopicIdToMsgId(1, 1);
ReturnCode1 = CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal1));

MsgIdVal = CFE_SB_CmdTopicIdToMsgId(1, 1);
UtAssert_BOOL_TRUE(CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal)));
MsgIdVal2 = CFE_SB_CmdTopicIdToMsgId(1, 0);
ReturnCode2 = CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal2));

MsgIdVal = CFE_SB_CmdTopicIdToMsgId(1, 0);
UtAssert_BOOL_TRUE(CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal)));
if(MsgIdVal1 == 0 || MsgIdVal2 == 0)
{
/* Macro does not exist. Topic ID has not been implemented. */
UtAssert_MIR("Topic ID has not been implemented. ");
}
else
{
UtAssert_BOOL_TRUE(ReturnCode1);
UtAssert_BOOL_TRUE(ReturnCode2);
}
}

void Test_CFE_SB_TlmTopicIdToMsgId(void)
{
CFE_SB_MsgId_Atom_t MsgIdVal;
CFE_SB_MsgId_Atom_t MsgIdVal1;
CFE_SB_MsgId_Atom_t MsgIdVal2;
bool ReturnCode1 = false;
bool ReturnCode2 = false;

MsgIdVal1 = CFE_SB_TlmTopicIdToMsgId(1, 1);
ReturnCode1 = CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal1));

MsgIdVal = CFE_SB_TlmTopicIdToMsgId(1, 1);
UtAssert_BOOL_TRUE(CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal)));
MsgIdVal2 = CFE_SB_TlmTopicIdToMsgId(1, 0);
ReturnCode2 = CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal2));

MsgIdVal = CFE_SB_CmdTopicIdToMsgId(1, 0);
UtAssert_BOOL_TRUE(CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal)));
if(MsgIdVal1 == 0 || MsgIdVal2 == 0)
{
/* Macro does not exist. Topic ID has not been implemented. */
UtAssert_MIR("Topic ID has not been implemented. ");
}
else
{
UtAssert_BOOL_TRUE(ReturnCode1);
UtAssert_BOOL_TRUE(ReturnCode2);
}
}

void Test_CFE_SB_GlobalCmdTopicIdToMsgId(void)
{
CFE_SB_MsgId_Atom_t MsgIdVal;
bool ReturnCode = false;

MsgIdVal = CFE_SB_GlobalCmdTopicIdToMsgId(2);
UtAssert_BOOL_TRUE(CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal)));
ReturnCode = CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal));
if(MsgIdVal == 0)
{
/* Macro does not exist. Topic ID has not been implemented. */
UtAssert_MIR("Topic ID has not been implemented. ");
}
else
{
UtAssert_BOOL_TRUE(ReturnCode);
}
}

void Test_CFE_SB_GlobalTlmTopicIdToMsgId(void)
{
CFE_SB_MsgId_Atom_t MsgIdVal;
bool ReturnCode = false;

MsgIdVal = CFE_SB_GlobalTlmTopicIdToMsgId(2);
UtAssert_BOOL_TRUE(CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal)));
ReturnCode = CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal));
if(MsgIdVal == 0)
{
/* Macro does not exist. Topic ID has not been implemented. */
UtAssert_MIR("Topic ID has not been implemented. ");
}
else
{
UtAssert_BOOL_TRUE(ReturnCode);
}
}

void Test_CFE_SB_LocalCmdTopicIdToMsgId(void)
{
CFE_SB_MsgId_Atom_t MsgIdVal;
bool ReturnCode = false;

MsgIdVal = CFE_SB_LocalCmdTopicIdToMsgId(3);
UtAssert_BOOL_TRUE(CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal)));
ReturnCode = CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal));
if(MsgIdVal == 0)
{
/* Macro does not exist. Topic ID has not been implemented. */
UtAssert_MIR("Topic ID has not been implemented. ");
}
else
{
UtAssert_BOOL_TRUE(ReturnCode);
}
}

void Test_CFE_SB_LocalTlmTopicIdToMsgId(void)
{
CFE_SB_MsgId_Atom_t MsgIdVal;
bool ReturnCode = false;

MsgIdVal = CFE_SB_LocalTlmTopicIdToMsgId(3);
UtAssert_BOOL_TRUE(CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal)));
ReturnCode = CFE_SB_IsValidMsgId(CFE_SB_ValueToMsgId(MsgIdVal));
if(MsgIdVal == 0)
{
/* Macro does not exist. Topic ID has not been implemented. */
UtAssert_MIR("Topic ID has not been implemented. ");
}
else
{
UtAssert_BOOL_TRUE(ReturnCode);
}
}

/*
Expand Down

0 comments on commit fa4088c

Please sign in to comment.