GDB (xrefs)
Loading...
Searching...
No Matches
gdb
unittests
optional-selftests.c
Go to the documentation of this file.
1
/* Self tests for optional for GDB, the GNU debugger.
2
3
Copyright (C) 2017-2023 Free Software Foundation, Inc.
4
5
This file is part of GDB.
6
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 3 of the License, or
10
(at your option) any later version.
11
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
16
17
You should have received a copy of the GNU General Public License
18
along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20
#include "
defs.h
"
21
#include "gdbsupport/selftest.h"
22
#include "gdbsupport/gdb_optional.h"
23
24
/* Used by the included .cc files below. Included here because the
25
included test files are wrapped in a namespace. */
26
#include <vector>
27
#include <string>
28
#include <memory>
29
30
/* libstdc++'s testsuite uses VERIFY. */
31
#define VERIFY SELF_CHECK
32
33
/* Used to disable testing features not supported by
34
gdb::optional. */
35
#define GDB_OPTIONAL
36
37
namespace
selftests
{
38
namespace
optional {
39
40
/* The actual tests live in separate files, which were originally
41
copied over from libstdc++'s testsuite. To preserve the structure
42
and help with comparison with the original tests, the file names
43
have been preserved, and only minimal modification was done to have
44
them compile against gdb::optional instead of std::optional:
45
46
- std::optional->gdb:optional, etc.
47
- ATTRIBUTE_UNUSED in a few places
48
- wrap each file in a namespace so they can all be compiled as a
49
single unit.
50
- libstdc++'s license and formatting style was preserved.
51
*/
52
53
#include "
optional/assignment/1.cc
"
54
#include "
optional/assignment/2.cc
"
55
#include "
optional/assignment/3.cc
"
56
#include "
optional/assignment/4.cc
"
57
#include "
optional/assignment/5.cc
"
58
#include "
optional/assignment/6.cc
"
59
#include "
optional/assignment/7.cc
"
60
#include "
optional/cons/copy.cc
"
61
#include "
optional/cons/default.cc
"
62
#include "
optional/cons/move.cc
"
63
#include "
optional/cons/value.cc
"
64
#include "
optional/in_place.cc
"
65
#include "
optional/observers/1.cc
"
66
#include "
optional/observers/2.cc
"
67
68
static
void
69
run_tests
()
70
{
71
assign_1::test
();
72
assign_2::test
();
73
assign_3::test
();
74
assign_4::test
();
75
assign_5::test
();
76
assign_6::test
();
77
assign_7::test
();
78
cons_copy::test
();
79
cons_default::test
();
80
cons_move::test
();
81
cons_value::test
();
82
in_place::test
();
83
observers_1::test
();
84
observers_2::test
();
85
}
86
87
}
/* namespace optional */
88
}
/* namespace selftests */
89
90
void
_initialize_optional_selftests
();
91
void
92
_initialize_optional_selftests
()
93
{
94
selftests::register_test (
"optional"
,
selftests::optional::run_tests
);
95
}
5.cc
6.cc
7.cc
copy.cc
default.cc
defs.h
in_place.cc
move.cc
assign_1::test
static void test()
Definition
1.cc:96
assign_2::test
static void test()
Definition
2.cc:96
assign_3::test
static void test()
Definition
3.cc:96
assign_4::test
static void test()
Definition
4.cc:96
assign_5::test
static void test()
Definition
5.cc:32
assign_6::test
static void test()
Definition
6.cc:38
assign_7::test
static void test()
Definition
7.cc:21
cons_copy::test
static void test()
Definition
copy.cc:51
cons_default::test
static void test()
Definition
default.cc:37
cons_move::test
static void test()
Definition
move.cc:51
cons_value::test
static void test()
Definition
value.cc:59
in_place::test
static void test()
Definition
in_place.cc:21
observers_1::test
static void test()
Definition
1.cc:26
observers_2::test
static void test()
Definition
2.cc:28
selftests::optional::run_tests
static void run_tests()
Definition
optional-selftests.c:69
selftests
Definition
disasm-selftests.c:26
_initialize_optional_selftests
void _initialize_optional_selftests()
Definition
optional-selftests.c:92
1.cc
2.cc
3.cc
4.cc
1.cc
2.cc
value.cc
Generated by
1.10.0