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

Function UnityAssertGreaterOrLessOrEqualNumber

tests/unity/src/unity.c:555–591  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

553
554/*-----------------------------------------------*/
555void UnityAssertGreaterOrLessOrEqualNumber(const UNITY_INT threshold,
556 const UNITY_INT actual,
557 const UNITY_COMPARISON_T compare,
558 const char *msg,
559 const UNITY_LINE_TYPE lineNumber,
560 const UNITY_DISPLAY_STYLE_T style)
561{
562 int failed = 0;
563 RETURN_IF_FAIL_OR_IGNORE;
564
565 if (threshold == actual && compare & UNITY_EQUAL_TO) return;
566 if (threshold == actual) failed = 1;
567
568 if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
569 {
570 if (actual > threshold && compare & UNITY_SMALLER_THAN) failed = 1;
571 if (actual < threshold && compare & UNITY_GREATER_THAN) failed = 1;
572 }
573 else /* UINT or HEX */
574 {
575 if ((UNITY_UINT)actual > (UNITY_UINT)threshold && compare & UNITY_SMALLER_THAN) failed = 1;
576 if ((UNITY_UINT)actual < (UNITY_UINT)threshold && compare & UNITY_GREATER_THAN) failed = 1;
577 }
578
579 if (failed)
580 {
581 UnityTestResultsFailBegin(lineNumber);
582 UnityPrint(UnityStrExpected);
583 UnityPrintNumberByStyle(actual, style);
584 if (compare & UNITY_GREATER_THAN) UnityPrint(UnityStrGt);
585 if (compare & UNITY_SMALLER_THAN) UnityPrint(UnityStrLt);
586 if (compare & UNITY_EQUAL_TO) UnityPrint(UnityStrOrEqual);
587 UnityPrintNumberByStyle(threshold, style);
588 UnityAddMsgIfSpecified(msg);
589 UNITY_FAIL_AND_BAIL;
590 }
591}
592
593#define UnityPrintPointlessAndBail() \
594{ \

Callers

nothing calls this directly

Calls 4

UnityPrintFunction · 0.85
UnityPrintNumberByStyleFunction · 0.85
UnityAddMsgIfSpecifiedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…