Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
def Pop(arg):
    arg_type, arg_value = arg
    if arg_type == "none":
        link_type, link = pull.memory_stack()
    elif arg_type == "link":
        link_type, link_value = pull.memory_stack()
        write.entity(arg_value, "link", link_value)
    else:
        raise UndefinedArgument(f"Поведение команды Pop с аргументом типа"
                                f"{arg_type} не определено")
Esempio n. 4
0
def console_operations_working():
    """Проверка работы оперций ввода и вывода"""
    setting.initialisation("program.yovc")
    console.Input()
    link_type, link_value = pull.memory_stack()
    console.Output(["link", link_value])
    view.tape()
Esempio n. 5
0
def equate_operation_working():
    """Проверка работы команды приравнивания"""
    setting.initialisation("program.yovc")
    objects.Create(["chars", "Крутой язык"])
    str_num = make.string_segment("Ё")
    objects.Find(["link", str_num])
    name_num = pull.memory_stack()
    value_num = pull.memory_stack()
    objects.Equate(name_num, value_num)
    namespace_num = find.attribute(seg_links["system"], "target_namespace")
    view.namespace_items(namespace_num)
    console.Output(name_num)

    list_num = make.list_segment([0, 1, 2, 3, 4, 5])
    index_num = make.entity("number", 3)
    objects.Sub_object(["link", list_num], ["link", index_num])
    elem_num = pull.memory_stack()
    objects.Create(["array", [6, 7, 8]])
    value_num = pull.memory_stack()
    objects.Equate(elem_num, value_num)
    console.Output(elem_num)

    objects.Sub_object(["link", list_num], ["link", index_num])
    str_num = make.string_segment("array")
    objects.Find(["link", str_num])
    name_num = pull.memory_stack()
    elem_num = pull.memory_stack()
    objects.Equate(name_num, elem_num)
    view.namespace_items(namespace_num)
    console.Output(name_num)
Esempio n. 6
0
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
Esempio n. 7
0
def memory_stack_link():
    entity(pull.memory_stack()[1])
Esempio n. 8
0
def memory_stack_get():
    kind, stack_link = pull.memory_stack()
    kind, number = get_link(stack_link)
    return kind, number