mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-07-15 00:52:46 +08:00
We can’t guarantee that the built-in function insane will return 1. It might return any other non-negative value. Therefore we need to force it to be 1 so we can use the comparison operator later.
This commit is contained in:
@ -733,13 +733,13 @@ void UnityAssertFloatSpecial(const _UF actual,
|
||||
|
||||
case UNITY_FLOAT_IS_NAN:
|
||||
case UNITY_FLOAT_IS_NOT_NAN:
|
||||
is_trait = isnan(actual);
|
||||
is_trait = isnan(actual) ? 1 : 0;
|
||||
break;
|
||||
|
||||
/* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */
|
||||
case UNITY_FLOAT_IS_DET:
|
||||
case UNITY_FLOAT_IS_NOT_DET:
|
||||
if (isinf(actual) | isnan(actual))
|
||||
if (isinf(actual) || isnan(actual))
|
||||
is_trait = 0;
|
||||
else
|
||||
is_trait = 1;
|
||||
@ -876,13 +876,13 @@ void UnityAssertDoubleSpecial(const _UD actual,
|
||||
|
||||
case UNITY_FLOAT_IS_NAN:
|
||||
case UNITY_FLOAT_IS_NOT_NAN:
|
||||
is_trait = isnan(actual);
|
||||
is_trait = isnan(actual) ? 1 : 0;
|
||||
break;
|
||||
|
||||
/* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */
|
||||
case UNITY_FLOAT_IS_DET:
|
||||
case UNITY_FLOAT_IS_NOT_DET:
|
||||
if (isinf(actual) | isnan(actual))
|
||||
if (isinf(actual) || isnan(actual))
|
||||
is_trait = 0;
|
||||
else
|
||||
is_trait = 1;
|
||||
|
Reference in New Issue
Block a user