| 29 | |
| 30 | } |
| 31 | void MPHSTest::update() |
| 32 | { |
| 33 | if (running == false) return; |
| 34 | if (fail) |
| 35 | { |
| 36 | running = false; |
| 37 | return; |
| 38 | } |
| 39 | int thisFrame = Broodwar->getFrameCount(); |
| 40 | BWAssert(thisFrame==nextFrame); |
| 41 | nextFrame++; |
| 42 | Broodwar->setScreenPosition(unit->getPosition() - Position(320,240)); |
| 43 | if (thisFrame<startFrame+30) |
| 44 | { |
| 45 | } |
| 46 | else if (thisFrame==startFrame+30) |
| 47 | { |
| 48 | BWAssertF(unit->isBurrowed()==false,{fail=true;return;}); |
| 49 | BWAssertF(unit->isSieged()==false,{fail=true;return;}); |
| 50 | BWAssertF(unit->isMoving()==false,{fail=true;return;}); |
| 51 | BWAssertF(unit->isPatrolling()==false,{fail=true;return;}); |
| 52 | BWAssertF(unit->isHoldingPosition()==false,{fail=true;return;}); |
| 53 | BWAssertF(unit->isIdle()==true,{fail=true;return;}); |
| 54 | targetPosition=unit->getPosition(); |
| 55 | targetPosition.y+=32*30; |
| 56 | targetPosition.makeValid(); |
| 57 | BWAssertF(unit->move(targetPosition),{Broodwar->printf("%s",Broodwar->getLastError().c_str());fail=true;return;}); |
| 58 | BWAssertF(unit->getOrder()==Orders::Move,{fail=true;return;}); |
| 59 | BWAssertF(unit->isMoving()==true,{fail=true;return;}); |
| 60 | BWAssertF(unit->isPatrolling()==false,{fail=true;return;}); |
| 61 | BWAssertF(unit->isIdle()==false,{fail=true;return;}); |
| 62 | BWAssertF(unit->getTargetPosition()==targetPosition,{fail=true;return;}); |
| 63 | } |
| 64 | else if (thisFrame<startFrame+110) |
| 65 | { |
| 66 | if (thisFrame>startFrame+50) |
| 67 | { |
| 68 | BWAssertF(unit->getOrder()==Orders::Move,{fail=true;return;}); |
| 69 | BWAssertF(unit->isMoving()==true,{Broodwar->printf("frame %d",thisFrame-startFrame);fail=true;return;}); |
| 70 | BWAssertF(unit->isIdle()==false,{fail=true;return;}); |
| 71 | } |
| 72 | BWAssertF(unit->isPatrolling()==false,{fail=true;return;}); |
| 73 | if (thisFrame>startFrame+60) |
| 74 | { |
| 75 | BWAssertF(unit->getTargetPosition().getDistance(targetPosition)<64,{Broodwar->printf("frame: %d",thisFrame-startFrame);fail=true;return;}); |
| 76 | } |
| 77 | } |
| 78 | else if (thisFrame==startFrame+110) |
| 79 | { |
| 80 | targetPosition=unit->getPosition(); |
| 81 | targetPosition.y-=32*30; |
| 82 | targetPosition.makeValid(); |
| 83 | BWAssertF(unit->patrol(targetPosition),{Broodwar->printf("%s",Broodwar->getLastError().c_str());fail=true;return;}); |
| 84 | BWAssertF(unit->getOrder()==Orders::Patrol,{fail=true;return;}); |
| 85 | BWAssertF(unit->isMoving()==true,{fail=true;return;}); |
| 86 | BWAssertF(unit->isPatrolling()==true,{fail=true;return;}); |
| 87 | BWAssertF(unit->isIdle()==false,{fail=true;return;}); |
| 88 | BWAssertF(unit->getTargetPosition()==targetPosition,{fail=true;return;}); |
no test coverage detected