xrpld
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::unit_test {
17
19class SuiteList : public detail::ConstContainer<std::set<SuiteInfo>>
20{
21private:
22#ifndef NDEBUG
25#endif
26
27public:
32 template <class Suite>
33 void
34 insert(char const* name, char const* module, char const* library, bool manual, int priority);
35};
36
37//------------------------------------------------------------------------------
38
39template <class Suite>
40void
42 char const* name,
43 char const* module,
44 char const* library,
45 bool manual,
46 int priority)
47{
48#ifndef NDEBUG
49 {
51 s = std::string(library) + "." + module + "." + name;
52 auto const result(names_.insert(s));
53 BOOST_ASSERT(result.second); // Duplicate name
54 }
55
56 {
57 auto const result(classes_.insert(std::type_index(typeid(Suite))));
58 BOOST_ASSERT(result.second); // Duplicate type
59 }
60#endif
61 cont().emplace(makeSuiteInfo<Suite>(name, module, library, manual, priority));
62}
63
64} // namespace beast::unit_test
A container of test suites.
Definition suite_list.h:20
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:41
std::unordered_set< std::string > names_
Definition suite_list.h:23
std::unordered_set< std::type_index > classes_
Definition suite_list.h:24
A testsuite class.
Definition suite.h:50
Adapter to constrain a container interface.
T emplace(T... args)
SuiteInfo makeSuiteInfo(std::string name, std::string module, std::string library, bool manual, int priority)
Convenience for producing SuiteInfo for a given test type.
Definition suite_info.h:99