def test_obstacle(self): rover1 = Rover("Rover-001", "N", 0, 0) grid1 = Grid([[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, "rock", 0, 0, 0, 0, 0], [0, 0], [0]]) Rover.commands(rover1, grid1, "bbbbrf") self.assertEqual(rover1.y, 4) self.assertEqual(rover1.x, 0) grid1.noPrivadoGrid[rover1.y][rover1.x] = 0
def test_grid_left(self): rover1 = Rover("Rover-001", "N", 0, 0) grid1 = Grid([[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0], [0]]) Rover.commands(rover1, grid1, "lfff") self.assertEqual(rover1.y, 0) self.assertEqual(rover1.x, 0) grid1.noPrivadoGrid[rover1.y][rover1.x] = 0
def test_grid(self): rover1 = Rover("Rover-001", "N", 0, 0) grid1 = Grid([[0, 0], [0, 0], ["Rover2", 0]]) grid2 = Grid([[0, "Rock"], [0, 0], ["Rover2", 0]]) # TODO ejecucion por Grid2 -> No se mueve a [0, 1] Rover.commands(rover1, grid2, "rf") self.assertEqual(rover1.y, 0) self.assertEqual(rover1.x, 0) # TODO Ejecucion por Grid 1 -> Si se mueve a [0, 1] Rover.commands(rover1, grid1, "rf") self.assertEqual(rover1.y, 1) self.assertEqual(rover1.x, 0)