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