Next: , Up: C++ Report Reference   [Contents][Index]


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:

  1. None.

Effects:

  1. None.

Postconditions:

  1. 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:

  1. None.

Effects:

  1. The validity from other is transferred to *this.
  2. If other was valid, the state of other is transferred to *this.

Postconditions:

  1. other is not a valid object. Only destruction and assignment are defined on it.


C++ Method: char const* report::name () const

Preconditions:

  1. *this is a valid object.

Effects:

  1. None.

Postconditions:

  1. 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:

  1. *this is a valid object.

Effects:

  1. None.

Postconditions:

  1. The returned value points to the start of the sequence of test reports associated to *this.


C++ Method: <iterator> report::end () const

Preconditions:

  1. *this is a valid object.

Effects:

  1. None.

Postconditions:

  1. The returned value points to the end of the sequence of test reports associated to *this.


C++ Method: <iterator> report::rbegin () const

Preconditions:

  1. *this is a valid object.

Effects:

  1. None.

Postconditions:

  1. The returned value points to the last element of the sequence of test reports associated to *this.


C++ Method: <iterator> report::rend () const

Preconditions:

  1. *this is a valid object.

Effects:

  1. None.

Postconditions:

  1. 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:

  1. *this is a valid object.

Effects:

  1. None.

Postconditions:

  1. The returned value is the number of tests associated to *this.


C++ Method: bool report::empty () const

Preconditions:

  1. *this is a valid object.

Effects:

  1. None.

Postconditions:

  1. The return value is true if the number of executed tests was zero.


C++ Method: report::range report::tests () const

Preconditions:

  1. *this is a valid object.

Effects:

  1. None.

Postconditions:

  1. 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:

  1. *this is a valid object.

Effects:

  1. None.

Postconditions:

  1. 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:

  1. *this is a valid object.

Effects:

  1. None.

Postconditions:

  1. 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:

  1. *this is a valid object.

Effects:

  1. None.

Postconditions:

  1. 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:

  1. *this is a valid object.

Effects:

  1. The report associated to *this is printed to the standard output.
  2. The default values, as returned by a call to io::default_output_values, are emitted.
  3. The default format is used to print the values.

Postconditions:

  1. 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:

  1. *this is a valid object.
  2. out is associated to a valid stream.
  3. out can receive an indeterminate amount of characters.

Effects:

  1. The report associated to *this is printed to the stream associated to out.
  2. The default values, as returned by a call to io::default_output_values, are emitted.
  3. The default format is used to print the values.

Postconditions:

  1. out has been flushed.


C++ Function: std::ostream& operator<< (std::ostream& out, report const& rep)

Preconditions:

  1. *this is a valid object.
  2. out is associated to a valid stream.
  3. out can receive an indeterminate amount of characters.

Effects:

  1. The report associated to *this is printed to the stream associated to out.
  2. The provided values are emitted.
  3. The provided format is used to print the values.

Postconditions:

  1. 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:

  1. *this is a valid object.

Effects:

  1. The report associated to *this is printed to the standard output.
  2. The provided values are emitted.
  3. The default format is used to print the values.

Postconditions:

  1. 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:

  1. *this is a valid object.
  2. out is associated to a valid stream.
  3. out can receive an indeterminate amount of characters.

Effects:

  1. The report associated to *this is printed to the stream associated to out.
  2. The provided values are emitted.
  3. The default format is used to print the values.

Postconditions:

  1. 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:

  1. *this is a valid object.
  2. format is a valid object.

Effects:

  1. The report associated to *this is printed to the standard output.
  2. The default values, as returned by a call to io::default_output_values, are emitted.
  3. The provided format is used to print the values.

Postconditions:

  1. 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:

  1. *this is a valid object.
  2. out is associated to a valid stream.
  3. out can receive an indeterminate amount of characters.
  4. format is a valid object.

Effects:

  1. The report associated to *this is printed to the stream associated to out.
  2. The default values, as returned by a call to io::default_output_values, are emitted.
  3. The provided format is used to print the values.

Postconditions:

  1. 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:

  1. *this is a valid object.
  2. out is associated to a valid stream.
  3. out can receive an indeterminate amount of characters.
  4. format is a valid object.
  5. values is a valid object.

Effects:

  1. The report associated to *this is printed to the stream associated to out.
  2. The provided values are emitted.
  3. The provided format is used to print the values.

Postconditions:

  1. 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:

  1. *this is a valid object.
  2. this->print (std::declval<std::ostream>, args...) is a valid expression.

Effects:

  1. The parameters into the returned object for its later usage.

Postconditions:

  1. 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:

  1. report was obtained by a report::with_args call.
  2. The report that generated report is still valid.
  3. out is associated to a valid stream.
  4. out can receive an indeterminate amount of characters.

Effects:

  1. 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:

  1. out was flushed.



Next: C++ Test Report Reference, Up: C++ Report Reference   [Contents][Index]