def linked_list_test_40(): s = "Pruebo hacer 8 inserts uno detras del otro e inserto en la segunda posicion" value_1 = "Boomer" value_2 = "Ok" try: test_list = LinkedList() many_insert(test_list, value_2, 8) test_list.insert(1, value_1) correct_list = [] for i in range(0, 9): if i == 1: correct_list.append(value_1) else: correct_list.append(value_2) def custom_test(): if check_list_is_correct(test_list.prim, value_2, correct_list): return "" return errors["assert"] def custom_test2(): if check_list_integrity(test_list, 9): return "" return errors["integrity"] test.print_test(s, test_runner(custom_test(), custom_test2())) except Exception as err: error_by_except(s, err)
def linked_list_test_10(): s = "Pruebo insertar un elemento fuera de rango" try: test_list = LinkedList() error_was_thrown = False try: test_list.insert(2, "BLAZE IT") except IndexError as err: error_was_thrown = True test.print_test(s, error_was_thrown) except Exception as err: error_by_except(s, err)
def linked_list_test_3(): s = "Pruebo insertar elemento" value = "Hola" try: test_list = LinkedList() test_list.insert(0, value) integrity = check_list_integrity(test_list, 1) def custom_test(): if not integrity: return errors["integrity"] return "" def custom_test2(): if test_list.prim.v == value and test_list.prim.next is None: return "" return errors["assert"] test.print_test(s, test_runner(custom_test2(), custom_test())) except Exception as err: error_by_except(s, err)
def linked_list_test_4(): s = "Pruebo insertar 2 elementos uno detras del otro" value = "bokita el mas grande" try: test_list = LinkedList() test_list.insert(0, 2) test_list.insert(1, value) def custom_test(): if check_list_is_correct(test_list.prim, 2, [2, value]): return "" return errors["assert"] def custom_test2(): if check_list_integrity(test_list, 2): return "" return errors["integrity"] test.print_test(s, test_runner(custom_test(), custom_test2())) except Exception as err: error_by_except(s, err)