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

Method VerifyUpgradeOwned

tests/test_unit_command_common.cc:163–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161 }
162
163 void TestUnitCommand::VerifyUpgradeOwned(std::string test_upgrade_name, bool verify_not_owned) {
164 unsigned int test_upgrade_id;
165 bool upgrade_data_found = false;
166 bool upgrade_owned = false;
167 const ObservationInterface* obs = agent_->Observation();
168 Upgrades upgrade_data = obs->GetUpgradeData();
169 std::vector<UpgradeID> owned_upgrades = obs->GetUpgrades();
170
171 for (sc2::UpgradeData upgrade : upgrade_data) {
172 if (upgrade.name == test_upgrade_name) {
173 test_upgrade_id = upgrade.upgrade_id;
174 upgrade_data_found = true;
175 }
176 }
177
178 if (!upgrade_data_found) {
179 ReportError("Upgrade in test not found in upgrade data.");
180 return;
181 }
182
183 for (UpgradeID upgrade : owned_upgrades) {
184 if (upgrade == test_upgrade_id) {
185 upgrade_owned = true;
186 }
187 }
188
189 if (!upgrade_owned && !verify_not_owned) {
190 ReportError("Upgrade in test is not owned.");
191 }
192
193 if (upgrade_owned && verify_not_owned) {
194 ReportError("Upgrade in test is already owned.");
195 }
196 }
197
198 bool TestUnitCommand::GetTestUnit(Unit& test_unit) {
199 const ObservationInterface* obs = agent_->Observation();

Callers

nothing calls this directly

Calls 1

ObservationMethod · 0.80

Tested by

no test coverage detected