mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-07-15 00:52:46 +08:00
Array comparisons of floating point types fail if any values are NaN or infinite.
This commit is contained in:
@ -539,7 +539,9 @@ void UnityAssertEqualFloatArray(const _UF* expected,
|
||||
tol = UNITY_FLOAT_PRECISION * *ptr_expected;
|
||||
if (tol < 0.0)
|
||||
tol = 0.0 - tol;
|
||||
if (diff > tol)
|
||||
|
||||
//This first part of this condition will catch any NaN or Infinite values
|
||||
if ((diff * 0.0f != 0.0f) || (diff > tol))
|
||||
{
|
||||
UnityTestResultsFailBegin(lineNumber);
|
||||
UnityPrint(UnityStrElement);
|
||||
@ -703,7 +705,9 @@ void UnityAssertEqualDoubleArray(const _UD* expected,
|
||||
tol = UNITY_DOUBLE_PRECISION * *ptr_expected;
|
||||
if (tol < 0.0)
|
||||
tol = 0.0 - tol;
|
||||
if (diff > tol)
|
||||
|
||||
//This first part of this condition will catch any NaN or Infinite values
|
||||
if ((diff * 0.0f != 0.0f) || (diff > tol))
|
||||
{
|
||||
UnityTestResultsFailBegin(lineNumber);
|
||||
UnityPrint(UnityStrElement);
|
||||
|
Reference in New Issue
Block a user