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