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:
Mark VanderVoord
2016-11-15 09:29:08 -05:00
parent ae5b4c5799
commit ac455f2798

View File

@ -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;