diff --git a/functions/merge_sorted_lists.py b/functions/merge_sorted_lists.py index bdfb2ba..b3f47ac 100644 --- a/functions/merge_sorted_lists.py +++ b/functions/merge_sorted_lists.py @@ -1,2 +1,2 @@ def merge_sorted_lists(l1, l2): - pass + return sorted(l1+l2) diff --git a/tests/merge_sorted_lists_test.py b/tests/merge_sorted_lists_test.py index c0ad62f..2a016dc 100644 --- a/tests/merge_sorted_lists_test.py +++ b/tests/merge_sorted_lists_test.py @@ -1,2 +1,37 @@ import pytest from functions.merge_sorted_lists import merge_sorted_lists + +def test_for_1_and_2(): + # Arrange + l1 = [1] + l2 = [2] + + # Act + answer = merge_sorted_lists(l1, l2) + + # Assert + assert answer == [1, 2] + + +def test_for_2_and_1(): + # Arrange + l1 = [2] + l2 = [1] + + # Act + answer = merge_sorted_lists(l1, l2) + + # Assert + assert answer == [1, 2] + + +def test_for_1_2_3_and_4_5_6(): + # Arrange + l1 = [1, 2, 3] + l2 = [4, 5, 6] + + # Act + answer = merge_sorted_lists(l1, l2) + + # Assert + assert answer == [1, 2, 3, 4, 5, 6]