UFO: Alien Invasion
|
Test cases for the campaign code. More...
#include "test_shared.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) | |
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 53 of file test_campaign.cpp.
References com_genericPool, Mem_PoolAlloc, and TAG_INVENTORY.
Definition at line 142 of file test_campaign.cpp.
References B_Build(), B_SetUpFirstBase(), stats_s::basesBuilt, ccs_s::campaignStats, ccs, E_InitialEmployees(), GetCampaign(), and RS_InitTree().
Referenced by TEST_F().
|
static |
Definition at line 130 of file test_campaign.cpp.
References installation_s::buildStart, installationTemplate_s::buildTime, ccs, ccs_s::date, date_s::day, INS_Build(), INS_GetInstallationTemplateByType(), INS_UpdateInstallationData(), INSTALLATION_UFOYARD, and installation_s::installationTemplate.
Referenced by TEST_F().
Definition at line 58 of file test_campaign.cpp.
References com_genericPool, Mem_FreeTag, and TAG_INVENTORY.
Definition at line 48 of file test_campaign.cpp.
References Mem_Free.
|
static |
Definition at line 71 of file test_campaign.cpp.
References CP_GetCampaign().
Referenced by CreateBase(), CampaignTest::SetUp(), and TEST_F().
Definition at line 65 of file test_campaign.cpp.
References cls, csi, InventoryInterface::destroyInventoryInterface(), client_static_s::i, and InventoryInterface::initInventory().
Referenced by CampaignTest::SetUp().
|
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 | |||
) |
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 | , |
testEmployeeHandling | |||
) |
Definition at line 223 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, and type.
TEST_F | ( | CampaignTest | , |
testBaseBuilding | |||
) |
Definition at line 291 of file test_campaign.cpp.
References B_Destroy(), B_GetInstallationLimit(), ccs, CreateBase(), ccs_s::credits, E_CountHired(), E_DeleteAllEmployees(), base_s::founded, i, MAX_EMPL, MAX_INSTALLATIONS_PER_BASE, and type.
TEST_F | ( | CampaignTest | , |
testAutoMissions | |||
) |
Definition at line 313 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_s::mapDef, OBJZERO, ccs_s::overallInterest, mission_s::pos, mission_s::posAssigned, missionResults_s::state, Vector2Copy, and WON.
TEST_F | ( | CampaignTest | , |
testTransferItem | |||
) |
Definition at line 357 of file test_campaign.cpp.
References ItemCargo::add(), B_SetUpFirstBase(), ccs, CreateBase(), ccs_s::date, date_s::day, transfer_s::destBase, E_DeleteAllEmployees(), transfer_s::event, base_s::founded, GetCampaign(), INVSH_GetItemByID(), transfer_s::itemCargo, LIST_Count(), LIST_IsEmpty(), OBJZERO, date_s::sec, tr, TR_TransferRun(), TR_TransferStart(), and ccs_s::transfers.
TEST_F | ( | CampaignTest | , |
testUFORecovery | |||
) |
Definition at line 438 of file test_campaign.cpp.
References AIR_GetAircraft(), ccs, CreateBase(), CreateInstallation(), ccs_s::date, date_s::day, E_DeleteAllEmployees(), storedUFO_s::status, SUFO_RECOVERED, SUFO_STORED, UR_ProcessActive(), and US_StoreUFO().
TEST_F | ( | CampaignTest | , |
testAlienPSIDevice | |||
) |
Definition at line 472 of file test_campaign.cpp.
References RS_GetTechByID(), RS_MarkOneResearchable(), RS_MarkResearchable(), and technology_s::statusResearchable.
TEST_F | ( | CampaignTest | , |
testResearch | |||
) |
Definition at line 481 of file test_campaign.cpp.
References technology_s::base, ccs, CreateBase(), ccs_s::curCampaign, E_DeleteAllEmployees(), base_s::founded, i, campaign_s::researchRate, RS_AssignScientist(), RS_FINISH, RS_GetTechByID(), RS_MarkResearchable(), RS_ResearchRun(), RS_RUNNING, technology_s::scientists, technology_s::statusResearch, technology_s::statusResearchable, and technology_s::time.
TEST_F | ( | CampaignTest | , |
testProductionItem | |||
) |
Definition at line 521 of file test_campaign.cpp.
References B_AtLeastOneExists, B_GetBuildingStatus(), B_WORKSHOP, CreateBase(), E_CountHired(), E_DeleteAllEmployees(), EMPL_WORKER, base_s::founded, i, objDef_s::idx, INVSH_GetItemByID(), equipDef_s::numItems, PR_GetRemainingHours(), PR_GetRemainingMinutes(), PR_ProductionAllowed(), PR_ProductionRun(), PR_QueueNew(), PR_SetData, PR_WorkersAvailable(), technology_s::produceTime, PRODUCTION_TYPE_ITEM, RS_GetTechForItem(), and base_s::storage.
TEST_F | ( | CampaignTest | , |
testProductionAircraft | |||
) |
Definition at line 564 of file test_campaign.cpp.
References AIR_GetAircraft(), B_AtLeastOneExists, B_GetBuildingStatus(), B_WORKSHOP, CAP_AIRCRAFT_SMALL, CAP_GetCurrent, CreateBase(), E_CountHired(), E_DeleteAllEmployees(), EMPL_WORKER, base_s::founded, i, PR_GetRemainingHours(), PR_GetRemainingMinutes(), PR_ProductionAllowed(), PR_ProductionRun(), PR_QueueNew(), PR_SetData, PR_WorkersAvailable(), technology_s::produceTime, PRODUCTION_TYPE_AIRCRAFT, and aircraft_s::tech.
TEST_F | ( | CampaignTest | , |
testDisassembly | |||
) |
Definition at line 612 of file test_campaign.cpp.
References AIR_GetAircraft(), B_AtLeastOneExists, B_GetBuildingStatus(), B_WORKSHOP, CAP_GetCurrent, CAP_ITEMS, ccs, storedUFO_s::comp, CreateBase(), CreateInstallation(), ccs_s::date, E_CountHired(), E_DeleteAllEmployees(), EMPL_WORKER, base_s::founded, i, PR_GetRemainingHours(), PR_GetRemainingMinutes(), PR_ProductionAllowed(), PR_ProductionRun(), PR_QueueNew(), PR_SetData, PR_WorkersAvailable(), PRODUCTION_TYPE_DISASSEMBLY, storedUFO_s::status, SUFO_RECOVERED, components_s::time, and US_StoreUFO().
TEST_F | ( | CampaignTest | , |
testMap | |||
) |
Definition at line 661 of file test_campaign.cpp.
References GEO_GetColor(), MapIsWater, MAPTYPE_TERRAIN, and Vector2Set.
TEST_F | ( | CampaignTest | , |
testAirFight | |||
) |
Definition at line 680 of file test_campaign.cpp.
References AIR_BaseCountAircraft(), AIR_ForeachFromBase, AIR_GetFirstFromBase(), AIR_IDLE, AIR_IsAircraftOnGeoscape(), aircraft_s::aircraftTarget, AIRFIGHT_CampaignRunProjectiles(), ccs, Employee::chr, CP_CreateNewMission(), CP_InterceptNextStage(), CreateBase(), aircraft_s::damage, aircraftSlot_s::delayNextShot, E_DeleteAllEmployees(), base_s::founded, GetCampaign(), i, INTERESTCATEGORY_INTERCEPT, aircraft_s::maxWeapons, ccs_s::numProjectiles, OBJZERO, ccs_s::overallInterest, aircraft_s::pilot, base_s::pos, aircraft_s::pos, character_s::score, chrScoreGlobal_s::skills, mission_s::stage, STAGE_COME_FROM_ORBIT, STAGE_INTERCEPT, STAGE_NOT_ACTIVE, aircraft_s::status, mission_s::ufo, UFO_CampaignRunUFOs(), UFO_CheckShootBack(), UFO_GetAvailableUFOsForMission(), UFO_GetByType(), UFO_MAX, UFO_SendToDestination(), aircraft_s::ufoInterestOnGeoscape, aircraft_s::ufotype, Vector2Copy, VectorEqual, and aircraft_s::weapons.
TEST_F | ( | CampaignTest | , |
testRadar | |||
) |
Definition at line 760 of file test_campaign.cpp.
References CP_CreateNewMission(), CreateBase(), E_DeleteAllEmployees(), base_s::founded, INTERESTCATEGORY_INTERCEPT, base_s::pos, aircraft_s::pos, base_s::radar, RADAR_CheckUFOSensored(), UFO_AddToGeoscape(), UFO_GetAvailableUFOsForMission(), UFO_MAX, UFO_SendToDestination(), radar_s::ufoDetectionProbability, Vector2Copy, and VectorEqual.
TEST_F | ( | CampaignTest | , |
testNation | |||
) |
Definition at line 783 of file test_campaign.cpp.
References GetCampaign(), NAT_GetNationByID(), and NAT_HandleBudget().
TEST_F | ( | CampaignTest | , |
testMarket | |||
) |
Definition at line 797 of file test_campaign.cpp.
References BS_InitMarket(), CP_CampaignRunMarket(), GetCampaign(), and RS_InitTree().
TEST_F | ( | CampaignTest | , |
testSaveLoad | |||
) |
Definition at line 811 of file test_campaign.cpp.
References B_Destroy(), B_SetName(), BASE_DESTROYED, BASE_WORKING, base_s::baseStatus, ccs, Cmd_ExecuteString(), CreateBase(), ccs_s::curCampaign, Cvar_Set(), E_DeleteAllEmployees(), base_s::founded, GetCampaign(), base_s::name, and SAV_Init().
TEST_F | ( | CampaignTest | , |
testSaveMassEmployees | |||
) |
Definition at line 861 of file test_campaign.cpp.
References CAP_EMPLOYEES, CAP_GetFreeCapacity(), ccs, Cmd_ExecuteString(), CreateBase(), ccs_s::curCampaign, Cvar_Set(), E_CreateEmployee(), E_DeleteAllEmployees(), E_HireEmployee(), EMPL_SOLDIER, base_s::founded, GetCampaign(), i, NAT_GetNationByID(), and SAV_Init().
TEST_F | ( | CampaignTest | , |
testLoadMassEmployees | |||
) |
Definition at line 893 of file test_campaign.cpp.
References Cmd_ExecuteString(), and E_DeleteAllEmployees().
TEST_F | ( | CampaignTest | , |
testCampaignRun | |||
) |
Definition at line 901 of file test_campaign.cpp.
References BS_InitMarket(), ccs, CP_CampaignRun(), CreateBase(), ccs_s::date, date_s::day, E_DeleteAllEmployees(), base_s::founded, ccs_s::gameTimeScale, GetCampaign(), i, RS_InitTree(), and SECONDS_PER_DAY.
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 | , |
testCampaignDateHandling | |||
) |
see bug #3166234
Definition at line 986 of file test_campaign.cpp.
References BS_InitMarket(), ccs, CP_CampaignRun(), CP_IsTimeStopped(), CP_UpdateTime(), CreateBase(), ccs_s::date, date_s::day, E_DeleteAllEmployees(), base_s::founded, ccs_s::gameLapse, GetCampaign(), ccs_s::paid, RS_InitTree(), and date_s::sec.
TEST_F | ( | CampaignTest | , |
testHospital | |||
) |
Definition at line 1017 of file test_campaign.cpp.
References CreateBase(), E_DeleteAllEmployees(), E_Foreach, base_s::founded, HOS_HospitalRun(), i, MAX_EMPL, and type.
TEST_F | ( | CampaignTest | , |
testBuildingConstruction | |||
) |
Definition at line 1055 of file test_campaign.cpp.
References B_BuildBuilding(), B_BuildingDestroy(), B_GetBuildingTemplate(), B_STATUS_UNDER_CONSTRUCTION, B_STATUS_WORKING, B_UpdateBuildingConstructions(), baseBuildingTile_s::blocked, baseBuildingTile_s::building, ccs_s::buildings, building_s::buildingStatus, building_s::buildTime, ccs, CreateBase(), ccs_s::date, date_s::day, E_DeleteAllEmployees(), base_s::founded, base_s::idx, base_s::map, ccs_s::numBuildings, and building_s::pos.
TEST_F | ( | CampaignTest | , |
test3090011 | |||
) |
Definition at line 1146 of file test_campaign.cpp.
References SAV_GameLoad().
TEST_F | ( | CampaignTest | , |
testTerrorMissions | |||
) |
Definition at line 1161 of file test_campaign.cpp.
References ccs, ccs_s::cities, Com_GetUfoIdsNum(), CP_ChooseMap(), i, aircraft_s::id, mapDef_s::id, INTERESTCATEGORY_TERROR_ATTACK, LIST_ContainsString(), LIST_Foreach, LIST_IsEmpty(), mission_s::mapDef, MapDef_ForeachSingleplayerCampaign, aircraft_s::mission, OBJZERO, ccs_s::overallInterest, mission_s::pos, skipTest(), mapDef_s::timesAlreadyUsed, mission_s::ufo, UFO_AddToGeoscape(), UFO_GetAvailableUFOsForMission(), UFO_GetByType(), UFO_MAX, UFO_RemoveFromGeoscape(), aircraft_s::ufoInterestOnGeoscape, mapDef_s::ufos, and va().
TEST_F | ( | CampaignTest | , |
testRandomPosMissions | |||
) |
Definition at line 1241 of file test_campaign.cpp.
References CP_GetRandomPosOnGeoscapeWithParameters(), mapDef_s::cultures, mapDef_s::id, MapDef_ForeachSingleplayerCampaign, OBJZERO, mapDef_s::populations, mission_s::pos, skipTest(), and mapDef_s::terrains.
TEST_F | ( | CampaignTest | , |
testEventTrigger | |||
) |
Definition at line 1262 of file test_campaign.cpp.
References ccs_s::campaignTriggerEvents, ccs, Cmd_AddCommand(), Cmd_RemoveCommand(), CP_TriggerEvent(), ccs_s::date, date_s::day, i, Mem_StrDup, NEW_DAY, ccs_s::numCampaignTriggerEvents, OBJZERO, testEventTrigger_f(), testEventTriggerCalled, and UFO_DETECTION.
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 | |||
) |
Definition at line 1326 of file test_campaign.cpp.
References ccs_s::campaigns, ccs, i, Img_LoadImage(), campaign_s::map, ccs_s::numCampaigns, and va().
Definition at line 1257 of file test_campaign.cpp.
References testEventTriggerCalled.
Referenced by TEST_F().
|
static |
Definition at line 63 of file test_campaign.cpp.
|
static |
Definition at line 46 of file test_campaign.cpp.
Referenced by AllocInventoryMemory(), and FreeAllInventory().
|
static |
Definition at line 1256 of file test_campaign.cpp.
Referenced by TEST_F(), and testEventTrigger_f().