UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
test_campaign.cpp File Reference

Test cases for the campaign code. More...

Go to the source code of this file.

Data Structures

class  CampaignTest
 

Functions

static void FreeInventory (void *data)
 
static voidAllocInventoryMemory (size_t size)
 
static void FreeAllInventory (void)
 
static void ResetInventoryList (void)
 
static campaign_tGetCampaign (void)
 
static installation_tCreateInstallation (const char *name, const vec2_t pos)
 
static base_tCreateBase (const char *name, const vec2_t pos, bool fillBase=false)
 
 TEST_F (CampaignTest, testAircraftHandling)
 
 TEST_F (CampaignTest, testEmployeeHandling)
 
 TEST_F (CampaignTest, testBaseBuilding)
 
 TEST_F (CampaignTest, testAutoMissions)
 
 TEST_F (CampaignTest, testTransferItem)
 
 TEST_F (CampaignTest, testUFORecovery)
 
 TEST_F (CampaignTest, testAlienPSIDevice)
 
 TEST_F (CampaignTest, testResearch)
 
 TEST_F (CampaignTest, testProductionItem)
 
 TEST_F (CampaignTest, testProductionAircraft)
 
 TEST_F (CampaignTest, testDisassembly)
 
 TEST_F (CampaignTest, testMap)
 
 TEST_F (CampaignTest, testAirFight)
 
 TEST_F (CampaignTest, testRadar)
 
 TEST_F (CampaignTest, testNation)
 
 TEST_F (CampaignTest, testMarket)
 
 TEST_F (CampaignTest, testSaveLoad)
 
 TEST_F (CampaignTest, testSaveMassEmployees)
 
 TEST_F (CampaignTest, testLoadMassEmployees)
 
 TEST_F (CampaignTest, testCampaignRun)
 
 TEST_F (CampaignTest, testLoad)
 
 TEST_F (CampaignTest, testDateHandling)
 
 TEST_F (CampaignTest, testCampaignDateHandling)
 
 TEST_F (CampaignTest, testHospital)
 
 TEST_F (CampaignTest, testBuildingConstruction)
 
 TEST_F (CampaignTest, test3090011)
 
static bool skipTest (const mapDef_t *md)
 
 TEST_F (CampaignTest, testTerrorMissions)
 
 TEST_F (CampaignTest, testRandomPosMissions)
 
static void testEventTrigger_f (void)
 
 TEST_F (CampaignTest, testEventTrigger)
 
 TEST_F (CampaignTest, testAssembleMap)
 
 TEST_F (CampaignTest, testGeoscapeMaps)
 

Variables

static const int TAG_INVENTORY = 1538
 
static const inventoryImport_t inventoryImport = { FreeInventory, FreeAllInventory, AllocInventoryMemory }
 
static bool testEventTriggerCalled
 

Detailed Description

Test cases for the campaign code.

Definition in file test_campaign.cpp.

Function Documentation

static void* AllocInventoryMemory ( size_t  size)
static

Definition at line 53 of file test_campaign.cpp.

References com_genericPool, Mem_PoolAlloc, and TAG_INVENTORY.

static base_t* CreateBase ( const char *  name,
const vec2_t  pos,
bool  fillBase = false 
)
static
static void FreeAllInventory ( void  )
static

Definition at line 58 of file test_campaign.cpp.

References com_genericPool, Mem_FreeTag, and TAG_INVENTORY.

static void FreeInventory ( void data)
static

Definition at line 48 of file test_campaign.cpp.

References Mem_Free.

static campaign_t* GetCampaign ( void  )
static

Definition at line 71 of file test_campaign.cpp.

References CP_GetCampaign().

Referenced by CreateBase(), CampaignTest::SetUp(), and TEST_F().

static void ResetInventoryList ( void  )
inlinestatic
static bool skipTest ( const mapDef_t md)
static

Definition at line 1155 of file test_campaign.cpp.

References mapDef_s::id, and Q_streq.

Referenced by TEST_F().

TEST_F ( CampaignTest  ,
testAircraftHandling   
)
Todo:
we should not assume that initial base has aircraft. It's a campaign parameter

Definition at line 157 of file test_campaign.cpp.

References AIR_BaseCountAircraft(), AIR_DeleteAircraft(), AIR_Foreach, AIR_GetFirstFromBase(), AIR_NewAircraft(), count, CreateBase(), E_DeleteAllEmployees(), base_s::founded, aircraft_s::homebase, aircraft_s::idx, and aircraft_s::tpl.

TEST_F ( CampaignTest  ,
testAlienPSIDevice   
)
TEST_F ( CampaignTest  ,
testMap   
)

Definition at line 661 of file test_campaign.cpp.

References GEO_GetColor(), MapIsWater, MAPTYPE_TERRAIN, and Vector2Set.

TEST_F ( CampaignTest  ,
testNation   
)
Todo:
implement a check here

Definition at line 783 of file test_campaign.cpp.

References GetCampaign(), NAT_GetNationByID(), and NAT_HandleBudget().

TEST_F ( CampaignTest  ,
testMarket   
)
Todo:
implement a check here

Definition at line 797 of file test_campaign.cpp.

References BS_InitMarket(), CP_CampaignRunMarket(), GetCampaign(), and RS_InitTree().

TEST_F ( CampaignTest  ,
testLoadMassEmployees   
)

Definition at line 893 of file test_campaign.cpp.

References Cmd_ExecuteString(), and E_DeleteAllEmployees().

TEST_F ( CampaignTest  ,
testLoad   
)

Definition at line 928 of file test_campaign.cpp.

References ccs, ccs_s::curCampaign, i, SAV_GameLoad(), and UFO_GetNextOnGeoscape().

TEST_F ( CampaignTest  ,
testDateHandling   
)

Definition at line 947 of file test_campaign.cpp.

References ccs, ccs_s::date, Date_IsDue(), Date_LaterThan(), date_s::day, and date_s::sec.

TEST_F ( CampaignTest  ,
testHospital   
)
TEST_F ( CampaignTest  ,
test3090011   
)

Definition at line 1146 of file test_campaign.cpp.

References SAV_GameLoad().

TEST_F ( CampaignTest  ,
testAssembleMap   
)

Definition at line 1292 of file test_campaign.cpp.

References B_AssembleMap(), BASE_SIZE, Com_Parse(), and CreateBase().

TEST_F ( CampaignTest  ,
testGeoscapeMaps   
)
static void testEventTrigger_f ( void  )
static

Definition at line 1257 of file test_campaign.cpp.

References testEventTriggerCalled.

Referenced by TEST_F().

Variable Documentation

Definition at line 63 of file test_campaign.cpp.

const int TAG_INVENTORY = 1538
static

Definition at line 46 of file test_campaign.cpp.

Referenced by AllocInventoryMemory(), and FreeAllInventory().

bool testEventTriggerCalled
static

Definition at line 1256 of file test_campaign.cpp.

Referenced by TEST_F(), and testEventTrigger_f().