Drake
AssertionResultCollector Class Reference

AssertionResultCollector helps with the creation of concise and well-traced testing subroutines when using googletest. More...

#include <drake/automotive/maliput/api/test_utilities/rules_test_utilities.h>

Public Member Functions

 AssertionResultCollector ()=default
 Constructs an empty AssertionResultCollector. More...
 
void AddResult (const char *filename, int line, const char *expression,::testing::AssertionResult result)
 Adds an AssertionResult to the collector. More...
 
::testing::AssertionResult result ()
 Returns an AssertionResult reflecting the current state of the collector, which is basically an and of the collected results. More...
 
int count () const
 Returns the number of results collected. More...
 
int failed () const
 Returns the number of failure results collected. More...
 

Detailed Description

AssertionResultCollector helps with the creation of concise and well-traced testing subroutines when using googletest.

Instead of invocations of EXPECT_*() or ASSERT_*() within a test subroutine, predicate-assertion functions are invoked and the resulting ::testing::AssertionResult instances should be collected by an instance of AssertionResultCollector. At the end of the subroutine, an AssertionResult, representing the and of all the collected results, can be extracted from the collector.

Constructor & Destructor Documentation

Constructs an empty AssertionResultCollector.

Member Function Documentation

void AddResult ( const char *  filename,
int  line,
const char *  expression,
::testing::AssertionResult  result 
)
inline

Adds an AssertionResult to the collector.

Typically this is not called directly, but is invoked via the ADD_RESULT() macro.

result is the AssertionResult to be collected. expression is a printable representation of the expression which yielded the result. filename and line, as would be produced by FILE and LINE preprocessor macros, identify the location of the expression which yielded result.

Here is the call graph for this function:

int count ( ) const
inline

Returns the number of results collected.

int failed ( ) const
inline

Returns the number of failure results collected.

::testing::AssertionResult result ( )
inline

Returns an AssertionResult reflecting the current state of the collector, which is basically an and of the collected results.

Here is the caller graph for this function:


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