Example #1
0
 def test__initial_ant_and_no_ant(self):
     config = DictionaryConfigProvider()
     config.SetValue('InitialPosition', 'InitialDirection', 0)
     config.SetValue('InitialPosition', 'InitialPosition_x', 1)
     config.SetValue('InitialPosition', 'InitialPosition_y', 1)
     processor = AntStepProcesser(config)
     processor.process_ant_step(99, StepEnum.NoStep)
     position_data = processor.get_ant_position_and_direction(99)
     self.assertTrue(position_data[0] == 1 and position_data[1] == 1
                     and position_data[2] == DirectionsEnum.North)
     position_data = processor.get_ant_position_and_direction(100)
     self.assertTrue(position_data[0] == -1 and position_data[1] == -1
                     and position_data[2] == -1)
Example #2
0
 def test__empty_ant(self):
     config = DictionaryConfigProvider()
     config.SetValue('InitialPosition', 'InitialDirection', 0)
     config.SetValue('InitialPosition', 'InitialPosition_x', 1)
     config.SetValue('InitialPosition', 'InitialPosition_y', 1)
     processor = AntStepProcesser(config)
     position_data = processor.get_ant_position_and_direction(99)
     self.assertTrue(position_data[0] == -1 and position_data[1] == -1
                     and position_data[2] == -1)
Example #3
0
 def test__from_north_step_back(self):
     config = DictionaryConfigProvider()
     config.SetValue('InitialPosition', 'InitialDirection', 0)
     config.SetValue('InitialPosition', 'InitialPosition_x', 1)
     config.SetValue('InitialPosition', 'InitialPosition_y', 1)
     processor = AntStepProcesser(config)
     processor.process_ant_step(99, StepEnum.Back)
     position_data = processor.get_ant_position_and_direction(99)
     self.assertTrue(position_data[1] == 2)
Example #4
0
 def test__initial_step_turn(self):
     config = DictionaryConfigProvider()
     config.SetValue('InitialPosition', 'InitialDirection', 0)
     config.SetValue('InitialPosition', 'InitialPosition_x', 1)
     config.SetValue('InitialPosition', 'InitialPosition_y', 1)
     processor = AntStepProcesser(config)
     processor.process_ant_step(99, StepEnum.TurnRight)
     position_data = processor.get_ant_position_and_direction(99)
     self.assertTrue(position_data[2] == DirectionsEnum.East)
Example #5
0
 def test__from_east_step_forward(self):
     config = DictionaryConfigProvider()
     config.SetValue('InitialPosition', 'InitialDirection', 0)
     config.SetValue('InitialPosition', 'InitialPosition_x', 1)
     config.SetValue('InitialPosition', 'InitialPosition_y', 1)
     processor = AntStepProcesser(config)
     processor.process_ant_step(99, StepEnum.TurnRight)
     processor.process_ant_step(99, StepEnum.Forward)
     position_data = processor.get_ant_position_and_direction(99)
     self.assertTrue(position_data[0] == 2)
Example #6
0
 def test__complex_set_1(self):
     config = DictionaryConfigProvider()
     config.SetValue('InitialPosition', 'InitialDirection', 0)
     config.SetValue('InitialPosition', 'InitialPosition_x', 1)
     config.SetValue('InitialPosition', 'InitialPosition_y', 1)
     processor = AntStepProcesser(config)
     processor.process_ant_step(99, StepEnum.Back)
     processor.process_ant_step(99, StepEnum.Back)
     processor.process_ant_step(99, StepEnum.TurnRight)
     processor.process_ant_step(99, StepEnum.Forward)
     position_data = processor.get_ant_position_and_direction(99)
     self.assertTrue(position_data[0] == 2)
     self.assertTrue(position_data[1] == 3)
     self.assertTrue(position_data[2] == DirectionsEnum.East)