UFO: Alien Invasion
Loading...
Searching...
No Matches
test_mapstatistics.cpp
Go to the documentation of this file.
1
5
6/*
7Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, 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"
32#include "../common/routing.h"
33#include "../server/server.h"
34#include "../server/sv_rma.h"
35
36class MapDefStatsTest: public ::testing::Test {
37protected:
38 static void SetUpTestCase() {
39 TEST_Init();
40
41 sv_genericPool = Mem_CreatePool("mapdef-test");
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() {
63 }
64};
65
70TEST_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
void CL_InitLua(void)
Initializes the ui-lua interfacing environment.
Definition cl_lua.cpp:130
memPool_t * vid_imagePool
Definition cl_main.cpp:88
client_static_t cls
Definition cl_main.cpp:83
memPool_t * cl_genericPool
Definition cl_main.cpp:86
void R_FontInit(void)
Definition r_font.cpp:716
Share stuff between the different cgame implementations.
static void TearDownTestCase()
static void SetUpTestCase()
Primary header for client.
csi_t csi
Definition common.cpp:39
cvar_t * port
Definition common.cpp:58
memPool_t * com_networkPool
Definition common.cpp:73
cvar_t * masterserver_url
Definition common.cpp:57
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
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
#define Mem_CreatePool(name)
Definition mem.h:32
void NET_Shutdown(void)
Definition net.cpp:337
#define MapDef_Foreach(var)
Definition q_shared.h:505
rstate_t r_state
Definition r_main.cpp:48
grid pathfinding and routing
void Com_ParseScripts(bool onlyServer)
Definition scripts.cpp:3619
Main server include file.
memPool_t * sv_genericPool
Definition sv_main.cpp:55
cvar_t * sv_public
Definition sv_main.cpp:52
cvar_t * sv_dumpmapassembly
Definition sv_main.cpp:47
#define Q_streq(a, b)
Definition shared.h:136
#define OBJZERO(obj)
Definition shared.h:178
char * mapTheme
Definition q_shared.h:464
char * id
Definition q_shared.h:463
linkedList_t * params
Definition q_shared.h:465
void SV_PrintAssemblyStats(const char *mapTheme, const char *asmName)
Definition sv_rma.cpp:2229
TEST_F(MapDefStatsTest, DISABLED_MapDefStatistic)
This test cycles through the list of map definitions found in the maps.ufo script and collects some p...
void TEST_Shutdown(void)
const char * TEST_GetStringProperty(const char *name)
void TEST_Init(void)
void UI_Init(void)
Definition ui_main.cpp:278