Celeritas 0.7-develop+0ab295a
Loading...
Searching...
No Matches
Public Member Functions | List of all members
celeritas::test::AssertionHelper Class Reference

Store and update an assertion result. More...

#include <AssertionHelper.hh>

Public Member Functions

 AssertionHelper (char const *expected_expr, char const *actual_expr, char const *tol_expr=default_tol_expr_)
 Construct with expected/actual expressions.
 
::testing::AssertionResult & fail ()
 Fail and return a streamable object.
 
bool equal_size (std::size_t expected, std::size_t actual)
 Check the sizes, returning success, adding failure message if not.
 
 operator::testing::AssertionResult const & () const
 Get the streamable assertion result.
 
 operator::testing::AssertionResult && () &&
 
char const * expected_expr () const
 Get the expected expression string.
 
char const * actual_expr () const
 Get the actual expression string.
 
char const * tol_expr () const
 Get the tolerance expression string.
 

Detailed Description

Store and update an assertion result.

This is used for IsRefEq implementations. For example:

AssertionHelper result(expr1, expr2);
if (a.foo != b.foo)
{
result.fail() << " foo: " << a.foo << " != " << b.foo;
}
is_attr_eq(result, ...);
is_soft_eq(result, ...);
is_vec_soft_eq(result, "bar", a.bar, b.bar);
return result;
Store and update an assertion result.
Definition AssertionHelper.hh:38
bool is_vec_soft_eq(AssertionHelper &helper, char const *field, Container const &expected, Container const &actual, Tol const &tol)
Perform vector soft equality comparison with a tolerance, appending error details on failure.
Definition TestMacrosImpl.hh:806
Todo:
This class is currently shared by standalone and nested class types, and it really needs to be refactored into a local result plus a nested stack of context.

The documentation for this class was generated from the following files: