1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-26 01:41:35 +01:00

UnityAssertFloatsWithin now fails any test where either a NaN or Infinite value is passed as expected or actual.

This commit is contained in:
Ross Ryles
2012-10-30 15:24:10 +00:00
parent ae18c560bd
commit 899f2f2fab
2 changed files with 46 additions and 2 deletions

View File

@@ -578,8 +578,8 @@ void UnityAssertFloatsWithin(const _UF delta,
pos_delta = 0.0f - pos_delta;
}
// NOTE: This comparison is deliberately this way round so that NaNs fail.
if ( ! (pos_delta >= diff) )
//This first part of this condition will catch any NaN or Infinite values
if ((diff * 0.0f != 0.0f) || (pos_delta < diff))
{
UnityTestResultsFailBegin(lineNumber);
#ifdef UNITY_FLOAT_VERBOSE