|
1 | 1 | import pytest, io, sys, json, mock, re, os |
2 | 2 |
|
3 | | - |
4 | 3 | @pytest.mark.it('The function compute_robot_distance must exist') |
5 | 4 | def test_function_existence(capsys, app): |
6 | 5 | assert app.compute_robot_distance |
7 | 6 |
|
8 | 7 | @pytest.mark.it('The function should return the expected output') |
9 | 8 | def test_expected_output(capsys, app): |
10 | | - assert app.compute_robot_distance("UP 5 DOWN 3 LEFT 3 RIGHT 2") == 2 |
| 9 | + movements_list = ["UP 5", "DOWN 3", "LEFT 3", "RIGHT 2"] |
| 10 | + assert app.compute_robot_distance(movements_list) == 2 |
11 | 11 |
|
12 | 12 | @pytest.mark.it('The solution should work with other entries') |
13 | 13 | def test_another_output(capsys, app): |
14 | | - assert app.compute_robot_distance("DOWN 20 UP 5 LEFT 5 RIGHT 2") == 15 |
| 14 | + movements_list = ["DOWN 20", "UP 5", "LEFT 5", "RIGHT 2"] |
| 15 | + assert app.compute_robot_distance(movements_list) == 15 |
15 | 16 |
|
16 | | -@pytest.mark.it('The solution should work with other entries') |
| 17 | +@pytest.mark.it('The solution should work with negative inputs') |
17 | 18 | def test_negative_inputs(capsys, app): |
18 | | - assert app.compute_robot_distance("DOWN -1 UP -5 LEFT 50 RIGHT 20") == 30 |
| 19 | + movements_list = ["DOWN -1", "UP -5", "LEFT 50", "RIGHT 20"] |
| 20 | + assert app.compute_robot_distance(movements_list) == 30 |
0 commit comments