def test_not_detect_boundaries_move(self): rover = Rover() rover.move() self.assertEqual(rover.position_x, 1) self.assertEqual(rover.position_y, 0) self.assertEqual(False, self.plateau.detect_boundaries(rover))
def test_basic_methods(): # for future rover = Rover() rover.rotate_left() rover.rotate_right() rover.move() rover.parse_commands("LLMM") rover.get_location() rover.get_direction()
def test_advanced_move(self): rover = Rover() rover.position_x = 5 rover.position_y = 5 rover.direction = 3 rover.move() self.assertEqual(rover.position_x, 5) self.assertEqual(rover.position_y, 6)
def test_detect_bondaries_move(self): rover = Rover() rover.position_x = 5 rover.position_y = 5 rover.direction = 3 rover.move() self.assertEqual(rover.position_x, 5) self.assertEqual(rover.position_y, 6) self.assertRaises(Exception, lambda: self.plateau.detect_boundaries(rover))
def test_move_when_pointed_east_in_x_direction_forward(self): rover = Rover(self.coordinate, East()) rover.move(self.plateau.is_coordinate_with_bounds) self.assertEqual(rover.coordinate, Coordinate(2, 2))
def test_move_when_pointed_west_in_x_direction_backwards(self): rover = Rover(self.coordinate, West()) rover.move(self.plateau.is_coordinate_with_bounds) self.assertEqual(rover.coordinate, Coordinate(0, 2))
def test_move_when_pointed_south_in_y_direction_downwards(self): rover = Rover(self.coordinate, South()) rover.move(self.plateau.is_coordinate_with_bounds) self.assertEqual(rover.coordinate, Coordinate(1, 1))
def test_basic_move(self): rover = Rover() rover.move() self.assertEqual(rover.position_x, 1) self.assertEqual(rover.position_y, 0)