| 12 | running = false; |
| 13 | } |
| 14 | void CloakTest::start() |
| 15 | { |
| 16 | if (fail) return; |
| 17 | running = true; |
| 18 | |
| 19 | int userCount = Broodwar->self()->completedUnitCount(unitType); |
| 20 | BWAssertF(userCount>=1,{fail=true;return;}); |
| 21 | for (Unit u : Broodwar->self()->getUnits()) |
| 22 | if (u->getType()==unitType) |
| 23 | unit = u; |
| 24 | |
| 25 | BWAssertF(unit!=NULL,{fail=true;return;}); |
| 26 | BWAssertF(unit->exists(),{fail=true;return;}); |
| 27 | BWAssertF(unit->isCloaked()==false,{fail=true;return;}); |
| 28 | BWAssertF(unit->getEnergy()>=50,{fail=true;return;}); |
| 29 | currentEnergy = unit->getEnergy(); |
| 30 | unit->cloak(); |
| 31 | if (unitType==UnitTypes::Terran_Ghost) |
| 32 | currentEnergy-=TechTypes::Personnel_Cloaking.energyCost(); |
| 33 | else |
| 34 | currentEnergy-=TechTypes::Cloaking_Field.energyCost(); |
| 35 | BWAssertF(unit->getEnergy()==currentEnergy,{fail=true;return;}); |
| 36 | BWAssertF(unit->getOrder()==Orders::Cloak,{fail=true;return;}); |
| 37 | startFrame = Broodwar->getFrameCount(); |
| 38 | nextFrame = Broodwar->getFrameCount(); |
| 39 | |
| 40 | } |
| 41 | void CloakTest::update() |
| 42 | { |
| 43 | if (running == false) return; |
nothing calls this directly
no test coverage detected