MCPcopy Index your code
hub / github.com/ThrowTheSwitch/Unity / UnityAssertEqualString

Function UnityAssertEqualString

src/unity.c:1591–1627  ·  view source on GitHub ↗

-----------------------------------------------*/

Source from the content-addressed store, hash-verified

1589
1590/*-----------------------------------------------*/
1591void UnityAssertEqualString(const char* expected,
1592 const char* actual,
1593 const char* msg,
1594 const UNITY_LINE_TYPE lineNumber)
1595{
1596 UNITY_UINT32 i;
1597
1598 RETURN_IF_FAIL_OR_IGNORE;
1599
1600 /* if both pointers not null compare the strings */
1601 if (expected && actual)
1602 {
1603 for (i = 0; expected[i] || actual[i]; i++)
1604 {
1605 if (expected[i] != actual[i])
1606 {
1607 Unity.CurrentTestFailed = 1;
1608 break;
1609 }
1610 }
1611 }
1612 else
1613 { /* fail if either null but not if both */
1614 if (expected || actual)
1615 {
1616 Unity.CurrentTestFailed = 1;
1617 }
1618 }
1619
1620 if (Unity.CurrentTestFailed)
1621 {
1622 UnityTestResultsFailBegin(lineNumber);
1623 UnityPrintExpectedAndActualStrings(expected, actual);
1624 UnityAddMsgIfSpecified(msg);
1625 UNITY_FAIL_AND_BAIL;
1626 }
1627}
1628
1629/*-----------------------------------------------*/
1630void UnityAssertEqualStringLen(const char* expected,

Callers

nothing calls this directly

Calls 3

UnityAddMsgIfSpecifiedFunction · 0.85

Tested by

no test coverage detected