rippled
Loading...
Searching...
No Matches
define_print.cpp
1//
2// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
3//
4// Distributed under the Boost Software License, Version 1.0. (See accompanying
5// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7
8#include <xrpl/beast/unit_test/amount.h>
9#include <xrpl/beast/unit_test/global_suites.h>
10#include <xrpl/beast/unit_test/suite.h>
11#include <string>
12
13// Include this .cpp in your project to gain access to the printing suite
14
15namespace beast {
16namespace unit_test {
17
19class print_test : public suite
20{
21public:
22 void
23 run() override
24 {
25 std::size_t manual = 0;
26 std::size_t total = 0;
27
28 auto prefix = [](suite_info const& s) {
29 return s.manual() ? "|M| " : " ";
30 };
31
32 for (auto const& s : global_suites())
33 {
34 log << prefix(s) << s.full_name() << '\n';
35
36 if (s.manual())
37 ++manual;
38 ++total;
39 }
40
41 log << amount(total, "suite") << " total, "
42 << amount(manual, "manual suite") << std::endl;
43
44 pass();
45 }
46};
47
48BEAST_DEFINE_TESTSUITE_MANUAL(print, unit_test, beast);
49
50} // namespace unit_test
51} // namespace beast
Utility for producing nicely composed output of amounts with units.
A suite that prints the list of globally defined suites.
void run() override
Runs the suite.
Associates a unit test type with metadata.
Definition: suite_info.h:23
A testsuite class.
Definition: suite.h:53
log_os< char > log
Logging output stream.
Definition: suite.h:150
void pass()
Record a successful test condition.
Definition: suite.h:509
T endl(T... args)
suite_list const & global_suites()
Holds test suites registered during static initialization.
Definition: global_suites.h:44