ManaPlus
unittests.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2017-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef UNITTESTS_H
23 #define UNITTESTS_H
24 
25 #include "localconsts.h"
26 
27 #ifdef UNITTESTS_CATCH
28 #ifdef UNITTESTS_EMBED
29 #include "unittests/catch.hpp"
30 #else // UNITTESTS_EMBED
31 #include <catch.hpp>
32 #endif // UNITTESTS_EMBED
33 #endif // UNITTESTS_CATCH
34 
35 #ifdef UNITTESTS_DOCTEST
36 
37 #ifdef __GNUC__
38 #if GCC_VERSION >= 50000
39 #define PRAGMA5(str) _Pragma(#str)
40 #elif defined(__clang__)
41 #define PRAGMA5(str) _Pragma(#str)
42 #else // GCC_VERSION > 50000
43 #define PRAGMA5(str)
44 #endif // GCC_VERSION > 50000
45 #endif // __GNUC__
46 
47 PRAGMA5(GCC diagnostic push)
48 PRAGMA5(GCC diagnostic ignored "-Wsuggest-override")
49 #ifdef UNITTESTS_EMBED
50 #include "unittests/doctest.h"
51 #else // UNITTESTS_EMBED
52 #include <doctest/doctest.h>
53 #endif // UNITTESTS_EMBED
54 PRAGMA5(GCC diagnostic pop)
55 
56 #undef TEST_CASE
57 #define TEST_CASE(name, tags) DOCTEST_TEST_CASE(name " " tags)
58 #define SECTION(name) DOCTEST_SUBCASE(name)
59 #endif // UNITTESTS_DOCTEST
60 
61 #endif // UNITTESTS_H