maliput
AssertionResultCollector Class Reference

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.

#include <include/maliput/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...
 

Constructor & Destructor Documentation

◆ AssertionResultCollector()

Constructs an empty AssertionResultCollector.

Member Function Documentation

◆ AddResult()

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

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.

◆ count()

int count ( ) const

Returns the number of results collected.

◆ failed()

int failed ( ) const

Returns the number of failure results collected.

◆ result()

::testing::AssertionResult result ( )

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


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