rippled
Loading...
Searching...
No Matches
suite_list.h
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#ifndef BEAST_UNIT_TEST_SUITE_LIST_HPP
6#define BEAST_UNIT_TEST_SUITE_LIST_HPP
7
8#include <xrpl/beast/unit_test/detail/const_container.h>
9#include <xrpl/beast/unit_test/suite_info.h>
10
11#include <boost/assert.hpp>
12
13#include <set>
14#include <typeindex>
15#include <unordered_set>
16
17namespace beast {
18namespace unit_test {
19
21class suite_list : public detail::const_container<std::set<suite_info>>
22{
23private:
24#ifndef NDEBUG
27#endif
28
29public:
34 template <class Suite>
35 void
36 insert(
37 char const* name,
38 char const* module,
39 char const* library,
40 bool manual,
41 int priority);
42};
43
44//------------------------------------------------------------------------------
45
46template <class Suite>
47void
49 char const* name,
50 char const* module,
51 char const* library,
52 bool manual,
53 int priority)
54{
55#ifndef NDEBUG
56 {
58 s = std::string(library) + "." + module + "." + name;
59 auto const result(names_.insert(s));
60 BOOST_ASSERT(result.second); // Duplicate name
61 }
62
63 {
64 auto const result(classes_.insert(std::type_index(typeid(Suite))));
65 BOOST_ASSERT(result.second); // Duplicate type
66 }
67#endif
68 cont().emplace(
69 make_suite_info<Suite>(name, module, library, manual, priority));
70}
71
72} // namespace unit_test
73} // namespace beast
74
75#endif
Adapter to constrain a container interface.
A container of test suites.
Definition suite_list.h:22
std::unordered_set< std::type_index > classes_
Definition suite_list.h:26
void insert(char const *name, char const *module, char const *library, bool manual, int priority)
Insert a suite into the set.
Definition suite_list.h:48
std::unordered_set< std::string > names_
Definition suite_list.h:25
T emplace(T... args)
T insert(T... args)