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

Class TestBuildBarracksTechLabDifferentPoint

tests/test_unit_command.cc:192–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190 };
191
192 class TestBuildBarracksTechLabDifferentPoint : public TestUnitCommandTargetingPoint {
193 public:
194 TestBuildBarracksTechLabDifferentPoint() {
195 test_unit_type_ = UNIT_TYPEID::TERRAN_BARRACKS;
196 test_ability_ = ABILITY_ID::BUILD_TECHLAB;
197 }
198
199 void SetTestTime() override {
200 wait_game_loops_ = 200;
201 }
202
203 void OnTestFinish() override {
204 const ObservationInterface* obs = agent_->Observation();
205 Units units = obs->GetUnits();
206
207 // Barracks will have landed. Find it.
208 Units barracks_units = obs->GetUnits(Unit::Self, IsUnit(UNIT_TYPEID::TERRAN_BARRACKS));
209 if (barracks_units.size() != 1) {
210 ReportError("Could not find landed barracks.");
211 }
212
213 // Find the tech lab.
214 Units techlab_units = obs->GetUnits(Unit::Self, IsUnit(UNIT_TYPEID::TERRAN_BARRACKSTECHLAB));
215 if (techlab_units.size() != 1) {
216 ReportError("Could not find a tech lab.");
217 }
218
219 if (barracks_units.size() == 1 && techlab_units.size() == 1) {
220 if (barracks_units[0].add_on_tag == 0LL) {
221 ReportError("Barracks does not have an add-on.");
222 }
223 if (barracks_units[0].add_on_tag != techlab_units[0].tag) {
224 ReportError("Barracks add on tag does not match tech lab tag.");
225 }
226 }
227
228 VerifyUnitExistsAndComplete(UNIT_TYPEID::TERRAN_BARRACKSTECHLAB);
229 VerifyUnitIdleAfterOrder(UNIT_TYPEID::TERRAN_BARRACKS);
230 VerifyUnitIdleAfterOrder(UNIT_TYPEID::TERRAN_BARRACKSTECHLAB);
231 KillAllUnits();
232 }
233 };
234
235 class TestBuildBarracksTechLabSamePoint : public TestBuildBarracksTechLabDifferentPoint {
236 void AdditionalTestSetup() override {

Callers 1

UnitCommandTestBotMethod · 0.85

Calls

no outgoing calls

Tested by 1

UnitCommandTestBotMethod · 0.68