MCPcopy Index your code
hub / github.com/DaveGamble/cJSON / UnityAssertEqualDoubleArray

Function UnityAssertEqualDoubleArray

tests/unity/src/unity.c:842–881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

840}
841
842void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expected,
843 UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* actual,
844 const UNITY_UINT32 num_elements,
845 const char* msg,
846 const UNITY_LINE_TYPE lineNumber,
847 const UNITY_FLAGS_T flags)
848{
849 UNITY_UINT32 elements = num_elements;
850 UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_expected = expected;
851 UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_actual = actual;
852
853 RETURN_IF_FAIL_OR_IGNORE;
854
855 if (elements == 0)
856 {
857 UnityPrintPointlessAndBail();
858 }
859
860 if (expected == actual) return; /* Both are NULL or same pointer */
861 if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
862 UNITY_FAIL_AND_BAIL;
863
864 while (elements--)
865 {
866 if (!UnityDoublesWithin(*ptr_expected * UNITY_DOUBLE_PRECISION, *ptr_expected, *ptr_actual))
867 {
868 UnityTestResultsFailBegin(lineNumber);
869 UnityPrint(UnityStrElement);
870 UnityPrintNumberUnsigned(num_elements - elements - 1);
871 UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(*ptr_expected, *ptr_actual);
872 UnityAddMsgIfSpecified(msg);
873 UNITY_FAIL_AND_BAIL;
874 }
875 if (flags == UNITY_ARRAY_TO_ARRAY)
876 {
877 ptr_expected++;
878 }
879 ptr_actual++;
880 }
881}
882
883/*-----------------------------------------------*/
884void UnityAssertDoublesWithin(const UNITY_DOUBLE delta,

Callers

nothing calls this directly

Calls 6

UnityIsOneArrayNullFunction · 0.85
UnityDoublesWithinFunction · 0.85
UnityPrintFunction · 0.85
UnityPrintNumberUnsignedFunction · 0.85
UnityAddMsgIfSpecifiedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…