rippled
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 <ripple/beast/unit_test/amount.hpp>
9 #include <ripple/beast/unit_test/global_suites.hpp>
10 #include <ripple/beast/unit_test/suite.hpp>
11 #include <string>
12 
13 // Include this .cpp in your project to gain access to the printing suite
14 
15 namespace beast {
16 namespace unit_test {
17 
19 class print_test : public suite
20 {
21 public:
22  void
23  run() override
24  {
25  std::size_t manual = 0;
26  std::size_t total = 0;
27 
28  auto prefix = [](suite_info const& s) {
29  return s.manual() ? "|M| " : " ";
30  };
31 
32  for (auto const& s : global_suites())
33  {
34  log << prefix(s) << s.full_name() << '\n';
35 
36  if (s.manual())
37  ++manual;
38  ++total;
39  }
40 
41  log << amount(total, "suite") << " total, "
42  << amount(manual, "manual suite") << std::endl;
43 
44  pass();
45  }
46 };
47 
49 
50 } // namespace unit_test
51 } // namespace beast
beast::unit_test::print_test
A suite that prints the list of globally defined suites.
Definition: define_print.cpp:19
beast::unit_test::print_test::run
void run() override
Definition: define_print.cpp:23
beast::unit_test::print
static void print(std::ostream &os, suite_list const &c)
Definition: main.cpp:42
beast::unit_test::BEAST_DEFINE_TESTSUITE_MANUAL
BEAST_DEFINE_TESTSUITE_MANUAL(print, unit_test, beast)
beast::unit_test::prefix
static std::string prefix(suite_info const &s)
Definition: main.cpp:34
std::endl
T endl(T... args)
std::size_t
beast
Definition: base_uint.h:641
string