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
21class print_test : public Suite
22{
23public:
24 void
25 run() override
26 {
27 std::size_t manual = 0;
28 std::size_t total = 0;
29
30 auto prefix = [](SuiteInfo const& s) { return s.manual() ? "|M| " : " "; };
31
32 for (auto const& s : globalSuites())
33 {
34 log << prefix(s) << s.fullName() << '\n';
35
36 if (s.manual())
37 ++manual;
38 ++total;
39 }
40
41 log << Amount(total, "suite") << " total, " << Amount(manual, "manual suite") << std::endl;
42
43 pass();
44 }
45};
46
48
49} // 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:20
void pass()
Record a successful test condition.
Definition suite.h:532
LogOs< char > log
Logging output stream.
Definition suite.h:150
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)