xrpld
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#include <xrpl/beast/unit_test/suite_info.h>
9
10#include <cstddef>
11#include <ostream>
12#include <string>
13
14// Include this .cpp in your project to gain access to the printing suite
15
16namespace beast::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 = [](SuiteInfo const& s) { return s.manual() ? "|M| " : " "; };
29
30 for (auto const& s : globalSuites())
31 {
32 log << prefix(s) << s.fullName() << '\n';
33
34 if (s.manual())
35 ++manual;
36 ++total;
37 }
38
39 log << Amount(total, "suite") << " total, " << Amount(manual, "manual suite") << std::endl;
40
41 pass();
42 }
43};
44
46
47} // namespace beast::unit_test
Utility for producing nicely composed output of amounts with units.
Associates a unit test type with metadata.
Definition suite_info.h:18
void pass()
Record a successful test condition.
Definition suite.h:500
LogOs< char > log
Logging output stream.
Definition suite.h:146
A suite that prints the list of globally defined suites.
void run() override
Runs the suite.
T endl(T... args)
SuiteList const & globalSuites()
Holds test suites registered during static initialization.
BEAST_DEFINE_TESTSUITE_MANUAL(print, beast, beast)