fix false negative floating point test
This commit is contained in:
@ -28,13 +28,13 @@ extern std::string INPUT_FOLDER;
|
|||||||
// convenience method to write out common entries
|
// convenience method to write out common entries
|
||||||
void write_yaml_header(class YamlWriter *writer, TestConfig *cfg, const char *version);
|
void write_yaml_header(class YamlWriter *writer, TestConfig *cfg, const char *version);
|
||||||
|
|
||||||
#define EXPECT_FP_LE_WITH_EPS(val1, val2, eps) \
|
#define EXPECT_FP_LE_WITH_EPS(val1, val2, eps) \
|
||||||
do { \
|
do { \
|
||||||
const double diff = fabs(val1 - val2); \
|
const double diff = fabs(val1 - val2); \
|
||||||
const double div = std::min(fabs(val1), fabs(val2)); \
|
const double div = std::min(fabs(val1), fabs(val2)); \
|
||||||
const double err = (div == 0.0) ? diff : diff / div; \
|
const double err = (div<DBL_EPSILON) ? diff : diff/div; \
|
||||||
stats.add(err); \
|
stats.add(err); \
|
||||||
EXPECT_PRED_FORMAT2(::testing::DoubleLE, err, eps); \
|
EXPECT_PRED_FORMAT2(::testing::DoubleLE, err, eps); \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
void EXPECT_STRESS(const std::string &name, double *stress, const stress_t &expected_stress,
|
void EXPECT_STRESS(const std::string &name, double *stress, const stress_t &expected_stress,
|
||||||
|
|||||||
Reference in New Issue
Block a user