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