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

Function UnityAssertNumbersWithin

src/unity.c:1380–1424  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1378
1379/*-----------------------------------------------*/
1380void UnityAssertNumbersWithin(const UNITY_UINT delta,
1381 const UNITY_INT expected,
1382 const UNITY_INT actual,
1383 const char* msg,
1384 const UNITY_LINE_TYPE lineNumber,
1385 const UNITY_DISPLAY_STYLE_T style)
1386{
1387 RETURN_IF_FAIL_OR_IGNORE;
1388
1389 if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
1390 {
1391 if (actual > expected)
1392 {
1393 Unity.CurrentTestFailed = (((UNITY_UINT)actual - (UNITY_UINT)expected) > delta);
1394 }
1395 else
1396 {
1397 Unity.CurrentTestFailed = (((UNITY_UINT)expected - (UNITY_UINT)actual) > delta);
1398 }
1399 }
1400 else
1401 {
1402 if ((UNITY_UINT)actual > (UNITY_UINT)expected)
1403 {
1404 Unity.CurrentTestFailed = (((UNITY_UINT)actual - (UNITY_UINT)expected) > delta);
1405 }
1406 else
1407 {
1408 Unity.CurrentTestFailed = (((UNITY_UINT)expected - (UNITY_UINT)actual) > delta);
1409 }
1410 }
1411
1412 if (Unity.CurrentTestFailed)
1413 {
1414 UnityTestResultsFailBegin(lineNumber);
1415 UnityPrint(UnityStrDelta);
1416 UnityPrintNumberByStyle((UNITY_INT)delta, style);
1417 UnityPrint(UnityStrExpected);
1418 UnityPrintNumberByStyle(expected, style);
1419 UnityPrint(UnityStrWas);
1420 UnityPrintNumberByStyle(actual, style);
1421 UnityAddMsgIfSpecified(msg);
1422 UNITY_FAIL_AND_BAIL;
1423 }
1424}
1425
1426/*-----------------------------------------------*/
1427void UnityAssertNumbersArrayWithin(const UNITY_UINT delta,

Callers

nothing calls this directly

Calls 4

UnityPrintFunction · 0.85
UnityPrintNumberByStyleFunction · 0.85
UnityAddMsgIfSpecifiedFunction · 0.85

Tested by

no test coverage detected