Skip to content

Commit

Permalink
Modify bubble_sort tests to be generic for all sorting algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
Parker Johansen committed Mar 19, 2019
1 parent 5f97393 commit b0ffc56
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions test/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,20 @@ def baklava(request):
return request.param


@pytest.fixture(params=sources['bubble-sort'],
ids=['bubble-sort' + source.extension for source in sources['bubble-sort']])
def bubble(request):
@pytest.fixture(params=sources['bubble-sort'] +
sources['insertion-sort'] +
sources['merge-sort'] +
sources['quick-sort'] +
sources['selection-sort'],
ids=[source.name + source.extension
for source in (
sources['bubble-sort'] +
sources['insertion-sort'] +
sources['merge-sort'] +
sources['quick-sort'] +
sources['selection-sort']
)])
def sort_source(request):
return request.param


Expand Down Expand Up @@ -94,6 +105,6 @@ def test_baklava(docker_client, baklava):


@pytest.mark.parametrize(sorting_permutations[0], sorting_permutations[1], ids=[p[0] for p in sorting_permutations[1]])
def test_bubble_sort(description, in_params, expected, docker_client, bubble):
actual = bubble.run(docker_client, params=in_params)
def test_sort(description, in_params, expected, docker_client, sort_source):
actual = sort_source.run(docker_client, params=in_params)
assert actual.replace('[', '').replace(']', '').strip() == expected

0 comments on commit b0ffc56

Please sign in to comment.