mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-12-18 23:11:11 +08:00
Try to fix C89 incompatibilities in UnityAssertGreaterOrLess(Double|Float)
This commit is contained in:
12
src/unity.c
12
src/unity.c
@@ -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; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user