| 31 | #include "CppUTest/TestOutput.h" |
| 32 | |
| 33 | bool doubles_equal(double d1, double d2, double threshold) |
| 34 | { |
| 35 | if (PlatformSpecificIsNan(d1) || PlatformSpecificIsNan(d2) || PlatformSpecificIsNan(threshold)) |
| 36 | return false; |
| 37 | |
| 38 | if (PlatformSpecificIsInf(d1) && PlatformSpecificIsInf(d2)) |
| 39 | { |
| 40 | return true; |
| 41 | } |
| 42 | |
| 43 | return PlatformSpecificFabs(d1 - d2) <= threshold; |
| 44 | } |
| 45 | |
| 46 | /* Sometimes stubs use the CppUTest assertions. |
| 47 | * Its not correct to do so, but this small helper class will prevent a segmentation fault and instead |
no test coverage detected