提交 ac455f27 编写于 作者: M Mark VanderVoord

We can’t guarantee that the built-in function insane will return 1. It might...

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.
上级 ae5b4c57
...@@ -733,13 +733,13 @@ void UnityAssertFloatSpecial(const _UF actual, ...@@ -733,13 +733,13 @@ void UnityAssertFloatSpecial(const _UF actual,
case UNITY_FLOAT_IS_NAN: case UNITY_FLOAT_IS_NAN:
case UNITY_FLOAT_IS_NOT_NAN: case UNITY_FLOAT_IS_NOT_NAN:
is_trait = isnan(actual); is_trait = isnan(actual) ? 1 : 0;
break; break;
/* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */ /* 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_DET:
case UNITY_FLOAT_IS_NOT_DET: case UNITY_FLOAT_IS_NOT_DET:
if (isinf(actual) | isnan(actual)) if (isinf(actual) || isnan(actual))
is_trait = 0; is_trait = 0;
else else
is_trait = 1; is_trait = 1;
...@@ -876,13 +876,13 @@ void UnityAssertDoubleSpecial(const _UD actual, ...@@ -876,13 +876,13 @@ void UnityAssertDoubleSpecial(const _UD actual,
case UNITY_FLOAT_IS_NAN: case UNITY_FLOAT_IS_NAN:
case UNITY_FLOAT_IS_NOT_NAN: case UNITY_FLOAT_IS_NOT_NAN:
is_trait = isnan(actual); is_trait = isnan(actual) ? 1 : 0;
break; break;
/* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */ /* 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_DET:
case UNITY_FLOAT_IS_NOT_DET: case UNITY_FLOAT_IS_NOT_DET:
if (isinf(actual) | isnan(actual)) if (isinf(actual) || isnan(actual))
is_trait = 0; is_trait = 0;
else else
is_trait = 1; is_trait = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册