MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / DoubleNearPredFormat

Function DoubleNearPredFormat

rtpose_wrapper/src/gtest/gtest-all.cpp:2339–2356  ·  view source on GitHub ↗

Helper function for implementing ASSERT_NEAR.

Source from the content-addressed store, hash-verified

2337
2338// Helper function for implementing ASSERT_NEAR.
2339AssertionResult DoubleNearPredFormat(const char* expr1,
2340 const char* expr2,
2341 const char* abs_error_expr,
2342 double val1,
2343 double val2,
2344 double abs_error) {
2345 const double diff = fabs(val1 - val2);
2346 if (diff <= abs_error) return AssertionSuccess();
2347
2348 // TODO(wan): do not print the value of an expression if it's
2349 // already a literal.
2350 return AssertionFailure()
2351 << "The difference between " << expr1 << " and " << expr2
2352 << " is " << diff << ", which exceeds " << abs_error_expr << ", where\n"
2353 << expr1 << " evaluates to " << val1 << ",\n"
2354 << expr2 << " evaluates to " << val2 << ", and\n"
2355 << abs_error_expr << " evaluates to " << abs_error << ".";
2356}
2357
2358
2359// 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