MCPcopy Create free account
hub / github.com/cpputest/cpputest / doubles_equal

Function doubles_equal

src/CppUTest/Utest.cpp:33–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#include "CppUTest/TestOutput.h"
32
33bool 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

Callers 3

equalsMethod · 0.85
assertDoublesEqualMethod · 0.85
TESTFunction · 0.85

Calls 1

PlatformSpecificFabsFunction · 0.85

Tested by

no test coverage detected