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

Function UnityAssertEqualStringLen

tests/unity/src/unity.c:1043–1080  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1041
1042/*-----------------------------------------------*/
1043void UnityAssertEqualStringLen(const char* expected,
1044 const char* actual,
1045 const UNITY_UINT32 length,
1046 const char* msg,
1047 const UNITY_LINE_TYPE lineNumber)
1048{
1049 UNITY_UINT32 i;
1050
1051 RETURN_IF_FAIL_OR_IGNORE;
1052
1053 /* if both pointers not null compare the strings */
1054 if (expected && actual)
1055 {
1056 for (i = 0; (i < length) && (expected[i] || actual[i]); i++)
1057 {
1058 if (expected[i] != actual[i])
1059 {
1060 Unity.CurrentTestFailed = 1;
1061 break;
1062 }
1063 }
1064 }
1065 else
1066 { /* handle case of one pointers being null (if both null, test should pass) */
1067 if (expected != actual)
1068 {
1069 Unity.CurrentTestFailed = 1;
1070 }
1071 }
1072
1073 if (Unity.CurrentTestFailed)
1074 {
1075 UnityTestResultsFailBegin(lineNumber);
1076 UnityPrintExpectedAndActualStringsLen(expected, actual, length);
1077 UnityAddMsgIfSpecified(msg);
1078 UNITY_FAIL_AND_BAIL;
1079 }
1080}
1081
1082/*-----------------------------------------------*/
1083void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,

Callers

nothing calls this directly

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…