def testValidFire(self): testUnit = Unit.purchaseUnit(1,0,self.testPlayer) testTower = self.testPlayer.purchaseTower((1,0)) self.testTower.fire(testUnit) self.assertEquals(testUnit.health, 0)
def testValidPurchaseUnit(self): testUnit = Unit.purchaseUnit(1,1,self.testPlayer) self.assertEquals(testUnit.level,1) self.assertEquals(testUnit.specialisation,1) self.assertEquals(testUnit.owner, self.testPlayer.name)
def testInvalidPurchaseUnit2(self): testUnit = Unit.purchaseUnit(1,-2,self.testPlayer) self.assertEquals(testUnit, None) testUnit = Unit.purchaseUnit(1,2,self.testPlayer) self.assertEquals(testUnit, None)
def testInvalidPurchaseUnit1(self): test = Unit.purchaseUnit(3,0,self.testPlayer) self.assertEquals(test,None)
def testInvalidPurchaseUnit(self): self.testPlayer.resources = 0 test = Unit.purchaseUnit(1,0,self.testPlayer) self.assertEquals(test,None)
def testValidMovement(self): testUnit=Unit.purchaseUnit(1,0,self.testPlayer) paths=self.testBoard.findPaths() self.assertTrue(self.testBoard.queueUnit(testUnit, 3)) self.testBoard.moveUnits() self.assertEquals(self.testBoard.paths[3].moving.pop(), testUnit)