mi_load_progress: Restore current_uiout using a scoped_restore
[deliverable/binutils-gdb.git] / gdb / common / selftest.h
CommitLineData
dcd1f979 1/* GDB self-testing.
61baf725 2 Copyright (C) 2016-2017 Free Software Foundation, Inc.
dcd1f979
TT
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19#ifndef SELFTEST_H
20#define SELFTEST_H
21
22/* A test is just a function that does some checks and throws an
23 exception if something has gone wrong. */
24
25typedef void self_test_function (void);
26
7649770c
YQ
27namespace selftests
28{
29
dcd1f979
TT
30/* Register a new self-test. */
31
7649770c 32extern void register_test (self_test_function *function);
dcd1f979
TT
33
34/* Run all the self tests. This print a message describing the number
35 of test and the number of failures. */
36
7649770c
YQ
37extern void run_tests (void);
38
6d580b63
YQ
39/* Reset GDB or GDBserver's internal state. */
40extern void reset ();
41
7649770c 42}
dcd1f979
TT
43
44/* Check that VALUE is true, and, if not, throw an exception. */
45
46#define SELF_CHECK(VALUE) \
47 do { \
48 if (!(VALUE)) \
49 error (_("self-test failed at %s:%d"), __FILE__, __LINE__); \
50 } while (0)
51
52#endif /* SELFTEST_H */
This page took 0.135773 seconds and 4 git commands to generate.