| 227 | }; |
| 228 | |
| 229 | class TestGetUnitData : public TestSequence { |
| 230 | void OnTestStart() { |
| 231 | const ObservationInterface* obs = agent_->Observation(); |
| 232 | const UnitTypes unit_data = obs->GetUnitTypeData(); |
| 233 | UnitTypeData stalker_data = unit_data.at(static_cast<uint32_t>(UNIT_TYPEID::PROTOSS_STALKER)); |
| 234 | UnitTypeData Overlord_data = unit_data.at(static_cast<uint32_t>(UNIT_TYPEID::ZERG_OVERLORDTRANSPORT)); |
| 235 | const GameInfo& game_info = agent_->Observation()->GetGameInfo(); |
| 236 | Point2D origin_pt_ = FindCenterOfMap(game_info); |
| 237 | agent_->Debug()->DebugCreateUnit(UNIT_TYPEID::PROTOSS_STALKER, origin_pt_, agent_->Observation()->GetPlayerID(), 1); |
| 238 | agent_->Debug()->SendDebug(); |
| 239 | |
| 240 | if (stalker_data.attributes.empty()) { |
| 241 | std::string errorStr = "UnitTypeData is reporting an no attributes"; |
| 242 | ReportError(errorStr.c_str()); |
| 243 | } |
| 244 | if (!stalker_data.available) { |
| 245 | std::string errorStr = "UnitTypeData is reporting stalkers are unavailable"; |
| 246 | ReportError(errorStr.c_str()); |
| 247 | } |
| 248 | if (stalker_data.cargo_size != 2) { |
| 249 | std::string errorStr = "UnitTypeData is reporting an incorrect cargo value. Expected : 0 Result : " + std::to_string(stalker_data.cargo_size); |
| 250 | ReportError(errorStr.c_str()); |
| 251 | } |
| 252 | if (stalker_data.mineral_cost != 125) { |
| 253 | std::string errorStr = "UnitTypeData is reporting an incorrect mineral cost value. Expected : 125 Result : " + std::to_string(stalker_data.mineral_cost); |
| 254 | ReportError(errorStr.c_str()); |
| 255 | } |
| 256 | if (stalker_data.vespene_cost != 50) { |
| 257 | std::string errorStr = "UnitTypeData is reporting an incorrect vespene value. Expected : 50 Result : " + std::to_string(stalker_data.vespene_cost); |
| 258 | ReportError(errorStr.c_str()); |
| 259 | } |
| 260 | if (stalker_data.name != "Stalker") { |
| 261 | std::string errorStr = "UnitTypeData is reporting an incorrect name. Expected : Stalker Result : " + stalker_data.name; |
| 262 | ReportError(errorStr.c_str()); |
| 263 | } |
| 264 | if (stalker_data.unit_type_id != UNIT_TYPEID::PROTOSS_STALKER) { |
| 265 | std::string errorStr = "UnitTypeData is reporting an incorrect unittypeID Expected : 74 Result : " + std::to_string(stalker_data.unit_type_id); |
| 266 | ReportError(errorStr.c_str()); |
| 267 | } |
| 268 | if (stalker_data.weapons.empty()) { |
| 269 | std::string errorStr = "UnitTypeData is reporting no weapons"; |
| 270 | ReportError(errorStr.c_str()); |
| 271 | } |
| 272 | if (!Overlord_data.weapons.empty()) { |
| 273 | std::string errorStr = "UnitTypeData is reporting weapons for an overlord"; |
| 274 | ReportError(errorStr.c_str()); |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | void OnTestFinish() { |
| 279 | KillAllUnits(); |
| 280 | } |
| 281 | }; |
| 282 | // |
| 283 | // UnitCommandTestBot |
| 284 | // |
no outgoing calls