def test_linear_search(self): target = 12 data = [5, 6, 7, 8, 9, 10, 11, 12, 17, 21, 25, 27, 35, 37, 42, 45, 50] result = search_algorithms.linear_search(data, target) self.assertEqual(result, (7, True))
def test_linear_search_found_last_position(unordered_list): output = linear_search(unordered_list, 65) assert output == 11
def test_linear_search_found_mid_position(unordered_list): output = linear_search(unordered_list, 66) assert output == 6
def test_linear_search_not_found(unordered_list): output = linear_search(unordered_list, 875) assert output == 11