MCPcopy Create free account
hub / github.com/Blizzard/s2client-api / TestBuildBarracksTechLab

Class TestBuildBarracksTechLab

tests/test_unit_command.cc:109–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107 //
108
109 class TestBuildBarracksTechLab : public TestUnitCommandNoTarget {
110 public:
111 TestBuildBarracksTechLab() {
112 test_unit_type_ = UNIT_TYPEID::TERRAN_BARRACKS;
113 test_ability_ = ABILITY_ID::BUILD_TECHLAB;
114 }
115
116 void SetTestTime() override {
117 wait_game_loops_ = 200;
118 }
119
120 void OnTestFinish() override {
121 const ObservationInterface* obs = agent_->Observation();
122
123 Units barracks_units = obs->GetUnits(Unit::Self, IsUnit(UNIT_TYPEID::TERRAN_BARRACKS));
124 if (barracks_units.size() != 1) {
125 ReportError("Could not find landed barracks.");
126 }
127
128 // Find the tech lab.
129 Units techlab_units = obs->GetUnits(Unit::Self, IsUnit(UNIT_TYPEID::TERRAN_BARRACKSTECHLAB));
130 if (techlab_units.size() != 1) {
131 ReportError("Could not find a tech lab.");
132 }
133
134 if (barracks_units.size() == 1 && techlab_units.size() == 1) {
135 if (barracks_units[0].add_on_tag == 0LL) {
136 ReportError("Barracks does not have an add-on.");
137 }
138 if (barracks_units[0].add_on_tag != techlab_units[0].tag) {
139 ReportError("Barracks add on tag does not match tech lab tag.");
140 }
141 }
142
143 VerifyUnitExistsAndComplete(UNIT_TYPEID::TERRAN_BARRACKSTECHLAB);
144 VerifyUnitIdleAfterOrder(test_unit_type_);
145 VerifyUnitIdleAfterOrder(UNIT_TYPEID::TERRAN_BARRACKSTECHLAB);
146 KillAllUnits();
147 }
148 };
149
150 class TestBuildFlyingBarracksTechLab : public TestUnitCommandTargetingPoint {
151 public:

Callers 1

UnitCommandTestBotMethod · 0.85

Calls

no outgoing calls

Tested by 1

UnitCommandTestBotMethod · 0.68