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
12#include <string>
13
14// Include this .cpp in your project to gain access to the printing suite
15
16namespace beast {
17namespace unit_test {
18
20class print_test : public suite
21{
22public:
23 void
24 run() override
25 {
26 std::size_t manual = 0;
27 std::size_t total = 0;
28
29 auto prefix = [](suite_info const& s) {
30 return s.manual() ? "|M| " : " ";
31 };
32
33 for (auto const& s : global_suites())
34 {
35 log << prefix(s) << s.full_name() << '\n';
36
37 if (s.manual())
38 ++manual;
39 ++total;
40 }
41
42 log << amount(total, "suite") << " total, "
43 << amount(manual, "manual suite") << std::endl;
44
45 pass();
46 }
47};
48
49BEAST_DEFINE_TESTSUITE_MANUAL(print, beast, beast);
50
51} // namespace unit_test
52} // 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:55
log_os< char > log
Logging output stream.
Definition suite.h:152
void pass()
Record a successful test condition.
Definition suite.h:511
T endl(T... args)
suite_list const & global_suites()
Holds test suites registered during static initialization.