loki.transformations.transpile.tests.test_transpile

Functions

cpath(path, module_or_routine[, suffix])

Utility that generates the <name>_c.h path for Fortran wrappers

fixture_builder(tmp_path)

test_transpile_arguments(tmp_path, builder, ...)

A test the correct exchange of arguments with varying intents

test_transpile_associates(tmp_path, builder, ...)

Tests C-transpilation of associate statements

test_transpile_call(tmp_path, frontend, ...)

test_transpile_case_sensitivity(tmp_path, ...)

A simple test for testing lowering the case and case-sensitivity for specific symbols.

test_transpile_derived_type(tmp_path, ...)

Tests handling and type-conversion of various argument types

test_transpile_derived_type_array()

Tests handling of multi-dimensional arrays and pointers.

test_transpile_expressions(tmp_path, ...)

A simple test to verify expression parenthesis and resolution of minus sign

test_transpile_inline_elemental_functions(...)

Test correct inlining of elemental functions in C transpilation.

test_transpile_inline_elementals_recursive(...)

Test correct inlining of nested elemental functions.

test_transpile_inline_functions(tmp_path, ...)

Test correct transpilation of functions in C transpilation.

test_transpile_inline_functions_return(...)

Test correct transpilation of functions in C transpilation.

test_transpile_interface_to_module(tmp_path, ...)

test_transpile_intrinsics(tmp_path, builder, ...)

A simple test routine to test supported intrinsic functions

test_transpile_logical_statements(tmp_path, ...)

A simple test routine to test logical statements

test_transpile_loop_indices(tmp_path, ...)

Test to ensure loop indexing translates correctly

test_transpile_module_variables(tmp_path, ...)

Tests the use of imported module variables (via getter routines in C)

test_transpile_multibody_conditionals(...)

Test correct transformation of multi-body conditionals.

test_transpile_multiconditional(tmp_path, ...)

A test to verify multiconditionals/select case statements.

test_transpile_multiconditional_simple(...)

A simple test to verify multiconditionals/select case statements.

test_transpile_optional_args(tmp_path, ...)

A simple test to verify multiconditionals/select case statements.

test_transpile_routine_with_interface(...)

Test transpilation of 'INTERFACE's.

test_transpile_simple_loops(tmp_path, ...)

A simple test routine to test C transpilation of loops

test_transpile_simple_routine(tmp_path, ...)

Test correct transpilation of functions in C transpilation with a focus on code-gen options.

test_transpile_special_functions(tmp_path, ...)

A simple test to verify multiconditionals/select case statements.

test_transpile_unsupported_lang()

A simple test for testing failure/exception for unsupported language(s).

test_transpile_vectorization(tmp_path, ...)

Tests vector-notation conversion and local multi-dimensional arrays.

wrapperpath(path, module_or_routine)

Utility that generates the <name>_fc.F90 path for Fortran wrappers

wrapperpath(path, module_or_routine)

Utility that generates the <name>_fc.F90 path for Fortran wrappers

cpath(path, module_or_routine, suffix='.c')

Utility that generates the <name>_c.h path for Fortran wrappers

fixture_builder(tmp_path)
test_transpile_unsupported_lang()

A simple test for testing failure/exception for unsupported language(s).

test_transpile_case_sensitivity(tmp_path, frontend, case_sensitive, language)

A simple test for testing lowering the case and case-sensitivity for specific symbols.

test_transpile_simple_loops(tmp_path, builder, frontend, use_c_ptr)

A simple test routine to test C transpilation of loops

test_transpile_arguments(tmp_path, builder, frontend, use_c_ptr)

A test the correct exchange of arguments with varying intents

test_transpile_derived_type(tmp_path, builder, frontend, use_c_ptr)

Tests handling and type-conversion of various argument types

test_transpile_associates(tmp_path, builder, frontend, use_c_ptr)

Tests C-transpilation of associate statements

test_transpile_derived_type_array()

Tests handling of multi-dimensional arrays and pointers.

a_struct%scalar = 3. a_struct%vector(i) = a_struct%scalar + 2. a_struct%matrix(j,i) = a_struct%vector(i) + 1.

! subroutine transpile_derived_type_array(a_struct) ! use transpile_type, only: array_struct ! implicit none ! ! real(kind=real64) :: vector(:) ! ! real(kind=real64) :: matrix(:,:) ! type(array_struct), intent(inout) :: a_struct ! integer :: i, j

! a_struct%scalar = 3. ! do i=1, 3 ! a_struct%vector(i) = a_struct%scalar + 2. ! end do ! do i=1, 3 ! do j=1, 3 ! a_struct%matrix(j,i) = a_struct%vector(i) + 1. ! end do ! end do

! end subroutine transpile_derived_type_array

test_transpile_module_variables(tmp_path, builder, frontend, use_c_ptr)

Tests the use of imported module variables (via getter routines in C)

test_transpile_vectorization(tmp_path, builder, frontend, use_c_ptr)

Tests vector-notation conversion and local multi-dimensional arrays.

test_transpile_intrinsics(tmp_path, builder, frontend, use_c_ptr)

A simple test routine to test supported intrinsic functions

test_transpile_loop_indices(tmp_path, builder, frontend, use_c_ptr)

Test to ensure loop indexing translates correctly

test_transpile_logical_statements(tmp_path, builder, frontend, use_c_ptr)

A simple test routine to test logical statements

test_transpile_multibody_conditionals(tmp_path, builder, frontend, use_c_ptr)

Test correct transformation of multi-body conditionals.

test_transpile_inline_elemental_functions(tmp_path, builder, frontend, use_c_ptr)

Test correct inlining of elemental functions in C transpilation.

test_transpile_inline_elementals_recursive(tmp_path, builder, frontend, use_c_ptr)

Test correct inlining of nested elemental functions.

test_transpile_expressions(tmp_path, builder, frontend, use_c_ptr)

A simple test to verify expression parenthesis and resolution of minus sign

test_transpile_call(tmp_path, frontend, language, chevron)
test_transpile_simple_routine(tmp_path, frontend, codegen, guards, guard_name, header, extern)

Test correct transpilation of functions in C transpilation with a focus on code-gen options.

test_transpile_routine_with_interface(tmp_path, frontend, codegen)

Test transpilation of ‘INTERFACE’s.

test_transpile_inline_functions(tmp_path, frontend, f_type, codegen)

Test correct transpilation of functions in C transpilation.

test_transpile_inline_functions_return(tmp_path, frontend, f_type, codegen)

Test correct transpilation of functions in C transpilation.

test_transpile_multiconditional_simple(tmp_path, builder, frontend, codegen)

A simple test to verify multiconditionals/select case statements.

test_transpile_multiconditional(tmp_path, builder, frontend)

A test to verify multiconditionals/select case statements.

test_transpile_special_functions(tmp_path, builder, frontend, dtype, add_float)

A simple test to verify multiconditionals/select case statements.

test_transpile_interface_to_module(tmp_path, frontend)
test_transpile_optional_args(tmp_path, builder, frontend, language)

A simple test to verify multiconditionals/select case statements.