UFO: Alien Invasion
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)
 

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()

static void * AllocInventoryMemory ( size_t  size)
static

Definition at line 54 of file test_campaign.cpp.

References com_genericPool, Mem_PoolAlloc, and TAG_INVENTORY.

◆ CreateBase()

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

◆ CreateInstallation()

◆ FreeAllInventory()

static void FreeAllInventory ( void  )
static

Definition at line 59 of file test_campaign.cpp.

References com_genericPool, Mem_FreeTag, and TAG_INVENTORY.

◆ FreeInventory()

static void FreeInventory ( void data)
static

Definition at line 49 of file test_campaign.cpp.

References data, and Mem_Free.

◆ GetCampaign()

static campaign_t * GetCampaign ( void  )
static

Definition at line 72 of file test_campaign.cpp.

References CP_GetCampaign().

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

◆ ResetInventoryList()

static void ResetInventoryList ( void  )
inlinestatic

◆ skipTest()

static 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().

◆ TEST_F() [1/31]

TEST_F ( CampaignTest  ,
test3090011   
)

Definition at line 1135 of file test_campaign.cpp.

References SAV_GameLoad().

◆ TEST_F() [2/31]

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/31]

◆ TEST_F() [4/31]

TEST_F ( CampaignTest  ,
testAlienPSIDevice   
)

◆ TEST_F() [5/31]

TEST_F ( CampaignTest  ,
testAssembleMap   
)

Definition at line 1281 of file test_campaign.cpp.

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

◆ TEST_F() [6/31]

◆ TEST_F() [7/31]

◆ TEST_F() [8/31]

◆ TEST_F() [9/31]

TEST_F ( CampaignTest  ,
testCampaignDateHandling   
)

◆ TEST_F() [10/31]

◆ TEST_F() [11/31]

TEST_F ( CampaignTest  ,
testDateHandling   
)

Definition at line 943 of file test_campaign.cpp.

References ccs, and ccs_t::date.

◆ TEST_F() [12/31]

◆ TEST_F() [13/31]

◆ TEST_F() [14/31]

◆ TEST_F() [15/31]

TEST_F ( CampaignTest  ,
testGeoscapeMaps   
)

◆ TEST_F() [16/31]

TEST_F ( CampaignTest  ,
testHospital   
)

◆ TEST_F() [17/31]

TEST_F ( CampaignTest  ,
testLoad   
)

Definition at line 924 of file test_campaign.cpp.

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

◆ TEST_F() [18/31]

TEST_F ( CampaignTest  ,
testLoadMassEmployees   
)

Definition at line 889 of file test_campaign.cpp.

References Cmd_ExecuteString(), and E_DeleteAllEmployees().

◆ TEST_F() [19/31]

TEST_F ( CampaignTest  ,
testMap   
)

Definition at line 657 of file test_campaign.cpp.

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

◆ TEST_F() [20/31]

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() [21/31]

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() [22/31]

◆ TEST_F() [23/31]

◆ TEST_F() [24/31]

◆ TEST_F() [25/31]

◆ TEST_F() [26/31]

◆ TEST_F() [27/31]

◆ TEST_F() [28/31]

◆ TEST_F() [29/31]

◆ TEST_F() [30/31]

◆ TEST_F() [31/31]

◆ testEventTrigger_f()

static 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.

Referenced by ResetInventoryList().

◆ TAG_INVENTORY

const int TAG_INVENTORY = 1538
static

Definition at line 47 of file test_campaign.cpp.

Referenced by AllocInventoryMemory(), and FreeAllInventory().

◆ testEventTriggerCalled

bool testEventTriggerCalled
static

Definition at line 1245 of file test_campaign.cpp.

Referenced by TEST_F(), and testEventTrigger_f().