Beispiel #1
0
    def test_robot_call_unknown(self):
        subject = Robot()
        subject.call('UNKNOWN')

        self.assertEqual(subject.x, 0)
        self.assertEqual(subject.y, 0)
        self.assertEqual(subject.facing, 'NORTH')
Beispiel #2
0
    def test_robot_call_move(self):
        subject = Robot()
        subject.call('MOVE')

        self.assertEqual(subject.x, 0)
        self.assertEqual(subject.y, 1)
        self.assertEqual(subject.facing, 'NORTH')
Beispiel #3
0
    def test_robot_call_right(self):
        subject = Robot()
        subject.call('RIGHT')

        self.assertEqual(subject.x, 0)
        self.assertEqual(subject.y, 0)
        self.assertEqual(subject.facing, 'EAST')
Beispiel #4
0
    def test_robot_call_left(self):
        subject = Robot()
        subject.call('LEFT')

        self.assertEqual(subject.x, 0)
        self.assertEqual(subject.y, 0)
        self.assertEqual(subject.facing, 'WEST')
Beispiel #5
0
    def test_robot_call_place(self):
        subject = Robot()
        subject.call('PLACE', '4,2,EAST')

        self.assertEqual(subject.x, 4)
        self.assertEqual(subject.y, 2)
        self.assertEqual(subject.facing, 'EAST')
Beispiel #6
0
 def test_robot_call_report(self):
     subject = Robot()
     with OutputBuffer() as bf:
         self.assertIsNone(subject.call('REPORT'))
     self.assertEqual(bf.out, '0, 0, NORTH\n')