loki.tests.test_subroutine

Functions

fixture_header_path(here)

fixture_here()

test_call_args_kwargs(frontend)

test_call_args_kwargs_conversion(frontend)

test_call_kwargs(frontend)

test_call_no_arg(frontend)

test_convert_endian(tmp_path, frontend)

test_empty_spec(frontend)

test_enrich_derived_types(tmp_path, frontend)

test_enrich_explicit_interface(frontend)

Test enrich points to the actual routine and not the symbol declared in an explicit interface.

test_external_stmt(tmp_path, frontend)

Tests procedures passed as dummy arguments and declared as EXTERNAL.

test_function_array_return_type(frontend, ...)

Verify array return types are correctly represented with all frontends

test_member_procedures(tmp_path, frontend)

Test member subroutine and function

test_member_routine_clone(frontend)

Test that member subroutine scopes get cloned correctly.

test_member_routine_clone_inplace(frontend)

Test that member subroutine scopes get cloned correctly.

test_mixed_declaration_interface(frontend)

A simple test to catch and shame mixed declarations.

test_open_newunit(tmp_path, frontend)

test_resolve_typebound_var(frontend, tmp_path)

Test correct behaviour of Scope.resolve_typebound_var utility

test_resolve_typebound_var_missing_definition(...)

Test correct behaviour of Scope.resolve_typebound_var utility in the absence of type information

test_routine_arguments(frontend)

A set of test to test internalisation and handling of arguments.

test_routine_arguments_add_remove(frontend)

Test addition and removal of subroutine arguments.

test_routine_bind(frontend, tmp_path)

Test matching of 'bind" suffix for subroutines in interfaces

test_routine_call_arrays(header_path, ...)

Test that arrays passed down a subroutine call are treated as arrays.

test_routine_prefix(frontend)

Test matching of prefix attributes for subroutines

test_routine_simple(frontend)

A simple standard looking routine to test argument declarations.

test_routine_type_propagation(header_path, ...)

Test for the forward propagation of derived-type information from a standalone module to a foreign subroutine via the :param typedef: argument.

test_routine_variable_caching(frontend)

Test that equivalent names in distinct routines don't cache.

test_routine_variables_add_remove(frontend)

Test local variable addition and removal.

test_routine_variables_dim_shapes(frontend)

A set of test to ensure matching different dimension and shape expressions against strings and other expressions works as expected.

test_routine_variables_dimension_pragmas(...)

Test that !$loki dimension pragmas can be used to verride the conceptual .shape of local and argument variables.

test_routine_variables_find(frontend)

Tests the FindVariables utility (not the best place to put this).

test_routine_variables_shape_propagation(...)

Test for the correct identification and forward propagation of variable shapes from the subroutine declaration.

test_subroutine_clone_contained(frontend)

test_subroutine_comparison(frontend)

Test that string-equivalence works on relevant components.

test_subroutine_comparison_case_sensitive(...)

Test that semantic, but no string-equivalence evaluates as not eqal

test_subroutine_deep_clone(frontend, tmp_path)

Test that deep-cloning a subroutine actually ensures clean scope separation.

test_subroutine_imported_symbols(tmp_path, ...)

Test return of imported symbols

test_subroutine_interface(tmp_path, ...)

Test auto-generation of an interface block for a given subroutine.

test_subroutine_lazy_arguments_incomplete1(...)

Test that argument lists for subroutines are correctly captured when the object is made complete.

test_subroutine_lazy_arguments_incomplete2(...)

Test that argument lists for subroutines are correctly captured when the object is made complete.

test_subroutine_rescope_clone(tmp_path, frontend)

Test the rescoping of variables in clone.

test_subroutine_rescope_symbols(tmp_path, ...)

Test the rescoping of variables.

test_subroutine_stmt_func(tmp_path, frontend)

Test the correct identification of statement functions

fixture_here()
fixture_header_path(here)
test_routine_simple(frontend)

A simple standard looking routine to test argument declarations.

test_routine_prefix(frontend)

Test matching of prefix attributes for subroutines

test_routine_bind(frontend, tmp_path)

Test matching of ‘bind” suffix for subroutines in interfaces

test_routine_arguments(frontend)

A set of test to test internalisation and handling of arguments.

test_routine_arguments_add_remove(frontend)

Test addition and removal of subroutine arguments.

test_routine_variable_caching(frontend)

Test that equivalent names in distinct routines don’t cache.

test_routine_variables_add_remove(frontend)

Test local variable addition and removal.

test_routine_variables_find(frontend)

Tests the FindVariables utility (not the best place to put this).

test_routine_variables_dim_shapes(frontend)

A set of test to ensure matching different dimension and shape expressions against strings and other expressions works as expected.

test_routine_variables_shape_propagation(tmp_path, header_path, frontend)

Test for the correct identification and forward propagation of variable shapes from the subroutine declaration.

test_routine_variables_dimension_pragmas(frontend)

Test that !$loki dimension pragmas can be used to verride the conceptual .shape of local and argument variables.

test_routine_type_propagation(header_path, frontend, tmp_path)

Test for the forward propagation of derived-type information from a standalone module to a foreign subroutine via the :param typedef: argument.

test_routine_call_arrays(header_path, frontend, tmp_path)

Test that arrays passed down a subroutine call are treated as arrays.

test_call_no_arg(frontend)
test_call_kwargs(frontend)
test_call_args_kwargs(frontend)
test_convert_endian(tmp_path, frontend)
test_open_newunit(tmp_path, frontend)
test_empty_spec(frontend)
test_member_procedures(tmp_path, frontend)

Test member subroutine and function

test_member_routine_clone(frontend)

Test that member subroutine scopes get cloned correctly.

test_member_routine_clone_inplace(frontend)

Test that member subroutine scopes get cloned correctly.

test_external_stmt(tmp_path, frontend)

Tests procedures passed as dummy arguments and declared as EXTERNAL.

test_subroutine_interface(tmp_path, frontend, header_path)

Test auto-generation of an interface block for a given subroutine.

test_subroutine_rescope_symbols(tmp_path, frontend)

Test the rescoping of variables.

test_subroutine_rescope_clone(tmp_path, frontend)

Test the rescoping of variables in clone.

test_subroutine_stmt_func(tmp_path, frontend)

Test the correct identification of statement functions

test_mixed_declaration_interface(frontend)

A simple test to catch and shame mixed declarations.

test_subroutine_comparison(frontend)

Test that string-equivalence works on relevant components.

test_subroutine_comparison_case_sensitive(frontend)

Test that semantic, but no string-equivalence evaluates as not eqal

test_subroutine_lazy_arguments_incomplete1(frontend)

Test that argument lists for subroutines are correctly captured when the object is made complete.

The rationale for this test is that for dummy argument lists with interleaved comments and line breaks, matching is non-trivial and, since we don’t currently need the argument list in the incomplete REGEX-parsed IR, we accept that this information is incomplete initially. tmp_path, we make sure this information is captured correctly after completing the full frontend parse.

test_subroutine_lazy_arguments_incomplete2(frontend)

Test that argument lists for subroutines are correctly captured when the object is made complete.

The rationale for this test is that for dummy argument lists with interleaved comments and line breaks, matching is non-trivial and, since we don’t currently need the argument list in the incomplete REGEX-parsed IR, we accept that this information is not available initially. tmp_path, we make sure this information is captured correctly after completing the full frontend parse.

test_subroutine_clone_contained(frontend)
test_enrich_explicit_interface(frontend)

Test enrich points to the actual routine and not the symbol declared in an explicit interface.

test_enrich_derived_types(tmp_path, frontend)
test_subroutine_deep_clone(frontend, tmp_path)

Test that deep-cloning a subroutine actually ensures clean scope separation.

test_call_args_kwargs_conversion(frontend)
test_resolve_typebound_var(frontend, tmp_path)

Test correct behaviour of Scope.resolve_typebound_var utility

test_resolve_typebound_var_missing_definition(frontend, tmp_path)

Test correct behaviour of Scope.resolve_typebound_var utility in the absence of type information

test_function_array_return_type(frontend, dim_decl)

Verify array return types are correctly represented with all frontends

test_subroutine_imported_symbols(tmp_path, frontend, ext2_import)

Test return of imported symbols