def test_can_overwrite_value_in_if(value1, value2):
    text = f"""
    a = {value1};
    if (1 == 1) {{
        a = {value2};
    }}
    """
    assert typechecker_passes(text)
def test_outer_loop_variable_as_inner_loop_range():
    text = """
    for i = 1:10 {
        for j = i:10 {
            print(i, j);
        }
    }
    """
    assert typechecker_passes(text)
def test_unary_expression_pass(text):
    assert typechecker_passes(text)
def test_matrix_functions_args_pass(text):
    assert typechecker_passes(text)
Exemple #5
0
def test_break_continue_inside_loop(text):
    assert typechecker_passes(text)
def test_matrix_initializer_shape_pass(text):
    assert typechecker_passes(text)
def test_can_modify_value_with_same_type(initial_value, modifier):
    text = f"""
    a = {initial_value};
    a += {modifier};
    """
    assert typechecker_passes(text)
def test_can_overwrite_with_same_type_and_value(value):
    text = f"""
    a = {value};
    a = {value};
    """
    assert typechecker_passes(text)
def test_can_overwrite_with_same_type_but_different_value(value1, value2):
    text = f"""
    a = {value1};
    a = {value2};
    """
    assert typechecker_passes(text)
def test_reference_indices_count_passes(text):
    typechecker_passes(text)