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
42suite_list::insert(char const* name, char const* module, char const* library, bool manual, int priority)
43{
44#ifndef NDEBUG
45 {
47 s = std::string(library) + "." + module + "." + name;
48 auto const result(names_.insert(s));
49 BOOST_ASSERT(result.second); // Duplicate name
50 }
51
52 {
53 auto const result(classes_.insert(std::type_index(typeid(Suite))));
54 BOOST_ASSERT(result.second); // Duplicate type
55 }
56#endif
57 cont().emplace(make_suite_info<Suite>(name, module, library, manual, priority));
58}
59
60} // namespace unit_test
61} // 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)