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

Function UnityAssertWithinDoubleArray

src/unity.c:1161–1238  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1159
1160/*-----------------------------------------------*/
1161void UnityAssertWithinDoubleArray(const UNITY_DOUBLE delta,
1162 UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expected,
1163 UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* actual,
1164 const UNITY_UINT32 num_elements,
1165 const char* msg,
1166 const UNITY_LINE_TYPE lineNumber,
1167 const UNITY_FLAGS_T flags)
1168{
1169 UNITY_UINT32 elements = num_elements;
1170 UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_expected = expected;
1171 UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_actual = actual;
1172 UNITY_DOUBLE in_delta = delta;
1173 UNITY_DOUBLE current_element_delta = delta;
1174
1175 RETURN_IF_FAIL_OR_IGNORE;
1176
1177 if (elements == 0)
1178 {
1179#ifdef UNITY_COMPARE_PTRS_ON_ZERO_ARRAY
1180 UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, lineNumber, msg);
1181#else
1182 UnityPrintPointlessAndBail();
1183#endif
1184 }
1185
1186 if (UNITY_IS_INF(in_delta))
1187 {
1188 return; /* Arrays will be force equal with infinite delta */
1189 }
1190
1191 if (UNITY_IS_NAN(in_delta))
1192 {
1193 /* Delta must be correct number */
1194 UnityPrintPointlessAndBail();
1195 }
1196
1197 if (expected == actual)
1198 {
1199 return; /* Both are NULL or same pointer */
1200 }
1201
1202 if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
1203 {
1204 UNITY_FAIL_AND_BAIL;
1205 }
1206
1207 /* fix delta sign if need */
1208 if (in_delta < 0)
1209 {
1210 in_delta = -in_delta;
1211 }
1212
1213 while (elements--)
1214 {
1215 current_element_delta = *ptr_expected * UNITY_DOUBLE_PRECISION;
1216
1217 if (current_element_delta < 0)
1218 {

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