mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-12-17 05:54:07 +08:00
Adding delta infinity & nan checks & tests
This commit is contained in:
22
src/unity.c
22
src/unity.c
@@ -954,6 +954,17 @@ void UnityAssertWithinFloatArray(const UNITY_FLOAT delta,
|
||||
#endif
|
||||
}
|
||||
|
||||
if (isinf(in_delta))
|
||||
{
|
||||
return; /* Arrays will be force equal with infinite delta */
|
||||
}
|
||||
|
||||
if (isnan(in_delta))
|
||||
{
|
||||
/* Delta must be correct number */
|
||||
UnityPrintPointlessAndBail();
|
||||
}
|
||||
|
||||
if (expected == actual)
|
||||
{
|
||||
return; /* Both are NULL or same pointer */
|
||||
@@ -1170,6 +1181,17 @@ void UnityAssertWithinDoubleArray(const UNITY_DOUBLE delta,
|
||||
#endif
|
||||
}
|
||||
|
||||
if (isinf(in_delta))
|
||||
{
|
||||
return; /* Arrays will be force equal with infinite delta */
|
||||
}
|
||||
|
||||
if (isnan(in_delta))
|
||||
{
|
||||
/* Delta must be correct number */
|
||||
UnityPrintPointlessAndBail();
|
||||
}
|
||||
|
||||
if (expected == actual)
|
||||
{
|
||||
return; /* Both are NULL or same pointer */
|
||||
|
||||
Reference in New Issue
Block a user