| 74 | |
| 75 | } |
| 76 | void CancelMorphTest::update() |
| 77 | { |
| 78 | if (running == false) return; |
| 79 | if (fail) |
| 80 | { |
| 81 | running = false; |
| 82 | return; |
| 83 | } |
| 84 | int thisFrame = Broodwar->getFrameCount(); |
| 85 | FAILTEST(thisFrame==nextFrame); |
| 86 | nextFrame++; |
| 87 | FAILTEST(producer!=NULL); |
| 88 | if (producer->exists()) |
| 89 | Broodwar->setScreenPosition(producer->getPosition() - Position(320,240)); |
| 90 | |
| 91 | if (thisFrame<=startFrame+20) |
| 92 | { |
| 93 | BWAssertF(producer->getBuildType()==unitType, |
| 94 | { |
| 95 | log("%s != %s, this frame = %d, start frame = %d",producer->getBuildType().c_str(),unitType.c_str(),thisFrame,startFrame); |
| 96 | fail=true; |
| 97 | return; |
| 98 | }); |
| 99 | FAILTEST(producer->isMorphing()==true); |
| 100 | FAILTEST(producer->isConstructing()==true); |
| 101 | FAILTEST(producer->isTraining()==false); |
| 102 | FAILTEST(producer->isIdle()==false); |
| 103 | FAILTEST(producer->isResearching()==false); |
| 104 | FAILTEST(producer->isUpgrading()==false); |
| 105 | BWAssertF(producer->getTech()==TechTypes::None,{log("%s",producer->getTech().c_str());fail=true;return;}); |
| 106 | FAILTEST(producer->getUpgrade()==UpgradeTypes::None); |
| 107 | } |
| 108 | if (thisFrame==startFrame+20) |
| 109 | { |
| 110 | FAILTEST(producer->cancelMorph()); |
| 111 | } |
| 112 | |
| 113 | if (thisFrame>=startFrame+20) |
| 114 | { |
| 115 | if (producer->exists() || producerType!=UnitTypes::Zerg_Larva) |
| 116 | { |
| 117 | BWAssertF(producer->getBuildType()==UnitTypes::None,{log("%d: %s",thisFrame-startFrame,producer->getBuildType().c_str());fail=true;return;}); |
| 118 | BWAssertF(producer->isMorphing()==false,{log("%d",thisFrame-startFrame);}); |
| 119 | BWAssertF(producer->isConstructing()==false,{log("%d",thisFrame-startFrame);}); |
| 120 | FAILTEST(producer->isTraining()==false); |
| 121 | FAILTEST(producer->isIdle()==true); |
| 122 | FAILTEST(producer->isResearching()==false); |
| 123 | FAILTEST(producer->isUpgrading()==false); |
| 124 | FAILTEST(producer->getTech()==TechTypes::None); |
| 125 | FAILTEST(producer->getUpgrade()==UpgradeTypes::None); |
| 126 | FAILTEST(producer->getRemainingBuildTime()==0); |
| 127 | FAILTEST(producer->getRemainingTrainTime()==0); |
| 128 | FAILTEST(producer->getRemainingResearchTime()==0); |
| 129 | FAILTEST(producer->getRemainingUpgradeTime()==0); |
| 130 | BWAssertF(Broodwar->self()->minerals()==correctMineralCount,{log("%d: %d!=%d",thisFrame-startFrame,Broodwar->self()->minerals(),correctMineralCount);}); |
| 131 | FAILTEST(Broodwar->self()->gas()==correctGasCount); |
| 132 | BWAssertF(Broodwar->self()->supplyUsed()==correctSupplyUsedCount,{log("%d!=%d",Broodwar->self()->supplyUsed(),correctSupplyUsedCount);fail=true;return;}); |
| 133 | if (thisFrame>=startFrame+25) |
nothing calls this directly
no test coverage detected