Skip to content

Commit bfc10a9

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update googletest to df1544b
PR-URL: #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>
1 parent 45ef180 commit bfc10a9

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

deps/googletest/src/gtest.cc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1660,10 +1660,25 @@ std::string GetBoolAssertionFailureMessage(
16601660
return msg.GetString();
16611661
}
16621662

1663-
// Helper function for implementing ASSERT_NEAR.
1663+
// Helper function for implementing ASSERT_NEAR. Treats infinity as a specific
1664+
// value, such that comparing infinity to infinity is equal, the distance
1665+
// between -infinity and +infinity is infinity, and infinity <= infinity is
1666+
// true.
16641667
AssertionResult DoubleNearPredFormat(const char* expr1, const char* expr2,
16651668
const char* abs_error_expr, double val1,
16661669
double val2, double abs_error) {
1670+
// We want to return success when the two values are infinity and at least
1671+
// one of the following is true:
1672+
// * The values are the same-signed infinity.
1673+
// * The error limit itself is infinity.
1674+
// This is done here so that we don't end up with a NaN when calculating the
1675+
// difference in values.
1676+
if (std::isinf(val1) && std::isinf(val2) &&
1677+
(std::signbit(val1) == std::signbit(val2) ||
1678+
(abs_error > 0.0 && std::isinf(abs_error)))) {
1679+
return AssertionSuccess();
1680+
}
1681+
16671682
const double diff = fabs(val1 - val2);
16681683
if (diff <= abs_error) return AssertionSuccess();
16691684

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy