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

Function DoubleNearPredFormat

tests/gtest/gtest-all.cc:2857–2872  ·  view source on GitHub ↗

Helper function for implementing ASSERT_NEAR.

Source from the content-addressed store, hash-verified

2855
2856// Helper function for implementing ASSERT_NEAR.
2857AssertionResult DoubleNearPredFormat(const char* expr1,
2858 const char* expr2,
2859 const char* abs_error_expr,
2860 double val1,
2861 double val2,
2862 double abs_error) {
2863 const double diff = fabs(val1 - val2);
2864 if (diff <= abs_error) return AssertionSuccess();
2865
2866 return AssertionFailure()
2867 << "The difference between " << expr1 << " and " << expr2
2868 << " is " << diff << ", which exceeds " << abs_error_expr << ", where\n"
2869 << expr1 << " evaluates to " << val1 << ",\n"
2870 << expr2 << " evaluates to " << val2 << ", and\n"
2871 << abs_error_expr << " evaluates to " << abs_error << ".";
2872}
2873
2874
2875// Helper template for implementing FloatLE() and DoubleLE().

Callers

nothing calls this directly

Calls 2

AssertionSuccessFunction · 0.85
AssertionFailureFunction · 0.85

Tested by

no test coverage detected