GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
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 |
#include "unittests/unittests.h" |
||
23 |
|||
24 |
#include "utils/stringutils.h" |
||
25 |
|||
26 |
PRAGMA48(GCC diagnostic push) |
||
27 |
PRAGMA48(GCC diagnostic ignored "-Wshadow") |
||
28 |
#include <SDL_image.h> |
||
29 |
#include <SDL_mixer.h> |
||
30 |
PRAGMACLANG5(GCC diagnostic push) |
||
31 |
PRAGMACLANG5(GCC diagnostic ignored "-Wzero-as-null-pointer-constant") |
||
32 |
PRAGMACLANG6GCC(GCC diagnostic push) |
||
33 |
PRAGMACLANG6GCC(GCC diagnostic ignored "-Wold-style-cast") |
||
34 |
#include <SDL_net.h> |
||
35 |
PRAGMACLANG6GCC(GCC diagnostic pop) |
||
36 |
PRAGMACLANG5(GCC diagnostic pop) |
||
37 |
#include <SDL_ttf.h> |
||
38 |
PRAGMA48(GCC diagnostic pop) |
||
39 |
|||
40 |
#include <zlib.h> |
||
41 |
|||
42 |
#ifdef ENABLE_LIBXML |
||
43 |
#include <libxml/globals.h> |
||
44 |
#endif // ENABLE_LIBXML |
||
45 |
|||
46 |
#include "debug.h" |
||
47 |
|||
48 |
✓✗ | 9 |
TEST_CASE("dumplibs tests", "") |
49 |
{ |
||
50 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
49 |
SECTION("zlib") |
51 |
{ |
||
52 |
✓✗ | 3 |
const std::string build = ZLIB_VERSION; |
53 |
✓✗✓✗ |
3 |
const std::string link = zlibVersion(); |
54 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(build == link); |
55 |
} |
||
56 |
|||
57 |
#ifdef ENABLE_LIBXML |
||
58 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
49 |
SECTION("libxml2") |
59 |
{ |
||
60 |
✓✗ | 1 |
const char **xmlVersion = __xmlParserVersion(); |
61 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(xmlVersion != nullptr); |
62 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(*xmlVersion != nullptr); |
63 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
10 |
REQUIRE(std::string(*xmlVersion) == |
64 |
std::string(LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA)); |
||
65 |
} |
||
66 |
#endif // ENABLE_LIBXML |
||
67 |
|||
68 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
49 |
SECTION("sdl") |
69 |
{ |
||
70 |
1 |
const SDL_version *linkVersion = nullptr; |
|
71 |
#ifdef USE_SDL2 |
||
72 |
SDL_version sdlVersion; |
||
73 |
1 |
sdlVersion.major = 0; |
|
74 |
1 |
sdlVersion.minor = 0; |
|
75 |
1 |
sdlVersion.patch = 0; |
|
76 |
✓✗ | 1 |
SDL_GetVersion(&sdlVersion); |
77 |
1 |
linkVersion = &sdlVersion; |
|
78 |
#else // USE_SDL2 |
||
79 |
linkVersion = SDL_Linked_Version(); |
||
80 |
#endif // USE_SDL2 |
||
81 |
|||
82 |
const std::string build = strprintf("%d.%d.%d", |
||
83 |
SDL_MAJOR_VERSION, |
||
84 |
SDL_MINOR_VERSION, |
||
85 |
✓✗ | 2 |
SDL_PATCHLEVEL); |
86 |
const std::string link = strprintf("%d.%d.%d", |
||
87 |
1 |
linkVersion->major, |
|
88 |
1 |
linkVersion->minor, |
|
89 |
✓✗ | 4 |
linkVersion->patch); |
90 |
|||
91 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(build == link); |
92 |
} |
||
93 |
|||
94 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
49 |
SECTION("sdl_net") |
95 |
{ |
||
96 |
✓✗ | 1 |
const SDL_version *const linkVersion = SDLNet_Linked_Version(); |
97 |
|||
98 |
const std::string build = strprintf("%d.%d.%d", |
||
99 |
SDL_NET_MAJOR_VERSION, |
||
100 |
SDL_NET_MINOR_VERSION, |
||
101 |
✓✗ | 2 |
SDL_NET_PATCHLEVEL); |
102 |
const std::string link = strprintf("%d.%d.%d", |
||
103 |
1 |
linkVersion->major, |
|
104 |
1 |
linkVersion->minor, |
|
105 |
✓✗ | 4 |
linkVersion->patch); |
106 |
|||
107 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(build == link); |
108 |
} |
||
109 |
|||
110 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
49 |
SECTION("sdl_image") |
111 |
{ |
||
112 |
✓✗ | 1 |
const SDL_version *const linkVersion = IMG_Linked_Version(); |
113 |
|||
114 |
const std::string build = strprintf("%d.%d.%d", |
||
115 |
SDL_IMAGE_MAJOR_VERSION, |
||
116 |
SDL_IMAGE_MINOR_VERSION, |
||
117 |
✓✗ | 2 |
SDL_IMAGE_PATCHLEVEL); |
118 |
const std::string link = strprintf("%d.%d.%d", |
||
119 |
1 |
linkVersion->major, |
|
120 |
1 |
linkVersion->minor, |
|
121 |
✓✗ | 4 |
linkVersion->patch); |
122 |
|||
123 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(build == link); |
124 |
} |
||
125 |
|||
126 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
49 |
SECTION("sdl_mixer") |
127 |
{ |
||
128 |
✓✗ | 1 |
const SDL_version *const linkVersion = Mix_Linked_Version(); |
129 |
|||
130 |
const std::string build = strprintf("%d.%d.%d", |
||
131 |
SDL_MIXER_MAJOR_VERSION, |
||
132 |
SDL_MIXER_MINOR_VERSION, |
||
133 |
✓✗ | 2 |
SDL_MIXER_PATCHLEVEL); |
134 |
const std::string link = strprintf("%d.%d.%d", |
||
135 |
1 |
linkVersion->major, |
|
136 |
1 |
linkVersion->minor, |
|
137 |
✓✗ | 4 |
linkVersion->patch); |
138 |
|||
139 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(build == link); |
140 |
} |
||
141 |
|||
142 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
49 |
SECTION("sdl_ttf") |
143 |
{ |
||
144 |
✓✗ | 1 |
const SDL_version *const linkVersion = TTF_Linked_Version(); |
145 |
|||
146 |
const std::string build = strprintf("%d.%d.%d", |
||
147 |
SDL_TTF_MAJOR_VERSION, |
||
148 |
SDL_TTF_MINOR_VERSION, |
||
149 |
✓✗ | 2 |
SDL_TTF_PATCHLEVEL); |
150 |
const std::string link = strprintf("%d.%d.%d", |
||
151 |
1 |
linkVersion->major, |
|
152 |
1 |
linkVersion->minor, |
|
153 |
✓✗ | 4 |
linkVersion->patch); |
154 |
|||
155 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(build == link); |
156 |
} |
||
157 |
✓✗✓✗ |
10 |
} |
Generated by: GCOVR (Version 3.3) |