def test_cannot_assign_to_loop_variable(): text = """ for i = 1:10 { i = 2; } """ assert typechecker_fails(text)
def test_cannot_modify_loop_variable(): text = """ for i = 1:10 { i += 2; } """ assert typechecker_fails(text)
def test_variable_matrix_different_shape(): text = ''' x = eye(5); y = eye(8); z = x .+ y; ''' assert typechecker_fails(text)
def test_loop_variable_available_only_inside_loop(): text = """ for i = 1:10 { print(i); } print(i); """ assert typechecker_fails(text)
def test_loop_variable_cannot_overwrite(): text = """ i = 42; for i = 1:10 { print(i); } """ assert typechecker_fails(text)
def test_two_loops_same_variable(): text = """ for i = 1:10 { for i = 1:10 { print(i); } } """ assert typechecker_fails(text)
def test_variable_value(text): assert typechecker_fails(text)
def test_matrix_function_args_negative(text): assert typechecker_fails(text)
def test_unary_expression_fail(text): assert typechecker_fails(text)
def test_break_continue_outside_loop(text): assert typechecker_fails(text)
def test_matrix_functions_args_fail(text): assert typechecker_fails(text)
def test_matrix_initializer_shape_fail(text): assert typechecker_fails(text)
def test_cannot_overwrite_in_dead_code(text): assert typechecker_fails(text)
def test_cannot_overwrite_with_other_type(value1, value2): text = f""" a = {value1}; a = {value2}; """ assert typechecker_fails(text)
def test_cannot_modify_value_with_other_type(initial_value, modifier): text = f""" a = {initial_value}; a += {modifier}; """ assert typechecker_fails(text)
def test_reference_indices_count_fails(text): typechecker_fails(text)