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

Function UnityAssertEqualFloatArray

tests/unity/src/unity.c:712–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

710}
711
712void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* expected,
713 UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* actual,
714 const UNITY_UINT32 num_elements,
715 const char* msg,
716 const UNITY_LINE_TYPE lineNumber,
717 const UNITY_FLAGS_T flags)
718{
719 UNITY_UINT32 elements = num_elements;
720 UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* ptr_expected = expected;
721 UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* ptr_actual = actual;
722
723 RETURN_IF_FAIL_OR_IGNORE;
724
725 if (elements == 0)
726 {
727 UnityPrintPointlessAndBail();
728 }
729
730 if (expected == actual) return; /* Both are NULL or same pointer */
731 if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
732 UNITY_FAIL_AND_BAIL;
733
734 while (elements--)
735 {
736 if (!UnityFloatsWithin(*ptr_expected * UNITY_FLOAT_PRECISION, *ptr_expected, *ptr_actual))
737 {
738 UnityTestResultsFailBegin(lineNumber);
739 UnityPrint(UnityStrElement);
740 UnityPrintNumberUnsigned(num_elements - elements - 1);
741 UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT((UNITY_DOUBLE)*ptr_expected, (UNITY_DOUBLE)*ptr_actual);
742 UnityAddMsgIfSpecified(msg);
743 UNITY_FAIL_AND_BAIL;
744 }
745 if (flags == UNITY_ARRAY_TO_ARRAY)
746 {
747 ptr_expected++;
748 }
749 ptr_actual++;
750 }
751}
752
753/*-----------------------------------------------*/
754void UnityAssertFloatsWithin(const UNITY_FLOAT delta,

Callers

nothing calls this directly

Calls 6

UnityIsOneArrayNullFunction · 0.85
UnityFloatsWithinFunction · 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…