maliput
|
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... | |
|
default |
Constructs an empty AssertionResultCollector.
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
.
int count | ( | ) | const |
Returns the number of results collected.
int failed | ( | ) | const |
Returns the number of failure results collected.
::testing::AssertionResult result | ( | ) |
Returns an AssertionResult reflecting the current state of the collector, which is basically an and
of the collected results.