Example #1
0
 def test_position_validation(self):
     plateau = Plateau(x=10, y=10)
     position = Position(x=5, y=5, direction=Direction.NORTH)
     self.assertTrue(plateau.isValidPosition(position))
Example #2
0
 def test_invalid_position_validation_y_out_of_bounds(self):
     plateau = Plateau(x=10, y=10)
     position = Position(x=5, y=99, direction=Direction.NORTH)
     self.assertFalse(plateau.isValidPosition(position))
     position = Position(x=5, y=-1, direction=Direction.NORTH)
     self.assertFalse(plateau.isValidPosition(position))
Example #3
0
 def test_instantiation_from_invalid__with_wrong_argnumber(self):
     str_pos = '1 2'  # x, y, and direction
     position_from_string = Position.from_string(str_pos)
Example #4
0
 def test_object_instantiation(self):
     pos = Position(x=1, y=2, direction='n')
     self.assertIsInstance(pos, Position)
Example #5
0
 def test_instantiation_from_invalid_string_with_wrong_xy(self):
     str_pos = 'someRandomInt 2 n'  # x, y, and direction
     position_from_string = Position.from_string(str_pos)
Example #6
0
 def test_instantiation_from_invalid_string_with_wrong_direction(self):
     str_pos = '1 2 someInvalidCharacter'  # x, y, and direction
     position_from_string = Position.from_string(str_pos)
Example #7
0
 def test_invalid_object_instantiation_invalid_direction2(self):
     pos = Position(x=1, y='notIntValue', direction=1)
Example #8
0
 def test_instantiation_from_valid_string(self):
     pos = Position(x=1, y=2, direction='n')
     str_pos = '1 2 n'  # x, y, and direction
     position_from_string = Position.from_string(str_pos)
     self.assertEqual(pos, position_from_string)
Example #9
0
 def test_invalid_object_instantiation_invalid_x(self):
     pos = Position(x='notIntValue', y=2, direction='n')
Example #10
0
 def test_object_instantiation(self):
     plateau = Plateau(x=10, y=10)
     position = Position(x=10, y=10, direction=Direction.NORTH)
     rover = Rover(plateau, position)
     self.assertIsInstance(rover, Rover)
Example #11
0
 def test_invalid_movement_out_of_boundaries(self):
     plateau = Plateau(x=10, y=10)
     position = Position(x=10, y=10, direction=Direction.NORTH)
     rover = Rover(plateau, position)
     rover.move_forward()
Example #12
0
 def test_rotation_right(self):
     plateau = Plateau(x=10, y=10)
     position = Position(x=10, y=10, direction=Direction.NORTH)
     rover = Rover(plateau, position)
     rover.rotate_right()
     self.assertEqual(rover.position.direction, Direction.EAST)
Example #13
0
 def test_invalid_object_instantiation_wrong_plateau_object(self):
     lateau = (5, 5)
     position = Position(x=10, y=10, direction=Direction.NORTH)
     rover = Rover(plateau, position)