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')
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')
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')
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')
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')
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')