def test_get_cost(self): terrain_map = CTerrainMap() x = 0 z = 0 cost = terrain_map.GetCost(x, z) self.assertEqual(cost, 20000) terrain_map.m_iSizeX = 1 terrain_map.m_iSizeZ = 1 terrain_map.m_Terrain = [] terrain_map.m_Terrain.append([]) terrain = CTerrain() terrain.m_iCost = 10 terrain_map.m_Terrain[0].append(terrain) cost = terrain_map.GetCost(x, z) self.assertEqual(cost, 10)
def test_can_walk(self): terrain_map = CTerrainMap() x = 0 z = 0 can_walk = terrain_map.CanWalk(x, z) self.assertFalse(can_walk) terrain_map.m_iSizeX = 1 terrain_map.m_iSizeZ = 1 terrain_map.m_Terrain = [] terrain_map.m_Terrain.append([]) terrain = CTerrain() terrain.m_bCanWalk = True terrain_map.m_Terrain[0].append(terrain) can_walk = terrain_map.CanWalk(x, z) self.assertTrue(can_walk)