def testChangedMapSameValue(self): modified = types.new_movement('Tires') modified.dictionary = { types.tiles['plain']: 1.5, types.tiles['city']: 1.0, types.tiles['woods']: 2.0, types.tiles['mountain']: 0.0, } self.assertEqual(modified, types.new_movement('Tires'))
def testMoveSixTreadOverTwoPlain(self): valid = move.valid_move( 6, types.new_movement('Treads'), [types.tiles['plain'], types.tiles['plain']], [(1, 1), (1, 2)]) self.assertTrue(valid)
def testValidMoveInvalidTiles(self): invalid = move.valid_move( 2, types.new_movement('Treads'), [types.tiles['plain'] for i in range(10)], [(1, x * 2) for x in range(10)]) self.assertFalse(invalid)
def testMoveTwoTreadOverTenPlain(self): invalid = move.valid_move( 2, types.new_movement('Treads'), [types.tiles['plain'] for i in range(10)], [(1, x) for x in range(10)]) self.assertFalse(invalid)
def testRecon(self): recon = types.new_unit('Recon', consts.RED) self.assertEqual(recon.health, 10) self.assertEqual(recon.attacks, [types.new_attack('DoubleMachineGun')]) self.assertEqual(recon.armor, types.new_armor('WeakMetal')) self.assertEqual(recon.movement, types.new_movement('Tires')) self.assertEqual(recon.distance, 9)
def testInfantry(self): inf = types.new_unit('Infantry', consts.RED) self.assertEqual(inf.health, 10) self.assertEqual(inf.attacks, [types.new_attack('MachineGun')]) self.assertEqual(inf.armor, types.new_armor('BodyArmor')) self.assertEqual(inf.movement, types.new_movement('Feet')) self.assertEqual(inf.distance, 3)
def testTank(self): tank = types.new_unit('Tank', consts.RED) self.assertEqual(tank.health, 10) self.assertEqual( tank.attacks, [types.new_attack('RegularCannon'), types.new_attack('MachineGun')]) self.assertEqual(tank.armor, types.new_armor('HeavyMetal')) self.assertEqual(tank.movement, types.new_movement('Treads')) self.assertEqual(tank.distance, 7)
def testTreads(self): treads = types.new_movement('Treads') self.assertEqual(treads[types.tiles['plain']], 1.0) self.assertEqual(treads[types.tiles['city']], 1.0) self.assertEqual(treads[types.tiles['woods']], 1.0) self.assertEqual(treads[types.tiles['mountain']], 0.0)
def testChangedMapDifferentValue(self): modified = types.new_movement('Tires') modified.dictionary = {types.tiles['plain']: 0.0} self.assertNotEqual(modified, types.new_movement('Tires'))
def testTireDoesNotEqualModifiedTire(self): modified = types.new_movement('Tires') modified[types.tiles['plain']] = modified[types.tiles['plain']] + 1 self.assertNotEqual(modified, types.new_movement('Tires'))
def testTireDoesNotEqualTreads(self): self.assertNotEqual(types.new_movement('Treads'), types.new_movement('Tires'))
def testTireEqualsTire(self): self.assertEqual(types.new_movement('Tires'), types.new_movement('Tires'))
def testAssignment(self): feet = types.new_movement('Feet') feet[types.tiles['plain']] = 2.0 self.assertEqual(feet[types.tiles['plain']], 2.0)
def testFeet(self): feet = types.new_movement('Feet') self.assertEqual(feet[types.tiles['plain']], 1.0) self.assertEqual(feet[types.tiles['city']], 1.0) self.assertEqual(feet[types.tiles['woods']], 1.0) self.assertEqual(feet[types.tiles['mountain']], 2.0)
def testTires(self): tires = types.new_movement('Tires') self.assertEqual(tires[types.tiles['plain']], 1.5) self.assertEqual(tires[types.tiles['city']], 1.0) self.assertEqual(tires[types.tiles['woods']], 2.0) self.assertEqual(tires[types.tiles['mountain']], 0.0)