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

Method VerifyUnitExistsAndComplete

tests/test_unit_command_common.cc:110–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108 }
109
110 void TestUnitCommand::VerifyUnitExistsAndComplete(UNIT_TYPEID unit_type, bool verify_complete) {
111 bool unit_exists = false;
112 Unit test_unit;
113
114 const ObservationInterface* obs = agent_->Observation();
115 const Units& units = obs->GetUnits(Unit::Alliance::Self);
116 for (const Unit& unit : units) {
117 if (unit.unit_type == unit_type) {
118 unit_exists = true;
119 test_unit = unit;
120 }
121 }
122
123 if (test_unit.build_progress != 1.0f && verify_complete) {
124 ReportError("Unit building/training did not complete as expected.");
125 }
126
127 if (!unit_exists) {
128 ReportError("Expected unit does not exist.");
129 }
130 }
131
132 void TestUnitCommand::VerifyUnitDoesNotExist(UNIT_TYPEID unit_type) {
133 const ObservationInterface* obs = agent_->Observation();

Callers

nothing calls this directly

Calls 2

ObservationMethod · 0.80
GetUnitsMethod · 0.80

Tested by

no test coverage detected