Try to fix C89 incompatibilities in UnityAssertGreaterOrLess(Double|Float)

This commit is contained in:
Jonathan Reichelt Gjertsen
2021-12-03 19:32:33 +01:00
parent 244edf6c16
commit 2a8f3fe65a

View File

@@ -1005,11 +1005,13 @@ void UnityAssertGreaterOrLessFloat(const UNITY_FLOAT threshold,
const char* msg, const char* msg,
const UNITY_LINE_TYPE lineNumber) const UNITY_LINE_TYPE lineNumber)
{ {
int failed;
RETURN_IF_FAIL_OR_IGNORE; RETURN_IF_FAIL_OR_IGNORE;
int failed = 0; failed = 0;
// Checking for "not success" rather than failure to get the right result for NaN /* Checking for "not success" rather than failure to get the right result for NaN */
if (!(actual < threshold) && (compare & UNITY_SMALLER_THAN)) { failed = 1; } if (!(actual < threshold) && (compare & UNITY_SMALLER_THAN)) { failed = 1; }
if (!(actual > threshold) && (compare & UNITY_GREATER_THAN)) { failed = 1; } if (!(actual > threshold) && (compare & UNITY_GREATER_THAN)) { failed = 1; }
@@ -1194,11 +1196,13 @@ void UnityAssertGreaterOrLessDouble(const UNITY_DOUBLE threshold,
const char* msg, const char* msg,
const UNITY_LINE_TYPE lineNumber) const UNITY_LINE_TYPE lineNumber)
{ {
int failed;
RETURN_IF_FAIL_OR_IGNORE; RETURN_IF_FAIL_OR_IGNORE;
int failed = 0; failed = 0;
// Checking for "not success" rather than failure to get the right result for NaN /* Checking for "not success" rather than failure to get the right result for NaN */
if (!(actual < threshold) && (compare & UNITY_SMALLER_THAN)) { failed = 1; } if (!(actual < threshold) && (compare & UNITY_SMALLER_THAN)) { failed = 1; }
if (!(actual > threshold) && (compare & UNITY_GREATER_THAN)) { failed = 1; } if (!(actual > threshold) && (compare & UNITY_GREATER_THAN)) { failed = 1; }