From fc32261c208546ed7af52aaba04354553080cccb Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 11 Sep 2020 17:15:17 +0200 Subject: validation: Use call_function() --- rtemsspec/tests/test_validation.py | 15 +++------------ rtemsspec/validation.py | 15 +++++++++------ 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/rtemsspec/tests/test_validation.py b/rtemsspec/tests/test_validation.py index 9aaafffb..da735274 100644 --- a/rtemsspec/tests/test_validation.py +++ b/rtemsspec/tests/test_validation.py @@ -806,10 +806,7 @@ T_TEST_CASE_FIXTURE( Directive, &Directive_Fixture ) ctx, Directive_TransitionMap[ index ][ 0 ] ); - Directive_Post_Id_Check( - ctx, - Directive_TransitionMap[ index ][ 1 ] - ); + Directive_Post_Id_Check( ctx, Directive_TransitionMap[ index ][ 1 ] ); ++index; } } @@ -1726,14 +1723,8 @@ void Action2_Run( int *a, int b, int *c ) Action2_Pre_A_Prepare( ctx, ctx->pcs[ 0 ] ); Action2_Pre_B_Prepare( ctx, ctx->pcs[ 1 ] ); Action2_Action( ctx ); - Action2_Post_A_Check( - ctx, - Action2_TransitionMap[ index ][ 0 ] - ); - Action2_Post_B_Check( - ctx, - Action2_TransitionMap[ index ][ 1 ] - ); + Action2_Post_A_Check( ctx, Action2_TransitionMap[ index ][ 0 ] ); + Action2_Post_B_Check( ctx, Action2_TransitionMap[ index ][ 1 ] ); Action2_Cleanup( ctx ); ++index; } diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py index a9b38501..4154588e 100644 --- a/rtemsspec/validation.py +++ b/rtemsspec/validation.py @@ -554,7 +554,8 @@ class _TestDirectiveItem(_TestItem): def _add_call(self, content: CContent, key: str, name: str) -> None: if self[key] is not None: - content.append(f"{self.ident}_{name}( ctx );") + content.gap = False + content.call_function(None, f"{self.ident}_{name}", ["ctx"]) def _add_loop_body(self, content: CContent) -> None: with content.condition(f"{self.ident}_TransitionInfo[ index ].Skip"): @@ -562,14 +563,16 @@ class _TestDirectiveItem(_TestItem): content.add_blank_line() self._add_call(content, "test-prepare", "Prepare") for index, enum in enumerate(self._pre_index_to_enum): - content.append(f"{enum[0]}_Prepare( ctx, ctx->pcs[ {index} ] );") + content.gap = False + content.call_function(None, f"{enum[0]}_Prepare", + ["ctx", f"ctx->pcs[ {index} ]"]) self._add_call(content, "test-action", "Action") transition_map = f"{self.ident}_TransitionMap" for index, enum in enumerate(self._post_index_to_enum): - content.append([ - f"{enum[0]}_Check(", " ctx,", - f" {transition_map}[ index ][ {index} ]", ");" - ]) + content.gap = False + content.call_function( + None, f"{enum[0]}_Check", + ["ctx", f"{transition_map}[ index ][ {index} ]"]) self._add_call(content, "test-cleanup", "Cleanup") content.append("++index;") -- cgit v1.2.3