5.4.1 C++ Suite Report Reference
- C++ Type: report ¶
-
Valid objects of this type represent the report generated by the
execution of a suite
object.
- C++ Constructor: report::report () ¶
-
Preconditions:
- None.
Effects:
- None.
Postconditions:
- The only operations defined on
*this
are the assignment and the
destruction.
- C++ Constructor: report::report (report&& other)
noexcept
¶
-
- C++ Assignment Operator: report& report::report (report&& report)
noexcept
¶
-
Preconditions:
- None.
Effects:
- The validity from other is transferred to
*this
.
- If other was valid, the state of other is
transferred to
*this
.
Postconditions:
- other is not a valid object. Only destruction and assignment
are defined on it.
- C++ Method: char const* report::name () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- None.
Postconditions:
- The returned value is equivalent to the name of the suite that
generated the report represented by
*this
.
The following functions allow the iteration over the reports. You may
write on your code:
report rep = @dots{};
for (auto const& test: rep)
do_something_with_test (test);
for (auto const& e: rep.exections ())
do_something_with_execution (e);
- C++ Method: <iterator> report::begin () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- None.
Postconditions:
- The returned value points to the start of the sequence of test reports
associated to
*this
.
- C++ Method: <iterator> report::end () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- None.
Postconditions:
- The returned value points to the end of the sequence of test reports
associated to
*this
.
- C++ Method: <iterator> report::rbegin () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- None.
Postconditions:
- The returned value points to the last element of the sequence of test
reports associated to
*this
.
- C++ Method: <iterator> report::rend () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- None.
Postconditions:
- The returned value points to the reverse end of the sequence of test
reports associated to
*this
.
- C++ Method: std::size_t report::size () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- None.
Postconditions:
- The returned value is the number of tests associated to
*this
.
- C++ Method: bool report::empty () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- None.
Postconditions:
- The return value is
true
if the number of executed tests was
zero.
- C++ Method: report::range report::tests () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- None.
Postconditions:
- The returned value is a valid range to iterate over the tests
associated to
*this
in order of execution.
- C++ Method: report::reverse_range report::reverse_tests () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- None.
Postconditions:
- The returned value is a valid range to iterate over the tests
associated to
*this
in reverse order of execution.
- C++ Method: <range> report::executions () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- None.
Postconditions:
- The returned value is a valid range to iterate over the test
executions associated to
*this
in the order of execution.
- C++ Method: <range> report::reverse_executions () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- None.
Postconditions:
- The returned value is a valid range to iterate over the test
executions associated to
*this
in reverse order of execution.
The following functions print the report with the default format
(see Report Output.).
- C++ Method: void report::print () const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- The report associated to
*this
is printed to the standard
output.
- The default values, as returned by a call to
io::default_output_values
, are emitted.
- The default format is used to print the values.
Postconditions:
- The standard output has been flushed.
- C++ Method: void report::print (std::FILE* out) const ¶
-
- C++ Instance: void report::print (std::ostream& out) const ¶
-
Preconditions:
-
*this
is a valid object.
- out is associated to a valid stream.
- out can receive an indeterminate amount of characters.
Effects:
- The report associated to
*this
is printed to the stream
associated to out.
- The default values, as returned by a call to
io::default_output_values
, are emitted.
- The default format is used to print the values.
Postconditions:
- out has been flushed.
- C++ Function: std::ostream& operator<< (std::ostream& out, report const& rep) ¶
-
Preconditions:
-
*this
is a valid object.
- out is associated to a valid stream.
- out can receive an indeterminate amount of characters.
Effects:
- The report associated to
*this
is printed to the stream
associated to out.
- The provided values are emitted.
- The provided format is used to print the values.
Postconditions:
- out has been flushed.
Note: this function can only be called through argument-dependent
lookup.
The following overloads emit customized output.
- C++ Method: void report::print (io::output_values const& values) const ¶
-
Preconditions:
-
*this
is a valid object.
Effects:
- The report associated to
*this
is printed to the standard
output.
- The provided values are emitted.
- The default format is used to print the values.
Postconditions:
- The standard output has been flushed.
- C++ Method: void report::print (std::FILE* out, io::output_values const& values) const ¶
-
- C++ Instance: void report::print (std::ostream& out, io::output_values const& values) const ¶
-
Preconditions:
-
*this
is a valid object.
- out is associated to a valid stream.
- out can receive an indeterminate amount of characters.
Effects:
- The report associated to
*this
is printed to the stream
associated to out.
- The provided values are emitted.
- The default format is used to print the values.
Postconditions:
- out has been flushed.
The following functions print the report using the format provided as
its parameter (see Report Output.)
- C++ Method: void report::print (io::output_type format) const ¶
-
Preconditions:
-
*this
is a valid object.
- format is a valid object.
Effects:
- The report associated to
*this
is printed to the standard
output.
- The default values, as returned by a call to
io::default_output_values
, are emitted.
- The provided format is used to print the values.
Postconditions:
- The standard output has been flushed.
- C++ Method: void report::print (std::FILE* out, io::output_type format) const ¶
-
- C++ Instance: void report::print (std::ostream& out, io::output_type format) const ¶
-
Preconditions:
-
*this
is a valid object.
- out is associated to a valid stream.
- out can receive an indeterminate amount of characters.
- format is a valid object.
Effects:
- The report associated to
*this
is printed to the stream
associated to out.
- The default values, as returned by a call to
io::default_output_values
, are emitted.
- The provided format is used to print the values.
Postconditions:
- out has been flushed.
- C++ Method: void report::print (FILE* out, io::output_type type, io::output_values const& values) const ¶
-
- C++ Instance: void report::print (std::ostream& out, io::output_type type, io::output_values const& values) const ¶
-
Preconditions:
-
*this
is a valid object.
- out is associated to a valid stream.
- out can receive an indeterminate amount of characters.
- format is a valid object.
- values is a valid object.
Effects:
- The report associated to
*this
is printed to the stream
associated to out.
- The provided values are emitted.
- The provided format is used to print the values.
Postconditions:
- out has been flushed.
Extra Arguments For operator<<
The following method allow the customization of the output obtained by
operator<<
. It can be used as the following example:
using micro_benchmark::io::output_type;
report rep = @dots{};
// Print the lisp report to std::cout
std::cout << rep.with_args (output_type::lisp);
@dots{}
- C++ Method Template: <with-args-ret> report::with_args (Args&&... args) const ¶
-
Preconditions:
-
*this
is a valid object.
-
this->print (std::declval<std::ostream>, args...)
is a valid
expression.
Effects:
- The parameters into the returned object for its later usage.
Postconditions:
- The returned object contains a reference to
this
. Its validity
is bounded to the validity of this
.
- C++ Function: std::ostream& operator<< (std::ostream& out, <with-args-ret>&& report) ¶
-
Preconditions:
- report was obtained by a
report::with_args
call.
- The report that generated report is still valid.
- out is associated to a valid stream.
- out can receive an indeterminate amount of characters.
Effects:
- Call
ptr->print (out, args...)
where ptr
is the
report referenced by report and args...
were the
arguments provided to the call report::with_args
.
Postconditions:
- out was flushed.