1 /* Self tests for optional for GDB, the GNU debugger.
3 Copyright (C) 2017-2018 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
22 #include "common/gdb_optional.h"
24 /* Used by the included .cc files below. Included here because the
25 included test files are wrapped in a namespace. */
30 /* libstdc++'s testsuite uses VERIFY. */
31 #define VERIFY SELF_CHECK
33 /* Used to disable testing features not supported by
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:
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
50 - libstdc++'s license and formatting style was preserved.
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"
79 cons_default::test ();
87 } /* namespace optional */
88 } /* namespace selftests */
91 _initialize_optional_selftests ()
93 selftests::register_test ("optional", selftests::optional::run_tests);