Commit | Line | Data |
---|---|---|
d58b8198 MW |
1 | /* -*-c-*- |
2 | * | |
3 | * Definitions for testing | |
4 | * | |
5 | * (c) 2023 Mark Wooding | |
6 | */ | |
7 | ||
8 | /*----- Licensing notice --------------------------------------------------* | |
9 | * | |
10 | * This file is part of the `Finally' package. | |
11 | * | |
12 | * Finally is free software: you can redistribute it and/or modify it | |
13 | * under the terms of the GNU Library General Public License as published | |
14 | * by the Free Software Foundation; either version 2 of the License, or | |
15 | * (at your option) any later version. | |
16 | * | |
17 | * Finally is distributed in the hope that it will be useful, but WITHOUT | |
18 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
19 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | |
20 | * License for more details. | |
21 | * | |
22 | * You should have received a copy of the GNU Library General Public | |
23 | * License along with Finally. If not, write to the Free Software | |
24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
25 | * USA. | |
26 | */ | |
27 | ||
28 | #ifndef FINALLY_TEST_H | |
29 | #define FINALLY_TEST_H | |
30 | ||
31 | #ifdef __cplusplus | |
32 | extern "C" { | |
33 | #endif | |
34 | ||
35 | /*----- Utility macros ----------------------------------------------------*/ | |
36 | ||
37 | #define STR(x) STR1(x) | |
38 | #define STR1(x) #x | |
39 | #define WHERE __FILE__ ":" STR(__LINE__) | |
40 | ||
41 | /*----- Strange hacks -----------------------------------------------------*/ | |
42 | ||
43 | extern const int secretly_true; | |
44 | ||
45 | /*----- Functions provided ------------------------------------------------*/ | |
46 | ||
47 | #define STEP(s) check_step(s, WHERE) | |
48 | #define MISSTEP STEP(-1) | |
49 | ||
50 | extern void init_test(void); | |
51 | extern void begin_test(const char *name); | |
52 | extern void check_step(int s, const char *where); | |
53 | extern void end_test(void); | |
54 | extern void skip_test(const char *name, const char *excuse); | |
55 | extern int test_report(void); | |
56 | ||
57 | #if defined(HAVE_FEXCEPTIONS) | |
58 | # define TCF_THROW 1u | |
59 | extern void try_catch_outer(unsigned f); | |
60 | extern void try_catch_filling(unsigned f); | |
61 | extern void try_catch_inner(unsigned f); | |
62 | #endif | |
63 | ||
64 | /*----- That's all, folks -------------------------------------------------*/ | |
65 | ||
66 | #ifdef __cplusplus | |
67 | } | |
68 | #endif | |
69 | ||
70 | #endif |