UFO: Alien Invasion
Loading...
Searching...
No Matches
test_campaign.cpp File Reference

Test cases for the campaign code. More...

Include dependency graph for test_campaign.cpp:

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)
 TEST_F (CampaignTest, testAlienBaseAtStart)
 TEST_F (CampaignTest, testAlienBaseBuild)
 TEST_F (CampaignTest, testAlienBaseSearchedByNationsFindBase)

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

◆ AllocInventoryMemory()

void * AllocInventoryMemory ( size_t size)
static

Definition at line 54 of file test_campaign.cpp.

References com_genericPool, Mem_PoolAlloc, and TAG_INVENTORY.

◆ CreateBase()

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

◆ CreateInstallation()

◆ FreeAllInventory()

void FreeAllInventory ( void )
static

Definition at line 59 of file test_campaign.cpp.

References com_genericPool, Mem_FreeTag, and TAG_INVENTORY.

◆ FreeInventory()

void FreeInventory ( void * data)
static

Definition at line 49 of file test_campaign.cpp.

References data, and Mem_Free.

◆ GetCampaign()

campaign_t * GetCampaign ( void )
static

◆ ResetInventoryList()

void ResetInventoryList ( void )
inlinestatic

Definition at line 66 of file test_campaign.cpp.

References cls, csi, and inventoryImport.

Referenced by CampaignTest::SetUp().

◆ skipTest()

bool skipTest ( const mapDef_t * md)
static

Definition at line 1144 of file test_campaign.cpp.

References mapDef_t::id, and Q_streq.

Referenced by TEST_F(), and TEST_F().

◆ TEST_F() [1/34]

TEST_F ( CampaignTest ,
test3090011  )

Definition at line 1135 of file test_campaign.cpp.

References SAV_GameLoad().

◆ TEST_F() [2/34]

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

Definition at line 158 of file test_campaign.cpp.

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

◆ TEST_F() [3/34]

◆ TEST_F() [4/34]

TEST_F ( CampaignTest ,
testAlienBaseAtStart  )

Definition at line 1340 of file test_campaign.cpp.

References AB_Exists, AB_GetAlienBaseNumber(), and count.

◆ TEST_F() [5/34]

TEST_F ( CampaignTest ,
testAlienBaseBuild  )

◆ TEST_F() [6/34]

◆ TEST_F() [7/34]

TEST_F ( CampaignTest ,
testAlienPSIDevice  )

◆ TEST_F() [8/34]

TEST_F ( CampaignTest ,
testAssembleMap  )

Definition at line 1281 of file test_campaign.cpp.

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

◆ TEST_F() [9/34]

◆ TEST_F() [10/34]

◆ TEST_F() [11/34]

◆ TEST_F() [12/34]

TEST_F ( CampaignTest ,
testCampaignDateHandling  )

◆ TEST_F() [13/34]

◆ TEST_F() [14/34]

TEST_F ( CampaignTest ,
testDateHandling  )

Definition at line 943 of file test_campaign.cpp.

References ccs.

◆ TEST_F() [15/34]

◆ TEST_F() [16/34]

◆ TEST_F() [17/34]

◆ TEST_F() [18/34]

TEST_F ( CampaignTest ,
testGeoscapeMaps  )

Definition at line 1315 of file test_campaign.cpp.

References ccs, i, Img_LoadImage(), campaign_t::map, and va().

◆ TEST_F() [19/34]

TEST_F ( CampaignTest ,
testHospital  )

◆ TEST_F() [20/34]

TEST_F ( CampaignTest ,
testLoad  )

Definition at line 924 of file test_campaign.cpp.

References ccs, i, SAV_GameLoad(), and UFO_GetNextOnGeoscape().

◆ TEST_F() [21/34]

TEST_F ( CampaignTest ,
testLoadMassEmployees  )

Definition at line 889 of file test_campaign.cpp.

References Cmd_ExecuteString(), and E_DeleteAllEmployees().

◆ TEST_F() [22/34]

TEST_F ( CampaignTest ,
testMap  )

Definition at line 657 of file test_campaign.cpp.

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

◆ TEST_F() [23/34]

TEST_F ( CampaignTest ,
testMarket  )
Todo
implement a check here

Definition at line 793 of file test_campaign.cpp.

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

◆ TEST_F() [24/34]

TEST_F ( CampaignTest ,
testNation  )
Todo
implement a check here

Definition at line 779 of file test_campaign.cpp.

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

◆ TEST_F() [25/34]

◆ TEST_F() [26/34]

◆ TEST_F() [27/34]

◆ TEST_F() [28/34]

◆ TEST_F() [29/34]

◆ TEST_F() [30/34]

◆ TEST_F() [31/34]

◆ TEST_F() [32/34]

◆ TEST_F() [33/34]

◆ TEST_F() [34/34]

◆ testEventTrigger_f()

void testEventTrigger_f ( void )
static

Definition at line 1246 of file test_campaign.cpp.

References testEventTriggerCalled.

Referenced by TEST_F().

Variable Documentation

◆ inventoryImport

Definition at line 64 of file test_campaign.cpp.

◆ TAG_INVENTORY

const int TAG_INVENTORY = 1538
static

Definition at line 47 of file test_campaign.cpp.

◆ testEventTriggerCalled

bool testEventTriggerCalled
static

Definition at line 1245 of file test_campaign.cpp.

Referenced by TEST_F(), and testEventTrigger_f().