def test_one_report(self):
        program = 'REPORT\n'

        expected_output = 'not in place\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
    def test_exit(self):
        program = 'EXIT\n'

        expected_output = ''

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
    def test_2(self):
        program = 'PLACE 1,2,NORTH\n' \
                  'REPORT\n'

        expected_output = '1,2,NORTH\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
Esempio n. 4
0
    def test_left_not_in_place(self):
        program = 'LEFT\n' \
                  'REPORT\n'

        expected_output = 'not in place\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
Esempio n. 5
0
    def test_one_place_with_inner_spaces(self):
        program = '    PLACE    1,   1,    NORTH    \n' \
                  '  REPORT \n'

        expected_output = '1,1,NORTH\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
Esempio n. 6
0
    def test_one_place_outside_board_right(self):
        program = 'PLACE 5,1,NORTH\n' \
                  'REPORT\n'

        expected_output = 'not in place\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
    def test_3(self):
        program = 'PLACE 9,9,NORTH\n' \
                  'REPORT\n'

        expected_output = 'not in place\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
Esempio n. 8
0
    def test_example_b(self):
        program = 'PLACE 0,0,NORTH\n' \
                  'LEFT\n' \
                  'REPORT\n'

        expected_output = '0,0,WEST\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
Esempio n. 9
0
    def test_move_north_out_of_board(self):
        program = 'PLACE 4,4,NORTH\n' \
                  'MOVE\n' \
                  'REPORT\n'

        expected_output = '4,4,NORTH\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
Esempio n. 10
0
    def test_move_west_success(self):
        program = 'PLACE 1,2,WEST\n' \
                  'MOVE\n' \
                  'REPORT\n'

        expected_output = '0,2,WEST\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
Esempio n. 11
0
    def test_move_west_out_of_board(self):
        program = 'PLACE 0,0,WEST\n' \
                  'MOVE\n' \
                  'REPORT\n'

        expected_output = '0,0,WEST\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
    def test_1(self):
        program = 'MOVE\n' \
                  'LEFT\n' \
                  'RIGHT\n' \
                  'REPORT\n'

        expected_output = 'not in place\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
    def test_8(self):
        program = 'AUTODESTRUCT\n' \
                  'TAKEOFF\n' \
                  'KILL\n' \
                  'REPORT\n'

        expected_output = 'not in place\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
    def test_ignores_commands_before_report(self):
        program = 'MOVE\n' \
                  'LEFT\n' \
                  'RIGHT\n' \
                  'REPORT\n'

        expected_output = 'not in place\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
Esempio n. 15
0
    def test_one_place_onside_board_and_one_place_outside_board(self):
        program = 'PLACE 1,2,NORTH\n' \
                  'REPORT\n' \
                  'PLACE 7,7,SOUTH\n' \
                  'REPORT\n'

        expected_output = '1,2,NORTH\n' \
                          '1,2,NORTH\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
Esempio n. 16
0
    def test_two_place_different_place(self):
        program = 'PLACE 1,2,NORTH\n' \
                  'REPORT\n' \
                  'PLACE 3,4,SOUTH\n' \
                  'REPORT\n'

        expected_output = '1,2,NORTH\n' \
                          '3,4,SOUTH\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
Esempio n. 17
0
    def test_example_c(self):
        program = 'PLACE 1,2,EAST\n' \
                  'MOVE\n'\
                  'MOVE\n' \
                  'LEFT\n' \
                  'MOVE\n' \
                  'REPORT\n'

        expected_output = '3,3,NORTH\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
Esempio n. 18
0
    def test_right_success(self):
        program = 'PLACE 1,2,NORTH\n' \
                  'RIGHT\n' \
                  'REPORT\n' \
                  'RIGHT\n' \
                  'REPORT\n' \
                  'RIGHT\n' \
                  'REPORT\n' \
                  'RIGHT\n' \
                  'REPORT\n'

        expected_output = '1,2,EAST\n' \
                          '1,2,SOUTH\n' \
                          '1,2,WEST\n' \
                          '1,2,NORTH\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)
    def test_5(self):
        program = 'PLACE 1,1,NORTH\n' \
                  'LEFT\n' \
                  'REPORT\n'\
                  'LEFT\n' \
                  'REPORT\n' \
                  'LEFT\n' \
                  'REPORT\n' \
                  'LEFT\n' \
                  'REPORT\n'

        expected_output = '1,1,WEST\n' \
                          '1,1,SOUTH\n' \
                          '1,1,EAST\n' \
                          '1,1,NORTH\n'

        output = Util.run_interactive_app(program)
        self.assertEqual(expected_output, output)