| 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(); |
nothing calls this directly
no test coverage detected