MCPcopy Create free account
hub / github.com/DaveGamble/cJSON / UnityAssertEqualString

Function UnityAssertEqualString

tests/unity/src/unity.c:1004–1040  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1002
1003/*-----------------------------------------------*/
1004void UnityAssertEqualString(const char* expected,
1005 const char* actual,
1006 const char* msg,
1007 const UNITY_LINE_TYPE lineNumber)
1008{
1009 UNITY_UINT32 i;
1010
1011 RETURN_IF_FAIL_OR_IGNORE;
1012
1013 /* if both pointers not null compare the strings */
1014 if (expected && actual)
1015 {
1016 for (i = 0; expected[i] || actual[i]; i++)
1017 {
1018 if (expected[i] != actual[i])
1019 {
1020 Unity.CurrentTestFailed = 1;
1021 break;
1022 }
1023 }
1024 }
1025 else
1026 { /* handle case of one pointers being null (if both null, test should pass) */
1027 if (expected != actual)
1028 {
1029 Unity.CurrentTestFailed = 1;
1030 }
1031 }
1032
1033 if (Unity.CurrentTestFailed)
1034 {
1035 UnityTestResultsFailBegin(lineNumber);
1036 UnityPrintExpectedAndActualStrings(expected, actual);
1037 UnityAddMsgIfSpecified(msg);
1038 UNITY_FAIL_AND_BAIL;
1039 }
1040}
1041
1042/*-----------------------------------------------*/
1043void UnityAssertEqualStringLen(const char* expected,

Callers

nothing calls this directly

Calls 3

UnityAddMsgIfSpecifiedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…