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 <string> // IWYU pragma: keep
14#include <typeindex> // IWYU pragma: keep
15#include <unordered_set> // IWYU pragma: keep
16
17namespace beast::unit_test {
18
22class SuiteList : public detail::ConstContainer<std::set<SuiteInfo>>
23{
24private:
25#ifndef NDEBUG
28#endif
29
30public:
36 template <class Suite>
37 void
38 insert(char const* name, char const* module, char const* library, bool manual, int priority);
39};
40
41//------------------------------------------------------------------------------
42
43template <class Suite>
44void
46 char const* name,
47 char const* module,
48 char const* library,
49 bool manual,
50 int priority)
51{
52#ifndef NDEBUG
53 {
55 s = std::string(library) + "." + module + "." + name;
56 auto const result(names_.insert(s));
57 BOOST_ASSERT(result.second); // Duplicate name
58 }
59
60 {
61 auto const result(classes_.insert(std::type_index(typeid(Suite))));
62 BOOST_ASSERT(result.second); // Duplicate type
63 }
64#endif
65 cont().emplace(makeSuiteInfo<Suite>(name, module, library, manual, priority));
66}
67
68} // namespace beast::unit_test
A container of test suites.
Definition suite_list.h:23
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:45
std::unordered_set< std::string > names_
Definition suite_list.h:26
std::unordered_set< std::type_index > classes_
Definition suite_list.h:27
A testsuite class.
Definition suite.h:52
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:109