Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7dc2c2e

Browse filesBrowse files
nodejs-github-botruyadorno
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 fa9329c commit 7dc2c2e
Copy full SHA for 7dc2c2e

1 file changed

+16-1Lines changed: 16 additions & 1 deletion

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎deps/googletest/src/gtest.cc‎

Copy file name to clipboardExpand all lines: deps/googletest/src/gtest.cc
+16-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.