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