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

Class TestBuildFlyingBarracksTechLab

tests/test_unit_command.cc:150–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148 };
149
150 class TestBuildFlyingBarracksTechLab : public TestUnitCommandTargetingPoint {
151 public:
152 TestBuildFlyingBarracksTechLab() {
153 test_unit_type_ = UNIT_TYPEID::TERRAN_BARRACKSFLYING;
154 test_ability_ = ABILITY_ID::BUILD_TECHLAB;
155 }
156
157 void SetTestTime() override {
158 wait_game_loops_ = 200;
159 }
160
161 void OnTestFinish() override {
162 const ObservationInterface* obs = agent_->Observation();
163
164 // Barracks will have landed. Find it.
165 Units barracks_units = obs->GetUnits(Unit::Self, IsUnit(UNIT_TYPEID::TERRAN_BARRACKS));
166 if (barracks_units.size() != 1) {
167 ReportError("Could not find landed barracks.");
168 }
169
170 // Find the tech lab.
171 Units techlab_units = obs->GetUnits(Unit::Self, IsUnit(UNIT_TYPEID::TERRAN_BARRACKSTECHLAB));
172 if (techlab_units.size() != 1) {
173 ReportError("Could not find a tech lab.");
174 }
175
176 if (barracks_units.size() == 1 && techlab_units.size() == 1) {
177 if (barracks_units[0].add_on_tag == 0LL) {
178 ReportError("Barracks does not have an add-on.");
179 }
180 if (barracks_units[0].add_on_tag != techlab_units[0].tag) {
181 ReportError("Barracks add on tag does not match tech lab tag.");
182 }
183 }
184
185 VerifyUnitExistsAndComplete(UNIT_TYPEID::TERRAN_BARRACKSTECHLAB);
186 VerifyUnitIdleAfterOrder(UNIT_TYPEID::TERRAN_BARRACKS);
187 VerifyUnitIdleAfterOrder(UNIT_TYPEID::TERRAN_BARRACKSTECHLAB);
188 KillAllUnits();
189 }
190 };
191
192 class TestBuildBarracksTechLabDifferentPoint : public TestUnitCommandTargetingPoint {
193 public:

Callers 1

UnitCommandTestBotMethod · 0.85

Calls

no outgoing calls

Tested by 1

UnitCommandTestBotMethod · 0.68