|
UFO: Alien Invasion
|
Test cases for the campaign code. More...
#include "test_shared.h"#include "../client/DateTime.h"#include "../client/client.h"#include "../client/cl_lua.h"#include "../client/cgame/cl_game.h"#include "../client/renderer/r_state.h"#include "../client/ui/ui_main.h"#include "../client/cgame/campaign/cp_campaign.h"#include "../client/cgame/campaign/cp_geoscape.h"#include "../client/cgame/campaign/cp_hospital.h"#include "../client/cgame/campaign/cp_missions.h"#include "../client/cgame/campaign/cp_nation.h"#include "../client/cgame/campaign/cp_overlay.h"#include "../client/cgame/campaign/cp_ufo.h"#include "../client/cgame/campaign/cp_time.h"#include "../client/cgame/campaign/cp_alien_interest.h"#include "../client/cgame/campaign/cp_auto_mission.h"#include "../client/cgame/campaign/itemcargo.h"#include "../client/cgame/campaign/missions/cp_mission_intercept.h"#include "../shared/parse.h"#include "../shared/images.h"
Go to the source code of this file.
Data Structures | |
| class | CampaignTest |
Functions | |
| static void | FreeInventory (void *data) |
| static void * | AllocInventoryMemory (size_t size) |
| static void | FreeAllInventory (void) |
| static void | ResetInventoryList (void) |
| static campaign_t * | GetCampaign (void) |
| static installation_t * | CreateInstallation (const char *name, const vec2_t pos) |
| static base_t * | CreateBase (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 |
Test cases for the campaign code.
Definition in file test_campaign.cpp.
|
static |
Definition at line 54 of file test_campaign.cpp.
References com_genericPool, Mem_PoolAlloc, and TAG_INVENTORY.
Definition at line 143 of file test_campaign.cpp.
References B_Build(), B_SetUpFirstBase(), ccs, E_InitialEmployees(), GetCampaign(), name, and RS_InitTree().
Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
|
static |
Definition at line 131 of file test_campaign.cpp.
References installation_t::buildStart, installationTemplate_t::buildTime, ccs, INS_Build(), INS_GetInstallationTemplateByType(), INS_UpdateInstallationData(), INSTALLATION_UFOYARD, installation_t::installationTemplate, and name.
Definition at line 59 of file test_campaign.cpp.
References com_genericPool, Mem_FreeTag, and TAG_INVENTORY.
Definition at line 49 of file test_campaign.cpp.
|
static |
Definition at line 72 of file test_campaign.cpp.
References CP_GetCampaign().
Referenced by CreateBase(), CampaignTest::SetUp(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
Definition at line 66 of file test_campaign.cpp.
References cls, csi, and inventoryImport.
Referenced by CampaignTest::SetUp().
|
static |
Definition at line 1144 of file test_campaign.cpp.
References mapDef_t::id, and Q_streq.
| TEST_F | ( | CampaignTest | , |
| test3090011 | ) |
Definition at line 1135 of file test_campaign.cpp.
References SAV_GameLoad().
| TEST_F | ( | CampaignTest | , |
| testAircraftHandling | ) |
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 | ( | CampaignTest | , |
| testAirFight | ) |
Definition at line 676 of file test_campaign.cpp.
References AIR_BaseCountAircraft(), AIR_ForeachFromBase, AIR_GetFirstFromBase(), AIR_IDLE, AIR_IsAircraftOnGeoscape(), aircraft_t::aircraftTarget, AIRFIGHT_CampaignRunProjectiles(), ccs, CP_CreateNewMission(), CP_InterceptNextStage(), CreateBase(), aircraftSlot_t::delayNextShot, E_DeleteAllEmployees(), base_t::founded, GetCampaign(), i, INTERESTCATEGORY_INTERCEPT, aircraft_t::maxWeapons, OBJZERO, aircraft_t::pos, base_t::pos, mission_t::stage, STAGE_COME_FROM_ORBIT, STAGE_INTERCEPT, STAGE_NOT_ACTIVE, aircraft_t::status, mission_t::ufo, UFO_CampaignRunUFOs(), UFO_CheckShootBack(), UFO_GetAvailableUFOsForMission(), UFO_GetByType(), UFO_MAX, UFO_SendToDestination(), aircraft_t::ufoInterestOnGeoscape, aircraft_t::ufotype, Vector2Copy, VectorEqual, and aircraft_t::weapons.
| TEST_F | ( | CampaignTest | , |
| testAlienBaseAtStart | ) |
Definition at line 1340 of file test_campaign.cpp.
References AB_Exists, AB_GetAlienBaseNumber(), and count.
| TEST_F | ( | CampaignTest | , |
| testAlienBaseBuild | ) |
Definition at line 1348 of file test_campaign.cpp.
References AB_BuildBase(), AB_Exists, AB_GetAlienBaseNumber(), alienBase_t::pos, alienBase_t::stealth, and alienBase_t::supply.
| TEST_F | ( | CampaignTest | , |
| testAlienBaseSearchedByNationsFindBase | ) |
Definition at line 1363 of file test_campaign.cpp.
References AB_BaseSearchedByNations(), AB_BuildBase(), mission_t::missionData_t::alienBase, CreateBase(), mission_t::data, MIS_GetByIdx(), alienBase_t::stealth, and alienBase_t::supply.
| TEST_F | ( | CampaignTest | , |
| testAlienPSIDevice | ) |
Definition at line 468 of file test_campaign.cpp.
References RS_GetTechByID(), RS_MarkOneResearchable(), RS_MarkResearchable(), and technology_t::statusResearchable.
| TEST_F | ( | CampaignTest | , |
| testAssembleMap | ) |
Definition at line 1281 of file test_campaign.cpp.
References B_AssembleMap(), BASE_SIZE, Com_Parse(), and CreateBase().
| TEST_F | ( | CampaignTest | , |
| testAutoMissions | ) |
Definition at line 314 of file test_campaign.cpp.
References AIR_ForeachFromBase, AIR_GetTeamSize(), AM_Go(), ccs, Com_GetMapDefinitionByID(), CP_CreateBattleParameters(), CP_CreateNewMission(), CreateBase(), GetCampaign(), INT_ResetAlienInterest(), INTERESTCATEGORY_RECON, mission_t::mapDef, OBJZERO, mission_t::pos, mission_t::posAssigned, missionResults_t::state, Vector2Copy, and WON.
| TEST_F | ( | CampaignTest | , |
| testBaseBuilding | ) |
Definition at line 292 of file test_campaign.cpp.
References B_Destroy(), B_GetInstallationLimit(), ccs, CreateBase(), E_CountHired(), E_DeleteAllEmployees(), base_t::founded, i, MAX_EMPL, MAX_INSTALLATIONS_PER_BASE, and type.
| TEST_F | ( | CampaignTest | , |
| testBuildingConstruction | ) |
Definition at line 1044 of file test_campaign.cpp.
References B_BuildBuilding(), B_BuildingDestroy(), B_GetBuildingTemplate(), B_STATUS_UNDER_CONSTRUCTION, B_STATUS_WORKING, B_UpdateBuildingConstructions(), baseBuildingTile_t::blocked, baseBuildingTile_t::building, building_t::buildingStatus, building_t::buildTime, ccs, CreateBase(), E_DeleteAllEmployees(), base_t::founded, base_t::idx, base_t::map, and building_t::pos.
| TEST_F | ( | CampaignTest | , |
| testCampaignDateHandling | ) |
see bug #3166234
Definition at line 976 of file test_campaign.cpp.
References BS_InitMarket(), ccs, CP_CampaignRun(), CP_IsTimeStopped(), CP_UpdateTime(), CreateBase(), E_DeleteAllEmployees(), base_t::founded, GetCampaign(), and RS_InitTree().
| TEST_F | ( | CampaignTest | , |
| testCampaignRun | ) |
Definition at line 897 of file test_campaign.cpp.
References BS_InitMarket(), ccs, CP_CampaignRun(), CreateBase(), E_DeleteAllEmployees(), base_t::founded, GetCampaign(), i, RS_InitTree(), and DateTime::SECONDS_PER_DAY.
| TEST_F | ( | CampaignTest | , |
| testDateHandling | ) |
Definition at line 943 of file test_campaign.cpp.
References ccs.
| TEST_F | ( | CampaignTest | , |
| testDisassembly | ) |
Definition at line 608 of file test_campaign.cpp.
References AIR_GetAircraft(), B_AtLeastOneExists, B_GetBuildingStatus(), B_WORKSHOP, CAP_GetCurrent, CAP_ITEMS, ccs, storedUFO_t::comp, CreateBase(), CreateInstallation(), data, E_CountHired(), E_DeleteAllEmployees(), EMPL_WORKER, base_t::founded, i, PR_GetRemainingHours(), PR_GetRemainingMinutes(), PR_ProductionAllowed(), PR_ProductionRun(), PR_QueueNew(), PR_SetData, PR_WorkersAvailable(), PRODUCTION_TYPE_DISASSEMBLY, storedUFO_t::status, SUFO_RECOVERED, and US_StoreUFO().
| TEST_F | ( | CampaignTest | , |
| testEmployeeHandling | ) |
Definition at line 224 of file test_campaign.cpp.
References Com_GetUGVByID(), E_CountUnhired(), E_CreateEmployee(), E_DeleteAllEmployees(), E_DeleteEmployee(), E_Foreach, EMPL_ROBOT, EMPL_SOLDIER, i, MAX_EMPL, type, and void().
| TEST_F | ( | CampaignTest | , |
| testEventTrigger | ) |
Definition at line 1251 of file test_campaign.cpp.
References ccs, Cmd_AddCommand(), Cmd_RemoveCommand(), CP_TriggerEvent(), i, Mem_StrDup, NEW_DAY, OBJZERO, testEventTrigger_f(), testEventTriggerCalled, and UFO_DETECTION.
| 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 | ( | CampaignTest | , |
| testHospital | ) |
Definition at line 1006 of file test_campaign.cpp.
References CreateBase(), E_DeleteAllEmployees(), E_Foreach, base_t::founded, HOS_HospitalRun(), i, MAX_EMPL, and type.
| TEST_F | ( | CampaignTest | , |
| testLoad | ) |
Definition at line 924 of file test_campaign.cpp.
References ccs, i, SAV_GameLoad(), and UFO_GetNextOnGeoscape().
| TEST_F | ( | CampaignTest | , |
| testLoadMassEmployees | ) |
Definition at line 889 of file test_campaign.cpp.
References Cmd_ExecuteString(), and E_DeleteAllEmployees().
| TEST_F | ( | CampaignTest | , |
| testMap | ) |
Definition at line 657 of file test_campaign.cpp.
References GEO_GetColor(), MapIsWater, MAPTYPE_TERRAIN, and Vector2Set.
| TEST_F | ( | CampaignTest | , |
| testMarket | ) |
Definition at line 793 of file test_campaign.cpp.
References BS_InitMarket(), CP_CampaignRunMarket(), GetCampaign(), and RS_InitTree().
| TEST_F | ( | CampaignTest | , |
| testNation | ) |
Definition at line 779 of file test_campaign.cpp.
References GetCampaign(), NAT_GetNationByID(), and NAT_HandleBudget().
| TEST_F | ( | CampaignTest | , |
| testProductionAircraft | ) |
Definition at line 560 of file test_campaign.cpp.
References AIR_GetAircraft(), B_AtLeastOneExists, B_GetBuildingStatus(), B_WORKSHOP, CAP_AIRCRAFT_SMALL, CAP_GetCurrent, CreateBase(), data, E_CountHired(), E_DeleteAllEmployees(), EMPL_WORKER, base_t::founded, i, PR_GetRemainingHours(), PR_GetRemainingMinutes(), PR_ProductionAllowed(), PR_ProductionRun(), PR_QueueNew(), PR_SetData, PR_WorkersAvailable(), PRODUCTION_TYPE_AIRCRAFT, and aircraft_t::tech.
| TEST_F | ( | CampaignTest | , |
| testProductionItem | ) |
Definition at line 517 of file test_campaign.cpp.
References B_AtLeastOneExists, B_GetBuildingStatus(), B_WORKSHOP, CreateBase(), data, E_CountHired(), E_DeleteAllEmployees(), EMPL_WORKER, base_t::founded, i, objDef_t::idx, INVSH_GetItemByID(), equipDef_t::numItems, PR_GetRemainingHours(), PR_GetRemainingMinutes(), PR_ProductionAllowed(), PR_ProductionRun(), PR_QueueNew(), PR_SetData, PR_WorkersAvailable(), technology_t::produceTime, PRODUCTION_TYPE_ITEM, RS_GetTechForItem(), and base_t::storage.
| TEST_F | ( | CampaignTest | , |
| testRadar | ) |
Definition at line 756 of file test_campaign.cpp.
References CP_CreateNewMission(), CreateBase(), E_DeleteAllEmployees(), base_t::founded, INTERESTCATEGORY_INTERCEPT, aircraft_t::pos, base_t::pos, base_t::radar, RADAR_CheckUFOSensored(), UFO_AddToGeoscape(), UFO_GetAvailableUFOsForMission(), UFO_MAX, UFO_SendToDestination(), Vector2Copy, and VectorEqual.
| TEST_F | ( | CampaignTest | , |
| testRandomPosMissions | ) |
Definition at line 1230 of file test_campaign.cpp.
References CP_GetRandomPosOnGeoscapeWithParameters(), mapDef_t::cultures, mapDef_t::id, MapDef_ForeachSingleplayerCampaign, OBJZERO, mapDef_t::populations, mission_t::pos, skipTest(), and mapDef_t::terrains.
| TEST_F | ( | CampaignTest | , |
| testResearch | ) |
Definition at line 477 of file test_campaign.cpp.
References technology_t::base, ccs, CreateBase(), E_DeleteAllEmployees(), base_t::founded, i, RS_AssignScientist(), RS_FINISH, RS_GetTechByID(), RS_MarkResearchable(), RS_ResearchRun(), RS_RUNNING, technology_t::scientists, technology_t::statusResearch, technology_t::statusResearchable, and technology_t::time.
| TEST_F | ( | CampaignTest | , |
| testSaveLoad | ) |
Definition at line 807 of file test_campaign.cpp.
References B_Destroy(), B_SetName(), BASE_DESTROYED, BASE_WORKING, base_t::baseStatus, ccs, Cmd_ExecuteString(), CreateBase(), Cvar_Set(), E_DeleteAllEmployees(), base_t::founded, GetCampaign(), base_t::name, and SAV_Init().
| TEST_F | ( | CampaignTest | , |
| testSaveMassEmployees | ) |
Definition at line 857 of file test_campaign.cpp.
References CAP_EMPLOYEES, CAP_GetFreeCapacity(), ccs, Cmd_ExecuteString(), CreateBase(), Cvar_Set(), E_CreateEmployee(), E_DeleteAllEmployees(), E_HireEmployee(), EMPL_SOLDIER, base_t::founded, GetCampaign(), i, NAT_GetNationByID(), and SAV_Init().
| TEST_F | ( | CampaignTest | , |
| testTerrorMissions | ) |
Definition at line 1150 of file test_campaign.cpp.
References ccs, Com_GetUfoIdsNum(), CP_ChooseMap(), i, aircraft_t::id, mapDef_t::id, INTERESTCATEGORY_TERROR_ATTACK, LIST_ContainsString(), LIST_Foreach, LIST_IsEmpty(), mission_t::mapDef, MapDef_ForeachSingleplayerCampaign, aircraft_t::mission, OBJZERO, mission_t::pos, skipTest(), mapDef_t::timesAlreadyUsed, mission_t::ufo, UFO_AddToGeoscape(), UFO_GetAvailableUFOsForMission(), UFO_GetByType(), UFO_MAX, UFO_RemoveFromGeoscape(), aircraft_t::ufoInterestOnGeoscape, mapDef_t::ufos, and va().
| TEST_F | ( | CampaignTest | , |
| testTransferItem | ) |
Definition at line 358 of file test_campaign.cpp.
References B_SetUpFirstBase(), ccs, CreateBase(), E_DeleteAllEmployees(), transfer_t::event, base_t::founded, GetCampaign(), INVSH_GetItemByID(), LIST_Count(), LIST_IsEmpty(), OBJZERO, tr, TR_TransferRun(), and TR_TransferStart().
| TEST_F | ( | CampaignTest | , |
| testUFORecovery | ) |
Definition at line 434 of file test_campaign.cpp.
References AIR_GetAircraft(), ccs, CreateBase(), CreateInstallation(), E_DeleteAllEmployees(), storedUFO_t::status, SUFO_RECOVERED, SUFO_STORED, UR_ProcessActive(), and US_StoreUFO().
Definition at line 1246 of file test_campaign.cpp.
References testEventTriggerCalled.
Referenced by TEST_F().
|
static |
Definition at line 64 of file test_campaign.cpp.
|
static |
Definition at line 47 of file test_campaign.cpp.
|
static |
Definition at line 1245 of file test_campaign.cpp.
Referenced by TEST_F(), and testEventTrigger_f().