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 <beast/unit_test/amount.hpp>
9 #include <beast/unit_test/global_suites.hpp>
10 #include <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  {
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 <<
43  amount (total, "suite") << " total, " <<
44  amount (manual, "manual suite") << std::endl;
45 
46  pass();
47  }
48 };
49 
50 BEAST_DEFINE_TESTSUITE_MANUAL(print,unit_test,beast);
51 
52 } // unit_test
53 } // 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::BEAST_DEFINE_TESTSUITE_MANUAL
BEAST_DEFINE_TESTSUITE_MANUAL(print, unit_test, beast)
std::endl
T endl(T... args)
std::size_t
beast
Definition: base_uint.h:582
string