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