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