Skip to content

Commit

Permalink
#2711 test undf DynFunctionSpaces
Browse files Browse the repository at this point in the history
  • Loading branch information
oakleybrunt committed Oct 9, 2024
1 parent 67e8fa3 commit 47f1a5e
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/psyclone/tests/domain/lfric/dofkern_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

from psyclone.configuration import Config
from psyclone.domain.lfric import LFRicKernMetadata, LFRicKern
from psyclone.dynamo0p3 import DynFunctionSpaces
from psyclone.parse.algorithm import parse
from psyclone.psyGen import PSyFactory
from psyclone.parse.utils import ParseError
Expand Down Expand Up @@ -278,29 +279,30 @@ def test_undf_initialisation():
assert initalisation in code


def test_compiles(tmpdir):
def test_function_space_bare_undf():
'''
Test that the code PSyclone generates from a DoF kernel compiles without
error.
Test that the correct undf name ("undf") is stored in DynFunctionSpaces
list of undf_names when a kernel is found to operate on 'dof'
'''
_, invoke_info = parse(os.path.join(BASE_PATH,
"1.14_single_invoke_dofs.f90"),
api=TEST_API)
psy = PSyFactory(TEST_API, distributed_memory=False).create(invoke_info)
assert LFRicBuild(tmpdir).code_compiles(psy)
invoke = psy.invokes.invoke_list[0]
dynfs = DynFunctionSpaces(invoke)

assert ["undf"] == dynfs._var_list


def test_function_space_bar_undf():
def test_compiles(tmpdir):
'''
Test that the correct undf name ("undf") is stored in an LFRicInvoke when
a kernel is found to operate on 'dof'
Test that the code PSyclone generates from a DoF kernel compiles without
error.
'''
_, invoke_info = parse(os.path.join(BASE_PATH,
"1.14_single_invoke_dofs.f90"),
api=TEST_API)
psy = PSyFactory(TEST_API, distributed_memory=False).create(invoke_info)
invoke = psy.invokes.invoke_list[0]

assert "undf" in invoke.function_spaces._var_list
assert LFRicBuild(tmpdir).code_compiles(psy)

0 comments on commit 47f1a5e

Please sign in to comment.