def length_operation_working(): """Проверка работы операции нахождения длины объекта""" real_string_segment_size = minimal_data_length["string_segment"] minimal_data_length["string_segment"] = 4 real_list_segment_size = minimal_data_length["list_segment"] minimal_data_length["list_segment"] = 4 setting.initialisation("program.yovc") str_num = add.string_segment() put.string_segment(str_num, "char_list", "Эта строка не влезет в маленький сегмент") list_num = add.list_segment() put.list_segment(list_num, "link_list", [i for i in range(40)]) view.tape() print(get.string_segment(str_num)) view.string_segment(str_num) print(get.list_segment(list_num)) view.list_segment(list_num) objects.Length(["link", str_num]) kind, length_link = pull.memory_stack() draw.entity_link(length_link) objects.Length(["link", list_num]) kind, length_link = pull.memory_stack() draw.entity_link(length_link) string_num = make.string_segment("a") objects.Find(["link", string_num]) name_num = pull.memory_stack() objects.Equate(name_num, ["link", list_num]) objects.Length(name_num) kind, length_link = pull.memory_stack() draw.entity_link(length_link) minimal_data_length["string_segment"] = real_string_segment_size minimal_data_length["list_segment"] = real_list_segment_size
def subobject_operation_working(): """Проверка работы операции нахождения элемента по индексу""" real_string_segment_size = minimal_data_length["string_segment"] minimal_data_length["string_segment"] = 4 real_list_segment_size = minimal_data_length["list_segment"] minimal_data_length["list_segment"] = 4 setting.initialisation("program.yovc") str_num = add.string_segment() put.string_segment(str_num, "char_list", "Эта строка не влезет в маленький сегмент") list_num = add.list_segment() put.list_segment(list_num, "link_list", [i for i in range(40)]) view.tape() print(get.string_segment(str_num)) view.string_segment(str_num) print(get.list_segment(list_num)) view.list_segment(list_num) index = append.data_segment("number", 25) objects.Sub_object(["link", str_num], ["link", index]) kind, element_link = pull.memory_stack() display.entity(element_link) objects.Sub_object(["link", list_num], ["link", index]) kind, element_link = pull.memory_stack() display.entity(element_link) minimal_data_length["string_segment"] = real_string_segment_size minimal_data_length["list_segment"] = real_list_segment_size
def data_segment_writing(): """Проверка на запись сегмента данных""" add.system_area() add.memory_stack() add.call_stack() add.data_segment() view.tape()
def console_operations_working(): """Проверка работы оперций ввода и вывода""" setting.initialisation("program.yovc") console.Input() link_type, link_value = pull.memory_stack() console.Output(["link", link_value]) view.tape()
def list_and_string_segments_making(): """Проверка на создание сегментов строки и списка с данными""" setting.initialisation("program.yovc") str_num = make.string_segment("Эта строка должна влезть") list_num = make.list_segment([i for i in range(40)]) view.tape() view.string_segment(str_num) view.list_segment(list_num)
def segment_extending(): """Проверка на расширение сегментов""" segment_nums = setting.initialisation("program.yovc") list_num = add.list_segment() namespace_num = find.attribute(seg_links["system"], "target_namespace") data_num = find.attribute(seg_links["system"], "first_data_segment") extend.data_segment(data_num) extend.namespace(namespace_num) extend.list_segment(list_num) view.tape()
def list_segment_putting(): """Проверка на заполнение сегмента списка""" real_list_segment_size = minimal_data_length["list_segment"] minimal_data_length["list_segment"] = 4 setting.initialisation("program.yovc") num = add.list_segment() put.list_segment(num, "link_list", [i for i in range(40)]) view.tape() print(get.list_segment(num)) view.list_segment(num) minimal_data_length["list_segment"] = real_list_segment_size
def program_writing(): """Проверка на запись программы""" add.system_area() add.memory_stack() add.call_stack() add.data_segment() add.program("program.yovc") view.tape() program = find.attribute(seg_links["system"], "main_program") show.attribute(seg_links["system"], "target_cell") show.program_code(program)
def namespace_putting(): """Проверка на заполнение пространства имён""" real_namespace_size = minimal_data_length["namespace"] minimal_data_length["namespace"] = 4 setting.initialisation("program.yovc") prog_num = find.attribute(seg_links["system"], "main_program") num = add.namespace(prog_num) put.namespace(num, "link_list", [i for i in range(40)]) view.tape() print(get.namespace(num)) view.namespace(num) minimal_data_length["namespace"] = real_namespace_size
def string_segment_putting(): """Проверка на заполнение сегмента строки""" real_string_segment_size = minimal_data_length["string_segment"] minimal_data_length["string_segment"] = 4 setting.initialisation("program.yovc") num = add.string_segment() put.string_segment(num, "char_list", "Эта строка не влезет в маленький сегмент") view.tape() print(get.string_segment(num)) view.string_segment(num) minimal_data_length["string_segment"] = real_string_segment_size
def data_segment_putting(): """Проверка на заполнение сегмента данных""" real_data_segment_size = minimal_data_length["data_segment"] minimal_data_length["data_segment"] = 4 setting.initialisation("program.yovc") num = find.attribute(seg_links["system"], "first_data_segment") put.data_segment(num, "chars", "Эта строка не влезет в маленький сегмент") put.data_segment(num, "dictionary_item", [15, 20, 25]) put.data_segment(num, "number", 255) view.tape() view.data_segment() minimal_data_length["data_segment"] = real_data_segment_size
def create_operation_working(): """Проверка работы команды создания""" setting.initialisation("program.yovc") objects.Create(["none", 0]) draw.memory_stack_link() objects.Create(["logic", True]) draw.memory_stack_link() objects.Create(["number", 365]) draw.memory_stack_link() objects.Create(["chars", "super_string"]) draw.memory_stack_link() objects.Create(["array", [1, 2, 3, 4, 5]]) draw.memory_stack_link() view.tape()
def find_operation_working(): """Проверка работы команды поиска""" real_namespace_size = minimal_data_length["namespace"] minimal_data_length["namespace"] = 2 setting.initialisation("program.yovc") prog_num = find.attribute(seg_links["system"], "main_program") name_num = find.attribute(prog_num, "namespace") view.namespace_items(name_num) str_num = make.string_segment("J") objects.Find(["link", str_num]) value_link = pull.memory_stack() draw.link_on_link(value_link) view.namespace_items(name_num) item.write_namespace_name(name_num, ["string_segment", "Yo"], value=["number", 1]) str_num = make.string_segment("Yo") view.tape() view.data_segment() objects.Find(["link", str_num]) view.namespace_items(name_num) value_link = pull.memory_stack() draw.link_on_link(value_link) minimal_data_length["namespace"] = real_namespace_size
def list_segment_writing(): """Проверка на запись сегмента списка""" setting.initialisation("program.yovc") add.list_segment() view.tape()
def stack_writing(): """Проверка на запись стеков""" add.system_area() add.memory_stack() add.call_stack() view.tape()