mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
deps: update googletest to df1544b
PR-URL: https://github.com/nodejs/node/pull/55465 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
parent
34aba11872
commit
b76bcb3aad
17
deps/googletest/src/gtest.cc
vendored
17
deps/googletest/src/gtest.cc
vendored
@ -1660,10 +1660,25 @@ std::string GetBoolAssertionFailureMessage(
|
|||||||
return msg.GetString();
|
return msg.GetString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function for implementing ASSERT_NEAR.
|
// Helper function for implementing ASSERT_NEAR. Treats infinity as a specific
|
||||||
|
// value, such that comparing infinity to infinity is equal, the distance
|
||||||
|
// between -infinity and +infinity is infinity, and infinity <= infinity is
|
||||||
|
// true.
|
||||||
AssertionResult DoubleNearPredFormat(const char* expr1, const char* expr2,
|
AssertionResult DoubleNearPredFormat(const char* expr1, const char* expr2,
|
||||||
const char* abs_error_expr, double val1,
|
const char* abs_error_expr, double val1,
|
||||||
double val2, double abs_error) {
|
double val2, double abs_error) {
|
||||||
|
// We want to return success when the two values are infinity and at least
|
||||||
|
// one of the following is true:
|
||||||
|
// * The values are the same-signed infinity.
|
||||||
|
// * The error limit itself is infinity.
|
||||||
|
// This is done here so that we don't end up with a NaN when calculating the
|
||||||
|
// difference in values.
|
||||||
|
if (std::isinf(val1) && std::isinf(val2) &&
|
||||||
|
(std::signbit(val1) == std::signbit(val2) ||
|
||||||
|
(abs_error > 0.0 && std::isinf(abs_error)))) {
|
||||||
|
return AssertionSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
const double diff = fabs(val1 - val2);
|
const double diff = fabs(val1 - val2);
|
||||||
if (diff <= abs_error) return AssertionSuccess();
|
if (diff <= abs_error) return AssertionSuccess();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user