UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
test_mapstatistics.cpp
Go to the documentation of this file.
1
5
6
/*
7
Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9
This program is free software; you can redistribute it and/or
10
modify it under the terms of the GNU General Public License
11
as published by the Free Software Foundation; either version 2
12
of the License, or (at your option) any later version.
13
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18
See the GNU General Public License for more details.
19
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24
*/
25
26
#include "
test_shared.h
"
27
#include "
../client/client.h
"
28
#include "
../client/cl_shared.h
"
29
#include "
../client/cl_lua.h
"
30
#include "
../client/renderer/r_state.h
"
31
#include "
../client/ui/ui_main.h
"
32
#include "
../common/routing.h
"
33
#include "
../server/server.h
"
34
#include "
../server/sv_rma.h
"
35
36
class
MapDefStatsTest
:
public
::testing::Test {
37
protected
:
38
static
void
SetUpTestCase
() {
39
TEST_Init
();
40
41
sv_genericPool
=
Mem_CreatePool
(
"mapdef-test"
);
42
com_networkPool
=
Mem_CreatePool
(
"Network"
);
43
vid_imagePool
=
Mem_CreatePool
(
"Vid: Image system"
);
44
sv_dumpmapassembly
=
Cvar_Get
(
"sv_dumpassembly"
,
"0"
);
45
sv_public
=
Cvar_Get
(
"sv_public"
,
"0"
);
46
port
=
Cvar_Get
(
"testport"
,
"27909"
);
47
masterserver_url
=
Cvar_Get
(
"masterserver_test"
,
"http://localhost"
);
48
49
cl_genericPool
=
Mem_CreatePool
(
"Client: Generic"
);
50
51
r_state
.active_texunit = &
r_state
.texunits[0];
52
R_FontInit
();
53
CL_InitLua
();
54
UI_Init
();
55
56
OBJZERO
(
cls
);
57
Com_ParseScripts
(
false
);
58
}
59
60
static
void
TearDownTestCase
() {
61
TEST_Shutdown
();
62
NET_Shutdown
();
63
}
64
};
65
70
TEST_F
(
MapDefStatsTest
, DISABLED_MapDefStatistic)
71
{
72
const
char
* filterId =
TEST_GetStringProperty
(
"mapdef-id"
);
73
const
mapDef_t
* md;
74
75
ASSERT_TRUE(
csi
.numMDs > 0);
76
77
MapDef_Foreach
(md) {
78
if
(md->
mapTheme
[0] ==
'.'
)
79
continue
;
80
if
(filterId && !
Q_streq
(filterId, md->
id
))
81
continue
;
82
83
const
char
* asmName = (
const
char
*)
LIST_GetByIdx
(md->
params
, 0);
84
SV_PrintAssemblyStats
(md->
mapTheme
, asmName);
85
}
86
}
87
CL_InitLua
void CL_InitLua(void)
Initializes the ui-lua interfacing environment.
Definition
cl_lua.cpp:130
cl_lua.h
vid_imagePool
memPool_t * vid_imagePool
Definition
cl_main.cpp:88
cls
client_static_t cls
Definition
cl_main.cpp:83
cl_genericPool
memPool_t * cl_genericPool
Definition
cl_main.cpp:86
R_FontInit
void R_FontInit(void)
Definition
r_font.cpp:716
cl_shared.h
Share stuff between the different cgame implementations.
MapDefStatsTest
Definition
test_mapstatistics.cpp:36
MapDefStatsTest::TearDownTestCase
static void TearDownTestCase()
Definition
test_mapstatistics.cpp:60
MapDefStatsTest::SetUpTestCase
static void SetUpTestCase()
Definition
test_mapstatistics.cpp:38
client.h
Primary header for client.
csi
csi_t csi
Definition
common.cpp:39
port
cvar_t * port
Definition
common.cpp:58
com_networkPool
memPool_t * com_networkPool
Definition
common.cpp:73
masterserver_url
cvar_t * masterserver_url
Definition
common.cpp:57
Cvar_Get
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags, const char *desc)
Init or return a cvar.
Definition
cvar.cpp:342
LIST_GetByIdx
void * LIST_GetByIdx(linkedList_t *list, int index)
Get an entry of a linked list by its index in the list.
Definition
list.cpp:362
Mem_CreatePool
#define Mem_CreatePool(name)
Definition
mem.h:32
NET_Shutdown
void NET_Shutdown(void)
Definition
net.cpp:337
MapDef_Foreach
#define MapDef_Foreach(var)
Definition
q_shared.h:505
r_state
rstate_t r_state
Definition
r_main.cpp:48
r_state.h
routing.h
grid pathfinding and routing
Com_ParseScripts
void Com_ParseScripts(bool onlyServer)
Definition
scripts.cpp:3619
server.h
Main server include file.
sv_genericPool
memPool_t * sv_genericPool
Definition
sv_main.cpp:55
sv_public
cvar_t * sv_public
Definition
sv_main.cpp:52
sv_dumpmapassembly
cvar_t * sv_dumpmapassembly
Definition
sv_main.cpp:47
Q_streq
#define Q_streq(a, b)
Definition
shared.h:136
OBJZERO
#define OBJZERO(obj)
Definition
shared.h:178
mapDef_t
Definition
q_shared.h:461
mapDef_t::mapTheme
char * mapTheme
Definition
q_shared.h:464
mapDef_t::id
char * id
Definition
q_shared.h:463
mapDef_t::params
linkedList_t * params
Definition
q_shared.h:465
SV_PrintAssemblyStats
void SV_PrintAssemblyStats(const char *mapTheme, const char *asmName)
Definition
sv_rma.cpp:2229
sv_rma.h
TEST_F
TEST_F(MapDefStatsTest, DISABLED_MapDefStatistic)
This test cycles through the list of map definitions found in the maps.ufo script and collects some p...
Definition
test_mapstatistics.cpp:70
TEST_Shutdown
void TEST_Shutdown(void)
Definition
test_shared.cpp:34
TEST_GetStringProperty
const char * TEST_GetStringProperty(const char *name)
Definition
test_shared.cpp:185
TEST_Init
void TEST_Init(void)
Definition
test_shared.cpp:72
test_shared.h
UI_Init
void UI_Init(void)
Definition
ui_main.cpp:278
ui_main.h
src
tests
test_mapstatistics.cpp
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.17.0