Skip to content

Commit

Permalink
#1664: Improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
svalat committed Jun 20, 2023
1 parent 4bfeec0 commit 3480e9d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/psyclone/tests/psyir/nodes/acc_directives_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
from psyclone.psyGen import PSyFactory
from psyclone.psyir.nodes import ACCRoutineDirective, \
ACCKernelsDirective, Schedule, ACCUpdateDirective, ACCLoopDirective, \
ACCWaitDirective, Routine, ACCParallelDirective
ACCWaitDirective, Routine, ACCParallelDirective, ACCEnterDataDirective
from psyclone.psyir.nodes.acc_directives import _build_async_string
from psyclone.psyir.symbols import SymbolTable
from psyclone.transformations import ACCEnterDataTrans, ACCParallelTrans, \
ACCKernelsTrans
Expand Down Expand Up @@ -510,7 +511,8 @@ def test_accwaitdirective_eq():

# async keyword on all classes

@pytest.mark.parametrize("directive_type", [ACCKernelsDirective, ACCParallelDirective, ACCUpdateDirective])
@pytest.mark.parametrize("directive_type", [ACCKernelsDirective, ACCParallelDirective,
ACCUpdateDirective, ACCEnterDataDirective])
def test_directives_async_queue(directive_type):
'''Validate the various usage of async_queue parameter'''

Expand All @@ -521,6 +523,12 @@ def test_directives_async_queue(directive_type):

# set value at init
directive = directive_type(*args, async_queue=1)

# need to have some data in
if directive_type == ACCEnterDataDirective:
directive._sig_set.add(Signature("x"))

# set value at init
assert directive.async_queue == 1
assert 'async(1)' in directive.begin_string()

Expand Down Expand Up @@ -548,3 +556,8 @@ def test_directives_async_queue(directive_type):
with pytest.raises(TypeError) as error:
directive.async_queue = 3.5
assert "Invalid async_queue" in str(error)

def test_build_async_string_error():
with pytest.raises(TypeError) as error:
_build_async_string(3.5)
assert "Invalid type for async argument " in str(error)
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
OMPSingleTrans, OMPMasterTrans, OMPTaskloopTrans, OMPDeclareTargetTrans
from psyclone.parse.algorithm import parse
from psyclone.psyGen import PSyFactory
from psyclone.transformations import ACCKernelsTrans

GOCEAN_BASE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)),
os.pardir, os.pardir, "test_files",
Expand Down

0 comments on commit 3480e9d

Please sign in to comment.