Skip to content
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 #2597, fix sb coverage test failure #2602

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading