| 2 | using namespace std; |
| 3 | using namespace BWAPI; |
| 4 | void MapTest::onStart() |
| 5 | { |
| 6 | BWAssert(Broodwar->isReplay()==false); |
| 7 | Broodwar->enableFlag(Flag::CompleteMapInformation); |
| 8 | Broodwar->setLocalSpeed(0); |
| 9 | Broodwar->setFrameSkip(512); |
| 10 | BWAssert(Broodwar->mapWidth()==192); |
| 11 | BWAssert(Broodwar->mapHeight()==128); |
| 12 | BWAssert(Broodwar->mapFileName()=="MapTest.scx"); |
| 13 | //Don't assert this since path is allowed to differ |
| 14 | Broodwar->printf("%s",Broodwar->mapPathName().c_str()); |
| 15 | BWAssert(Broodwar->mapName()=="Test Map"); |
| 16 | |
| 17 | //Update this whenever the map is modified |
| 18 | BWAssert(Broodwar->mapHash()=="b1458acae03d6bbacd223ba8c96830b28a6035fb"); |
| 19 | |
| 20 | for ( int x = 0; x < 10; ++x ) |
| 21 | for ( int y = 0; y < 10; ++y ) |
| 22 | { |
| 23 | BWAssert(Broodwar->isWalkable( WalkPosition(x,y) )); |
| 24 | BWAssert(Broodwar->getGroundHeight(x,y)==2); |
| 25 | BWAssert(Broodwar->isBuildable(x,y)); |
| 26 | BWAssert(Broodwar->isVisible(x,y)); |
| 27 | BWAssert(Broodwar->isExplored(x,y)); |
| 28 | } |
| 29 | |
| 30 | for(int x=5;x<14;x++) |
| 31 | { |
| 32 | BWAssertF(Broodwar->hasCreep(x,0), { log(" hasCreep(%u,0)", x); }); |
| 33 | } |
| 34 | for(int x=14;x<40;x++) |
| 35 | { |
| 36 | BWAssert(Broodwar->hasCreep(x,0)==false); |
| 37 | } |
| 38 | for(int x=13;x<20;x++) |
| 39 | { |
| 40 | for(int y=10;y<15;y++) |
| 41 | { |
| 42 | BWAssert(Broodwar->hasPower(x,y,2,2)); |
| 43 | } |
| 44 | } |
| 45 | for(int x=50;x<60;x++) |
| 46 | { |
| 47 | for(int y=50;y<60;y++) |
| 48 | { |
| 49 | BWAssert(Broodwar->getGroundHeight(x,y)==0); |
| 50 | BWAssert(Broodwar->isBuildable(x,y)); |
| 51 | BWAssert(Broodwar->isVisible(x,y)==false); |
| 52 | BWAssert(Broodwar->isExplored(x,y)==false); |
| 53 | BWAssert(Broodwar->hasPower(x,y,2,2)==false); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | //briefly check some of these functions. Can add more test cases later if needed |
| 58 | BWAssert(Broodwar->canBuildHere(TilePosition(18,12),UnitTypes::Protoss_Pylon)); |
| 59 | BWAssert(Broodwar->canBuildHere(TilePosition(18,12),UnitTypes::Protoss_Gateway)); |
| 60 | BWAssert(Broodwar->canMake(UnitTypes::Protoss_Gateway)==false); |
| 61 | BWAssert(Broodwar->canResearch(TechTypes::Psionic_Storm)==false); |
nothing calls this directly
no test coverage detected