fix: Correct UINT max value handling

This commit is contained in:
Buccno
2025-06-05 11:00:57 +03:00
parent b9d897b5f3
commit bcb0746186
2 changed files with 60 additions and 30 deletions

View File

@@ -223,10 +223,6 @@ void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T
UnityPrintNumber(number);
}
}
else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
{
UnityPrintNumberUnsigned((UNITY_UINT)number);
}
else
{
UNITY_OUTPUT_CHAR('0');
@@ -235,6 +231,14 @@ void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T
}
}
void UnityPrintUintNumberByStyle(const UNITY_UINT number, const UNITY_DISPLAY_STYLE_T style)
{
if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
{
UnityPrintNumberUnsigned(number);
}
}
/*-----------------------------------------------*/
void UnityPrintNumber(const UNITY_INT number_to_print)
{
@@ -709,11 +713,11 @@ void UnityAssertBits(const UNITY_INT mask,
}
/*-----------------------------------------------*/
void UnityAssertEqualNumber(const UNITY_INT expected,
const UNITY_INT actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style)
void UnityAssertEqualIntNumber(const UNITY_INT expected,
const UNITY_INT actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style)
{
RETURN_IF_FAIL_OR_IGNORE;
@@ -729,6 +733,25 @@ void UnityAssertEqualNumber(const UNITY_INT expected,
}
}
void UnityAssertEqualUintNumber(const UNITY_UINT expected,
const UNITY_UINT actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style)
{
RETURN_IF_FAIL_OR_IGNORE;
if (expected != actual)
{
UnityTestResultsFailBegin(lineNumber);
UnityPrint(UnityStrExpected);
UnityPrintUintNumberByStyle(expected, style);
UnityPrint(UnityStrWas);
UnityPrintUintNumberByStyle(actual, style);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
}
}
/*-----------------------------------------------*/
void UnityAssertGreaterOrLessOrEqualNumber(const UNITY_INT threshold,
const UNITY_INT actual,