5#ifndef BEAST_UNIT_TEST_REPORTER_HPP 
    6#define BEAST_UNIT_TEST_REPORTER_HPP 
    8#include <xrpl/beast/unit_test/amount.h> 
    9#include <xrpl/beast/unit_test/recorder.h> 
   11#include <boost/lexical_cast.hpp> 
   12#include <boost/optional.hpp> 
   30template <
class = 
void>
 
   96    fmtdur(
typename clock_type::duration 
const& d);
 
 
  146            [](
run_time const& t1, 
typename clock_type::duration 
const& t2) {
 
  147                return t1.second > t2;
 
  149        if (iter != 
top.end())
 
  152                top.resize(
top.size() - 1);
 
  153            top.emplace(iter, r.
name, elapsed);
 
  157            top.emplace_back(r.
name, elapsed);
 
 
  172    if (results_.top.size() > 0)
 
  174        os_ << 
"Longest suite times:\n";
 
  175        for (
auto const& i : results_.top)
 
  176            os_ << 
std::setw(8) << fmtdur(i.second) << 
" " << i.first << 
'\n';
 
  178    auto const elapsed = clock_type::now() - results_.start;
 
  179    os_ << fmtdur(elapsed) << 
", " << 
amount{results_.suites, 
"suite"} << 
", " 
  180        << 
amount{results_.cases, 
"case"} << 
", " 
  181        << 
amount{results_.total, 
"test"} << 
" total, " 
 
  190    auto const ms = duration_cast<milliseconds>(d);
 
  192        return boost::lexical_cast<std::string>(ms.count()) + 
"ms";
 
 
  209    results_.add(suite_results_);
 
 
  217    os_ << suite_results_.name
 
  218        << (case_results_.name.empty() ? 
"" : (
" " + case_results_.name))
 
 
  226    suite_results_.add(case_results_);
 
 
  233    ++case_results_.total;
 
 
  240    ++case_results_.failed;
 
  241    ++case_results_.total;
 
  242    os_ << 
"#" << case_results_.total << 
" failed" 
 
Utility for producing nicely composed output of amounts with units.
 
A simple test runner that writes everything to a stream in real time.
 
virtual void on_log(std::string const &s) override
Called when a test logs output.
 
suite_results suite_results_
 
reporter(reporter const &)=delete
 
virtual void on_case_end() override
Called when a new case ends.
 
case_results case_results_
 
reporter & operator=(reporter const &)=delete
 
virtual void on_suite_begin(suite_info const &info) override
Called when a new suite starts.
 
virtual void on_case_begin(std::string const &name) override
Called when a new case starts.
 
virtual void on_fail(std::string const &reason) override
Called for each failing condition.
 
static std::string fmtdur(typename clock_type::duration const &d)
 
virtual void on_suite_end() override
Called when a suite ends.
 
virtual void on_pass() override
Called for each passing condition.
 
Unit test runner interface.
 
Associates a unit test type with metadata.
 
std::string full_name() const
Return the canonical suite name as a string.
 
T setprecision(T... args)
 
case_results(std::string name_="")
 
clock_type::time_point start
 
std::vector< run_time > top
 
void add(suite_results const &r)
 
void add(case_results const &r)
 
suite_results(std::string name_="")
 
clock_type::time_point start