UFO: Alien Invasion
|
Shared code for unittests. More...
#include "test_shared.h"
#include "../client/cl_renderer.h"
#include "../client/cl_lua.h"
#include "../client/battlescape/cl_particle.h"
#include "../client/ui/ui_main.h"
#include <stdio.h>
#include <stdarg.h>
Go to the source code of this file.
Data Structures | |
struct | test_property_s |
Macros | |
#define | PROPERTY_HASH_SIZE 32 |
#define | MAX_PROPERTY_NAME 32 |
Typedefs | |
typedef struct test_property_s | test_property_t |
Functions | |
void | TEST_Shutdown (void) |
void | TEST_vPrintfSilent (const char *fmt, va_list argptr) |
void | TEST_vPrintf (const char *fmt, va_list argptr) |
void | TEST_Init (void) |
void | TEST_RegisterProperty (const char *name, const char *value) |
static const test_property_t * | TEST_GetProperty (const char *name) |
bool | TEST_ExistsProperty (const char *name) |
const char * | TEST_GetStringProperty (const char *name) |
int | TEST_GetIntProperty (const char *name) |
long | TEST_GetLongProperty (const char *name) |
Variables | |
static test_property_t * | test_property |
static test_property_t * | test_property_hash [PROPERTY_HASH_SIZE] |
Shared code for unittests.
Definition in file test_shared.cpp.
#define MAX_PROPERTY_NAME 32 |
Definition at line 108 of file test_shared.cpp.
#define PROPERTY_HASH_SIZE 32 |
Definition at line 106 of file test_shared.cpp.
Referenced by TEST_GetProperty(), and TEST_RegisterProperty().
typedef struct test_property_s test_property_t |
bool TEST_ExistsProperty | ( | const char * | name | ) |
Test if a property from global test structure exists
name | Name of the property |
Definition at line 175 of file test_shared.cpp.
References TEST_GetProperty().
Referenced by TEST_F(), GameTest::testCountSpawnpointsForMap(), GameTest::testCountSpawnpointsForMapWithAssembly(), GameTest::testCountSpawnpointsForMapWithAssemblyAndAircraft(), and GameTest::testCountSpawnpointsForMapWithAssemblyAndAircraftAndUfo().
int TEST_GetIntProperty | ( | const char * | name | ) |
Get a property value from global test structure
name | Name of the property |
Definition at line 200 of file test_shared.cpp.
References Com_Printf(), TEST_GetProperty(), and test_property_s::value.
long TEST_GetLongProperty | ( | const char * | name | ) |
Get a property value from global test structure
name | Name of the property |
Definition at line 215 of file test_shared.cpp.
References Com_Printf(), TEST_GetProperty(), and test_property_s::value.
Referenced by TEST_F().
|
static |
Get a property name from global test structure
name | Name of the property |
Definition at line 156 of file test_shared.cpp.
References Com_HashKey(), hash, test_property_s::hash_next, test_property_s::name, PROPERTY_HASH_SIZE, and Q_strcasecmp.
Referenced by TEST_ExistsProperty(), TEST_GetIntProperty(), TEST_GetLongProperty(), and TEST_GetStringProperty().
const char* TEST_GetStringProperty | ( | const char * | name | ) |
Get a property value from global test structure
name | Name of the property |
Definition at line 185 of file test_shared.cpp.
References Com_Printf(), TEST_GetProperty(), and test_property_s::value.
Referenced by WebApiTest::SetUpTestCase(), TEST_F(), GameTest::testCountSpawnpointsForMap(), GameTest::testCountSpawnpointsForMapWithAssembly(), GameTest::testCountSpawnpointsForMapWithAssemblyAndAircraft(), and GameTest::testCountSpawnpointsForMapWithAssemblyAndAircraftAndUfo().
Definition at line 72 of file test_shared.cpp.
References Cbuf_Init(), Cmd_Init(), com_aliasSysPool, com_cmdSysPool, com_cmodelSysPool, com_cvarSysPool, com_fileSysPool, com_genericPool, csi, Cvar_Get(), Cvar_Init(), FS_AddGameDirectory(), FS_AddHomeAsGameDirectory(), FS_ExecAutoexec(), FS_InitFilesystem(), http_proxy, http_timeout, hwclass, Mem_CreatePool, Mem_Init(), NET_Init(), OBJZERO, SV_Init(), Swap_Init(), and Sys_Error().
Referenced by CharacterTest::SetUpTestCase(), DBufferTest::SetUpTestCase(), UITest::SetUpTestCase(), ParserTest::SetUpTestCase(), EventsTest::SetUpTestCase(), RendererTest::SetUpTestCase(), UILevel2Test::SetUpTestCase(), ParticleTest::SetUpTestCase(), ScriptTest::SetUpTestCase(), RoutingTest::SetUpTestCase(), FootStepTest::SetUpTestCase(), MapDefStatsTest::SetUpTestCase(), MapDefTest::SetUpTestCase(), MapDefMassRMATest::SetUpTestCase(), WebApiTest::SetUpTestCase(), GameTest::SetUpTestCase(), RandomMapAssemblyTest::SetUpTestCase(), GenericTest::SetUpTestCase(), InventoryTest::SetUpTestCase(), and CampaignTest::SetUpTestCase().
void TEST_RegisterProperty | ( | const char * | name, |
const char * | value | ||
) |
Register a property name-value to a global structure for all tests
name | Name of the property |
value | Value of the property. Only the pointer of the value is used. Use it ONLY with stable memory. |
TODO maybe copy the value instead of copying the pointer of the value
Definition at line 125 of file test_shared.cpp.
References Com_HashKey(), Com_Printf(), hash, test_property_s::hash_next, test_property_s::name, test_property_s::next, PROPERTY_HASH_SIZE, Q_streq, Q_strncpyz(), test_property, and test_property_s::value.
Referenced by Test_Parameters().
Definition at line 34 of file test_shared.cpp.
References Cbuf_Shutdown(), CL_ShutdownLua(), Cmd_Shutdown(), com_aliasSysPool, com_cmdSysPool, com_cmodelSysPool, com_cvarSysPool, com_fileSysPool, com_genericPool, Com_Shutdown(), Cvar_Shutdown(), developer, FS_Shutdown(), Mem_Shutdown(), NET_Shutdown(), PTL_InitStartup(), R_ShutdownImages(), SV_Shutdown(), and UI_Shutdown().
Referenced by DBufferTest::TearDownTestCase(), UITest::TearDownTestCase(), ParserTest::TearDownTestCase(), CharacterTest::TearDownTestCase(), RendererTest::TearDownTestCase(), EventsTest::TearDownTestCase(), RoutingTest::TearDownTestCase(), UILevel2Test::TearDownTestCase(), GenericTest::TearDownTestCase(), ParticleTest::TearDownTestCase(), ScriptTest::TearDownTestCase(), GameTest::TearDownTestCase(), WebApiTest::TearDownTestCase(), MapDefStatsTest::TearDownTestCase(), FootStepTest::TearDownTestCase(), MapDefMassRMATest::TearDownTestCase(), RandomMapAssemblyTest::TearDownTestCase(), MapDefTest::TearDownTestCase(), InventoryTest::TearDownTestCase(), and CampaignTest::TearDownTestCase().
void TEST_vPrintf | ( | const char * | fmt, |
va_list | argptr | ||
) |
void TEST_vPrintfSilent | ( | const char * | fmt, |
va_list | argptr | ||
) |
Definition at line 58 of file test_shared.cpp.
Referenced by main().
|
static |
Definition at line 117 of file test_shared.cpp.
Referenced by TEST_RegisterProperty().
|
static |
Definition at line 118 of file test_shared.cpp.