| 34 | FAILTEST(producerType!=UnitTypes::Unknown); |
| 35 | } |
| 36 | void CancelMorphTest::start() |
| 37 | { |
| 38 | if (fail) return; |
| 39 | running = true; |
| 40 | |
| 41 | int producerCount = Broodwar->self()->completedUnitCount(producerType); |
| 42 | FAILTEST(producerCount>=1); |
| 43 | for (Unit u : Broodwar->self()->getUnits()) |
| 44 | { |
| 45 | if (u->getType()==producerType) |
| 46 | { |
| 47 | producer = u; |
| 48 | break; |
| 49 | } |
| 50 | } |
| 51 | correctMineralCount = Broodwar->self()->minerals(); |
| 52 | correctGasCount = Broodwar->self()->gas(); |
| 53 | correctSupplyUsedCount = Broodwar->self()->supplyUsed(); |
| 54 | correctCompletedUnitCount = Broodwar->self()->completedUnitCount(unitType); |
| 55 | correctIncompleteUnitCount = Broodwar->self()->incompleteUnitCount(unitType); |
| 56 | correctAllUnitCount = Broodwar->self()->allUnitCount(unitType); |
| 57 | producer->morph(unitType); |
| 58 | BWAssertF(producer->getBuildType()==unitType, |
| 59 | { |
| 60 | log("%s != %s",producer->getBuildType().c_str(),unitType.c_str()); |
| 61 | fail=true; |
| 62 | return; |
| 63 | }); |
| 64 | |
| 65 | startFrame = Broodwar->getFrameCount(); |
| 66 | nextFrame = startFrame; |
| 67 | if (producerType.isBuilding()) |
| 68 | { |
| 69 | correctMineralCount -= unitType.mineralPrice(); |
| 70 | correctGasCount -= unitType.gasPrice(); |
| 71 | correctMineralCount += (int)(unitType.mineralPrice()*0.75); |
| 72 | correctGasCount += (int)(unitType.gasPrice()*0.75); |
| 73 | } |
| 74 | |
| 75 | } |
| 76 | void CancelMorphTest::update() |
| 77 | { |
| 78 | if (running == false) return; |
nothing calls this directly
no test coverage detected