def ll_five(): empty_list = LinkedList() empty_list.insert(9) empty_list.insert('a') empty_list.insert(8) empty_list.insert('c') empty_list.insert(True) return empty_list
def test_ll_merge_one_string_and_intiger(): linked_list_one = LinkedList() values_one = [1, 2, 3, 5, 7, 9] for el in values_one: linked_list_one.insert(el) linked_list_two = LinkedList() values_two = [4, 6, 'f'] for el in values_two: linked_list_two.insert(el) actual = merge_lists(linked_list_two, linked_list_one) assert 'f - 9 - 6 - 7 - 4 - 5 - 3 - 2 - 1 - None' == str(actual)
def test_ll_merge_one_first_one_short_list(): linked_list_one = LinkedList() values_one = [1, 2, 3, 5, 7, 9] for el in values_one: linked_list_one.insert(el) linked_list_two = LinkedList() values_two = [4, 6, 8] for el in values_two: linked_list_two.insert(el) actual = merge_lists(linked_list_two, linked_list_one) assert '8 - 9 - 6 - 7 - 4 - 5 - 3 - 2 - 1 - None' == str(actual)
def test_merge_list_1_short(): letters = LinkedList() numbers = LinkedList() letters.insert('A') numbers.insert(2) numbers.insert(3) actual = letters.merge(numbers) assert 'A' == actual.value assert 2 == actual._next.value
def test_ll_merge_first_one_empty(): linked_list_one = LinkedList() values_one = [] for el in values_one: linked_list_one.insert(el) linked_list_two = LinkedList() values_two = [4, 6, 8] for el in values_two: linked_list_two.insert(el) actual = merge_lists(linked_list_one, linked_list_two) assert 'None' == str(actual)
def test_ll_merge_second_one_empty(): linked_list_one = LinkedList() values_one = [1, 2, 3, 5, 7, 9] for el in values_one: linked_list_one.insert(el) linked_list_two = LinkedList() values_two = [] for el in values_two: linked_list_two.insert(el) actual = merge_lists(linked_list_one, linked_list_two) assert '9 - 7 - 5 - 3 - 2 - 1 - None' == str(actual)
def test_ll_merge_first_one_long_list(): linked_list_one = LinkedList() values_one = [1, 2, 3, 5, 7, 9] for el in values_one: linked_list_one.insert(el) linked_list_two = LinkedList() values_two = [4, 6, 8] for el in values_two: linked_list_two.insert(el) actual = merge_lists(linked_list_one, linked_list_two) assert '9 - 8 - 7 - 6 - 5 - 4 - 3 - 2 - 1 - None' == str(actual)
def test_merge(): letters = LinkedList() numbers = LinkedList() letters.insert('A') letters.insert('B') letters.insert('C') numbers.insert(1) numbers.insert(2) numbers.insert(3) actual = letters.merge(numbers) expected = 'A' assert expected == actual.value
def test_merge_one(ll_one): empty_list = LinkedList() empty_list.insert('b') new_ll = merge_list(ll_one, empty_list) assert new_ll.get_length() == 'a -> b -> '
def ll_six(): empty_list = LinkedList() empty_list.insert(9) empty_list.insert('h') empty_list.insert(8) empty_list.insert('p') empty_list.insert(False) empty_list.insert(6) return empty_list
def ll_eight(): empty_list = LinkedList() empty_list.insert(4) empty_list.insert('z') empty_list.insert(2) empty_list.insert('c') empty_list.insert(True) empty_list.insert('w') empty_list.insert(7) empty_list.insert(1) return empty_list
def ll_one(): empty_list = LinkedList() empty_list.insert('a') return empty_list
def ll_three(): empty_list = LinkedList() empty_list.insert(2) empty_list.insert('a') empty_list.insert(3) return empty_list