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) { return s.manual() ? "|M| " : " "; };
27
28 for (auto const& s : global_suites())
29 {
30 log << prefix(s) << s.full_name() << '\n';
31
32 if (s.manual())
33 ++manual;
34 ++total;
35 }
36
37 log << amount(total, "suite") << " total, " << amount(manual, "manual suite") << std::endl;
38
39 pass();
40 }
41};
42
43BEAST_DEFINE_TESTSUITE_MANUAL(print, beast, beast);
44
45} // namespace unit_test
46} // 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:145
void pass()
Record a successful test condition.
Definition suite.h:495
T endl(T... args)
suite_list const & global_suites()
Holds test suites registered during static initialization.