rippled
Loading...
Searching...
No Matches
define_print.cpp
1// Distributed under the Boost Software License, Version 1.0. (See accompanying
2// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
3//
4
5#include <xrpl/beast/unit_test/amount.h>
6#include <xrpl/beast/unit_test/global_suites.h>
7#include <xrpl/beast/unit_test/suite.h>
8
9#include <string>
10
11// Include this .cpp in your project to gain access to the printing suite
12
13namespace beast {
14namespace unit_test {
15
17class print_test : public suite
18{
19public:
20 void
21 run() override
22 {
23 std::size_t manual = 0;
24 std::size_t total = 0;
25
26 auto prefix = [](suite_info const& s) {
27 return s.manual() ? "|M| " : " ";
28 };
29
30 for (auto const& s : global_suites())
31 {
32 log << prefix(s) << s.full_name() << '\n';
33
34 if (s.manual())
35 ++manual;
36 ++total;
37 }
38
39 log << amount(total, "suite") << " total, "
40 << amount(manual, "manual suite") << std::endl;
41
42 pass();
43 }
44};
45
46BEAST_DEFINE_TESTSUITE_MANUAL(print, beast, beast);
47
48} // namespace unit_test
49} // 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:20
A testsuite class.
Definition suite.h:52
log_os< char > log
Logging output stream.
Definition suite.h:149
void pass()
Record a successful test condition.
Definition suite.h:508
T endl(T... args)
suite_list const & global_suites()
Holds test suites registered during static initialization.