| 41 | |
| 42 | } |
| 43 | void CancelUpgradeTest::update() |
| 44 | { |
| 45 | if (running == false) return; |
| 46 | if (fail) |
| 47 | { |
| 48 | running = false; |
| 49 | return; |
| 50 | } |
| 51 | int thisFrame = Broodwar->getFrameCount(); |
| 52 | BWAssert(thisFrame==nextFrame); |
| 53 | nextFrame++; |
| 54 | Broodwar->setScreenPosition(upgrader->getPosition() - Position(320,240)); |
| 55 | BWAssertF(upgrader!=NULL,{fail=true;return;}); |
| 56 | if (thisFrame<startFrame+20) |
| 57 | { |
| 58 | BWAssertF(upgrader->getBuildType()==UnitTypes::None,{fail=true;return;}); |
| 59 | BWAssertF(upgrader->isMorphing()==false,{fail=true;return;}); |
| 60 | BWAssertF(upgrader->isConstructing()==false,{fail=true;return;}); |
| 61 | BWAssertF(upgrader->isTraining()==false,{fail=true;return;}); |
| 62 | BWAssertF(upgrader->isResearching()==false,{fail=true;return;}); |
| 63 | BWAssertF(upgrader->isUpgrading()==true,{fail=true;return;}); |
| 64 | BWAssertF(upgrader->getTech()==TechTypes::None,{fail=true;return;}); |
| 65 | BWAssertF(upgrader->getUpgrade()==upgradeType,{fail=true;return;}); |
| 66 | BWAssertF(upgrader->isIdle()==false,{fail=true;return;}); |
| 67 | } |
| 68 | if (thisFrame==startFrame+20) |
| 69 | { |
| 70 | upgrader->cancelUpgrade(); |
| 71 | } |
| 72 | if (thisFrame>=startFrame+20) |
| 73 | { |
| 74 | BWAssertF(upgrader->getBuildType()==UnitTypes::None,{fail=true;return;}); |
| 75 | BWAssertF(upgrader->isMorphing()==false,{fail=true;return;}); |
| 76 | BWAssertF(upgrader->isConstructing()==false,{fail=true;return;}); |
| 77 | BWAssertF(upgrader->isTraining()==false,{fail=true;return;}); |
| 78 | BWAssertF(upgrader->isResearching()==false,{fail=true;return;}); |
| 79 | BWAssertF(upgrader->isUpgrading()==false,{fail=true;return;}); |
| 80 | BWAssertF(upgrader->getTech()==TechTypes::None,{fail=true;return;}); |
| 81 | BWAssertF(upgrader->getUpgrade()==UpgradeTypes::None,{fail=true;return;}); |
| 82 | BWAssertF(upgrader->isIdle()==true,{fail=true;return;}); |
| 83 | BWAssertF(upgrader->getRemainingBuildTime()==0,{fail=true;return;}); |
| 84 | BWAssertF(upgrader->getRemainingTrainTime()==0,{fail=true;return;}); |
| 85 | BWAssertF(upgrader->getRemainingResearchTime()==0,{fail=true;return;}); |
| 86 | BWAssertF(upgrader->getRemainingUpgradeTime()==0,{fail=true;return;}); |
| 87 | BWAssertF(Broodwar->self()->minerals()==correctMineralCount,{fail=true;return;}); |
| 88 | BWAssertF(Broodwar->self()->gas()==correctGasCount,{fail=true;return;}); |
| 89 | BWAssertF(Broodwar->self()->supplyUsed()==correctSupplyUsedCount,{fail=true;return;}); |
| 90 | } |
| 91 | if (thisFrame>=startFrame+40) |
| 92 | { |
| 93 | running = false; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | void CancelUpgradeTest::stop() |
| 98 | { |
nothing calls this directly
no test coverage detected