MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / CmpHelperFloatingPointEQ

Function CmpHelperFloatingPointEQ

tests/gtest/gtest.h:14169–14192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14167// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
14168template <typename RawType>
14169AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
14170 const char* rhs_expression,
14171 RawType lhs_value,
14172 RawType rhs_value) {
14173 const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
14174
14175 if (lhs.AlmostEquals(rhs)) {
14176 return AssertionSuccess();
14177 }
14178
14179 ::std::stringstream lhs_ss;
14180 lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
14181 << lhs_value;
14182
14183 ::std::stringstream rhs_ss;
14184 rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
14185 << rhs_value;
14186
14187 return EqFailure(lhs_expression,
14188 rhs_expression,
14189 StringStreamToString(&lhs_ss),
14190 StringStreamToString(&rhs_ss),
14191 false);
14192}
14193
14194// Helper function for implementing ASSERT_NEAR.
14195//

Callers

nothing calls this directly

Calls 4

AssertionSuccessFunction · 0.85
EqFailureFunction · 0.85
StringStreamToStringFunction · 0.85
AlmostEqualsMethod · 0.80

Tested by

no test coverage detected