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

Method OnTestFinish

tests/test_unit_command.cc:120–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 3

IsUnitClass · 0.85
ObservationMethod · 0.80
GetUnitsMethod · 0.80

Tested by

no test coverage detected