<commit_before>require "robot"

describe Robot do
  describe "place" do
    it "places the robot on the table" do
      table = Table.new(5,5)
      robot = Robot.new(table)
      position = Position.new(2,3)
      orientation = Orientation::NORTH
      placement = Placement.new(table, position, orientation)
      robot.place(placement)

      expect(robot.placement.position).to eq(Position.new(2,3))
      expect(robot.placement.orientation).to eq(Orientation::NORTH)
    end
  end

  describe "move" do
    it "moves the robot's position" do
      table = Table.new(5,5)
      robot = Robot.new(table)
      position = Position.new(2,3)
      orientation = Orientation::NORTH
      placement = Placement.new(table, position, orientation)
      robot.place(placement)
      robot.move 

      expect(robot.placement.position).to eq(Position.new(2,4))
      expect(robot.placement.orientation).to eq(Orientation::NORTH)
    end

    context "when the next position is invalid" do
      it "does not change the robots position" do
        table = Table.new(5,5)
        robot = Robot.new(table)
        position = Position.new(4,4)
        orientation = Orientation::NORTH
        placement = Placement.new(table, position, orientation)
        robot.place(placement)
        robot.move

        expect(robot.placement.position).to eq(Position.new(4,4))
        expect(robot.placement.orientation).to eq(Orientation::NORTH)
      end
    end
  end
end<commit_msg>Added the updated robot left and right unit test<commit_after>require "robot"

describe Robot do
  describe "place" do
    it "places the robot on the table" do
      table = Table.new(5,5)
      robot = Robot.new(table)
      position = Position.new(2,3)
      orientation = Orientation::NORTH
      placement = Placement.new(table, position, orientation)
      robot.place(placement)

      expect(robot.placement.position).to eq(Position.new(2,3))
      expect(robot.placement.orientation).to eq(Orientation::NORTH)
    end
  end

  describe "move" do
    it "moves the robot's position" do
      table = Table.new(5,5)
      robot = Robot.new(table)
      position = Position.new(2,3)
      orientation = Orientation::NORTH
      placement = Placement.new(table, position, orientation)
      robot.place(placement)
      robot.move 

      expect(robot.placement.position).to eq(Position.new(2,4))
      expect(robot.placement.orientation).to eq(Orientation::NORTH)
    end

    context "when the next position is invalid" do
      it "does not change the robots position" do
        table = Table.new(5,5)
        robot = Robot.new(table)
        position = Position.new(4,4)
        orientation = Orientation::NORTH
        placement = Placement.new(table, position, orientation)
        robot.place(placement)
        robot.move

        expect(robot.placement.position).to eq(Position.new(4,4))
        expect(robot.placement.orientation).to eq(Orientation::NORTH)
      end
    end
  end

  describe "left" do
    it "rotates the robot 90 degrees to the left" do
      table = Table.new(5, 5)
      robot = Robot.new(table)
      position = Position.new(1,1)
      orientation = Orientation::NORTH
      placement = Placement.new(table, position, orientation)
      robot.place(placement)

      robot.left

      expect(robot.placement.position).to eq(Position.new(1,1))
      expect(robot.placement.orientation).to eq(Orientation::WEST)
    end
  end

  describe "right" do
    it "rotates the robot 90 degrees to the right" do
      table = Table.new(5, 5)
      robot = Robot.new(table)
      position = Position.new(1,1)
      orientation = Orientation::NORTH
      placement = Placement.new(table, position, orientation)
      robot.place(placement)

      robot.right

      expect(robot.placement.position).to eq(Position.new(1,1))
      expect(robot.placement.orientation).to eq(Orientation::EAST)
    end
  end
end
{'fraction_non_alphanumeric': 0.10723447922011288, 'fraction_numerical': 0.013340174448435094, 'mean_word_length': 2.871896722939424, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5358777', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1182, 'n_words': 277}