Skip to content

Commit

Permalink
Fix #814, add additional vararg tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zanzaben committed Jun 15, 2021
1 parent 285cd12 commit 04fbc9a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions modules/cfe_testcase/src/es_misc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,27 @@ void TestCalculateCRC(void)

UtPrintf("Testing: CFE_ES_CalculateCRC");

UtAssert_INT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_DEFAULT_CRC), expectedCrc);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_DEFAULT_CRC), expectedCrc);

memset(Data2, 1, sizeof(Data2));
UtAssert_INT32_EQ(CFE_ES_CalculateCRC(&Data2, sizeof(Data2), inputCrc, CFE_MISSION_ES_CRC_16), expectedBlockCrc);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(&Data2, sizeof(Data2), inputCrc, CFE_MISSION_ES_CRC_16), expectedBlockCrc);

UtAssert_INT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_8), 0);
UtAssert_INT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_32), 0);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_8), 0);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_32), 0);

UtAssert_INT32_EQ(CFE_ES_CalculateCRC(NULL, sizeof(Data), expectedCrc, CFE_MISSION_ES_CRC_8), expectedCrc);
UtAssert_INT32_EQ(CFE_ES_CalculateCRC(Data, 0, expectedBlockCrc, CFE_MISSION_ES_CRC_8), expectedBlockCrc);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(NULL, sizeof(Data), expectedCrc, CFE_MISSION_ES_CRC_16), expectedCrc);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, 0, expectedBlockCrc, CFE_MISSION_ES_CRC_16), expectedBlockCrc);
}

void TestWriteToSysLog(void)
{
const char *TestString = "Test String for CFE_ES_WriteToSysLog Functional Test";

UtPrintf("Testing: CFE_ES_WriteToSysLog");
CFE_ES_WriteToSysLog("MIR (Manual Inspection Required) for CFE_ES_WriteToSysLog");
CFE_ES_WriteToSysLog(NULL);
CFE_ES_WriteToSysLog("%s", TestString);

UtAssertEx(false, UTASSERT_CASETYPE_MIR, __FILE__, __LINE__, "%s",
"MIR (Manual Inspection Required) for CFE_ES_WriteToSysLog");
}
Expand Down

0 comments on commit 04fbc9a

Please sign in to comment.