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
#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
16
namespace
beast
{
17
namespace
unit_test {
18
20
class
suite_list
:
public
detail::const_container
<std::set<suite_info>>
21
{
22
private
:
23
#ifndef NDEBUG
24
std::unordered_set<std::string>
names_
;
25
std::unordered_set<std::type_index>
classes_
;
26
#endif
27
28
public
:
33
template
<
class
Suite>
34
void
35
insert
(
char
const
* name,
char
const
* module,
char
const
* library,
bool
manual,
int
priority);
36
};
37
38
//------------------------------------------------------------------------------
39
40
template
<
class
Suite>
41
void
42
suite_list::insert
(
char
const
* name,
char
const
* module,
char
const
* library,
bool
manual,
int
priority)
43
{
44
#ifndef NDEBUG
45
{
46
std::string
s;
47
s =
std::string
(library) +
"."
+
module
+ "." + name;
48
auto
const
result(
names_
.
insert
(s));
49
BOOST_ASSERT(result.second);
// Duplicate name
50
}
51
52
{
53
auto
const
result(
classes_
.
insert
(
std::type_index
(
typeid
(Suite))));
54
BOOST_ASSERT(result.second);
// Duplicate type
55
}
56
#endif
57
cont
().
emplace
(make_suite_info<Suite>(name, module, library, manual, priority));
58
}
59
60
}
// namespace unit_test
61
}
// namespace beast
std::string
beast::unit_test::detail::const_container
Adapter to constrain a container interface.
Definition
const_container.h:17
beast::unit_test::detail::const_container< std::set< suite_info > >::cont
cont_type & cont()
Definition
const_container.h:25
beast::unit_test::suite_list
A container of test suites.
Definition
suite_list.h:21
beast::unit_test::suite_list::classes_
std::unordered_set< std::type_index > classes_
Definition
suite_list.h:25
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:42
beast::unit_test::suite_list::names_
std::unordered_set< std::string > names_
Definition
suite_list.h:24
std::set::emplace
T emplace(T... args)
std::unordered_set::insert
T insert(T... args)
beast
Definition
base_uint.h:637
set
std::type_index
typeindex
unordered_set
Generated by
1.9.8