FW Profile - C1 Implementation
FwPrMakeTest.c File Reference

Implementation of test procedures for FW Procedure Module. More...

Go to the source code of this file.

Functions

struct TestPrDataGetTestPrData (FwPrDesc_t prDesc)
 Get the pointer to the procedure data of a test procedure. More...
 
FwPrDesc_t FwPrMakeTestPR1 (struct TestPrData *prData)
 Operation to create the test procedure PR1. More...
 
FwPrDesc_t FwPrMakeTestPR1Static (struct TestPrData *prData)
 Operation to create and configure the procedure PR1 (see FwPrMakeTestPR1 and figure below) statically using the interface defined in FwPrSCreate.h. More...
 
FwPrDesc_t FwPrMakeTestPR2 (struct TestPrData *prData)
 Operation to create the test procedure PR2. More...
 
FwPrDesc_t FwPrMakeTestPR2Dir (struct TestPrData *prData)
 Operation to create the test procedure PR2 (see FwPrMakeTestPR2 and figure below) directly by instantiating and configuring its data structures. More...
 
FwPrDesc_t FwPrMakeTestPR2Static (struct TestPrData *prData)
 Operation to create and configure the procedure PR2 (see FwPrMakeTestPR2 and figure below) statically using the interface defined in FwPrSCreate.h. More...
 
FwPrDesc_t FwPrMakeTestPR3 (struct TestPrData *prData)
 Operation to create the test procedure PR3. More...
 
FwPrDesc_t FwPrMakeTestPR4 (struct TestPrData *prData)
 Operation to create the test procedure PR4. More...
 
FwPrDesc_t FwPrMakeTestPR5 (struct TestPrData *prData)
 Operation to create the test procedure PR5. More...
 
FwPrDesc_t FwPrMakeTestPR6_1 (struct TestPrData *prData)
 Operation to create the test procedure PR6. More...
 
FwPrDesc_t FwPrMakeTestPR6_2 (struct TestPrData *prData)
 Operation to create the test procedure PR6. More...
 
FwPrDesc_t FwPrMakeTestPR6_3 (struct TestPrData *prData)
 Operation to create the test procedure PR6. More...
 
FwPrDesc_t FwPrMakeTestPRDer1 (FwPrDesc_t prDescBase, struct TestPrData *prData)
 Create a derived procedure and override one of its actions and one of its guards. More...
 
FwPrDesc_t FwPrMakeTestPRDer1Static (FwPrDesc_t prDescBase, struct TestPrData *prData)
 Create a derived procedure and override one of its actions and one of its guards. More...
 

Variables

int fwPrLogMarker [LOG_ARRAY_SIZE]
 Log array where the actions of the test procedures write their markers. More...
 
int fwPrLogNode [LOG_ARRAY_SIZE]
 Log array where the actions of the test procedures write the current state of their procedure. More...
 
int fwPrLogIndex
 Location in the log array where the next entry is written. More...
 

Detailed Description

Implementation of test procedures for FW Procedure Module.

Author
Vaclav Cechticky vacla.nosp@m.v.ce.nosp@m.chtic.nosp@m.ky@p.nosp@m.np-so.nosp@m.ftwa.nosp@m.re.co.nosp@m.m
Alessandro Pasetti paset.nosp@m.ti@p.nosp@m.np-so.nosp@m.ftwa.nosp@m.re.co.nosp@m.m

This file is part of the FW Profile.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

For information on alternative licensing, please contact P&P Software GmbH.

Definition in file FwPrMakeTest.c.

Function Documentation

FwPrDesc_t FwPrMakeTestPR1 ( struct TestPrData prData)

Operation to create the test procedure PR1.

This procedure has the following characteristics:

  • Three action nodes N1, N2 and N3.
  • No decision nodes.
  • Four control flows.
  • Node actions increment counter Counter_1 by 1. The control flows and their guards are defined as follows:
  • Control flow from initial node to N1: the guard returns the value of flag_1.
  • Control flow from N1 to N2: the guard returns the value of flag_2.
  • Control flow from N2 to N3: the guard returns the value of flag_3.
  • Control flow from N3 to final node: the guard returns the value of flag_4.
PR1.png
Parameters
prDatathe data structure upon which the procedure operates
Returns
the descriptor of the created procedure or NULL if the creation or configuration of the procedure failed.

Definition at line 177 of file FwPrMakeTest.c.

FwPrDesc_t FwPrMakeTestPR1Static ( struct TestPrData prData)

Operation to create and configure the procedure PR1 (see FwPrMakeTestPR1 and figure below) statically using the interface defined in FwPrSCreate.h.

PR1.png
Parameters
prDatathe data structure upon which the procedure operates
Returns
the descriptor of the created procedure or NULL if the creation or configuration of the procedure failed.

Definition at line 205 of file FwPrMakeTest.c.

FwPrDesc_t FwPrMakeTestPR2 ( struct TestPrData prData)

Operation to create the test procedure PR2.

This procedure has the following characteristics (see also figure below):

  • Three action nodes N1, N2 and N3.
  • Two decision nodes D1 and D2.
  • Nine control flows.
  • Node actions increment counter Counter_1 by 1. The control flows and their guards are defined as follows:
  • Control flow from initial node to N1: the guard returns the value of flag_1.
  • Control flow from N1 to N2: the guard returns the value of flag_2.
  • Control flow from N2 to D1: no guard is attached to this control flow.
  • Control flow from D1 to final node: the guard returns the value of flag_3.
  • Control flow from D1 to D2: the guard returns the value of flag_4.
  • Control flow from D1 to N3: the guard returns the value of flag_5.
  • Control flow from N3 to N2: the guard returns the value of flag_6.
  • Control flow from D2 to N3: the guard returns true if Counter_1 is greater than 5.
  • Control flow from D2 to final node: the guard returns true if Counter_1 is smaller than 6.
PR2.png
Parameters
prDatathe data structure upon which the procedure operates
Returns
the descriptor of the created procedure or NULL if the creation or configuration of the procedure failed.

Definition at line 230 of file FwPrMakeTest.c.

FwPrDesc_t FwPrMakeTestPR2Dir ( struct TestPrData prData)

Operation to create the test procedure PR2 (see FwPrMakeTestPR2 and figure below) directly by instantiating and configuring its data structures.

This function does not use any of the functions provided by the C1 Implementation to create and configure a procedure. Instead, it instantiated and directly configures the data structures which define the procedure PR2. This approach to creating a procedure is useful in applications which are severely memory-constrained because it allowed them to do without the FwPrSCreate.h, FwPrDCreate.h, and FwPrConfig.h.

PR2.png
Parameters
prDatathe data structure upon which the procedure operates
Returns
the descriptor of the created procedure or NULL if the creation or configuration of the procedure failed.

Definition at line 267 of file FwPrMakeTest.c.

FwPrDesc_t FwPrMakeTestPR2Static ( struct TestPrData prData)

Operation to create and configure the procedure PR2 (see FwPrMakeTestPR2 and figure below) statically using the interface defined in FwPrSCreate.h.

PR2.png
Parameters
prDatathe data structure upon which the procedure operates
Returns
the descriptor of the created procedure or NULL if the creation or configuration of the procedure failed.

Definition at line 347 of file FwPrMakeTest.c.

FwPrDesc_t FwPrMakeTestPR3 ( struct TestPrData prData)

Operation to create the test procedure PR3.

This procedure has the following characteristics (see also figure below):

  • One action nodes N1.
  • no decision nodes.
  • Two control flows.
  • Node actions increment counter Counter_1 by 1.
  • No guards on any control flow.
PR3.png
Parameters
prDatathe data structure upon which the procedure operates
Returns
the descriptor of the created procedure or NULL if the creation or configuration of the procedure failed.

Definition at line 380 of file FwPrMakeTest.c.

FwPrDesc_t FwPrMakeTestPR4 ( struct TestPrData prData)

Operation to create the test procedure PR4.

This procedure has the following characteristics (see also figure below):

  • One action node N1.
  • One decision node D1.
  • Four control flows.
  • Node action increments counter Counter_1 by 1. The control flows and their guards are defined as follows:
  • Control flow from initial node to D1: no guard is attached to this control flow.
  • Control flow from D1 to N1: the guard returns the value of flag_1.
  • Control flow from D1 to final node: the guard returns the value of flag_2.
  • Control flow from D2 to final node: no guard is attached to this control flow.
PR4.png
Parameters
prDatathe data structure upon which the procedure operates
Returns
the descriptor of the created procedure or NULL if the creation or configuration of the procedure failed.

Definition at line 404 of file FwPrMakeTest.c.

FwPrDesc_t FwPrMakeTestPR5 ( struct TestPrData prData)

Operation to create the test procedure PR5.

This procedure has the following characteristics (see also figure below):

  • Three action nodes N1, N2 and N3.
  • No decision nodes.
  • Four control flows.
  • Node action assigns the value of the Procedure Execution Counter to Counter_1. The control flows and their guards are defined as follows:
  • Control flow from initial node to N1: no guard is attached to this control flow.
  • Control flow from N1 to N2: the guard returns true after waiting for three cycles.
  • Control flow from N2 to N3: the guard returns true after waiting for three cycles.
  • Control flow from D3 to final node: no guard is attached to this control flow.
PR5.png
Parameters
prDatathe data structure upon which the procedure operates
Returns
the descriptor of the created procedure or NULL if the creation or configuration of the procedure failed.

Definition at line 432 of file FwPrMakeTest.c.

FwPrDesc_t FwPrMakeTestPR6_1 ( struct TestPrData prData)

Operation to create the test procedure PR6.

This procedure has the following characteristics (see also figure below):

  • Three action nodes N1, N2 and N3.
  • One decision node.
  • Seven control flows.
  • Node action increments the value of Counter_1. The control flows and their guards are defined as follows:
  • Control flow from initial node to D1: no guard is attached to this control flow.
  • Control flow from D1 to N1: the guard returns the value of Flag_1.
  • Control flow from D1 to N2: the guard returns the value of Flag_2.
  • Control flow from D1 to N3: the guard returns the value of Flag_3.
  • Control flow from N1 to Final Node: the guard returns the value of Flag_4.
  • Control flow from N2 to Final Node: the guard returns the value of Flag_4.
  • Control flow from N3 to Final Node: the guard returns the value of Flag_4.

The control flows are added to the procedure in the order in which they are listed above.

PR6.png
Parameters
prDatathe data structure upon which the procedure operates
Returns
the descriptor of the created procedure or NULL if the creation or configuration of the procedure failed.

Definition at line 460 of file FwPrMakeTest.c.

FwPrDesc_t FwPrMakeTestPR6_2 ( struct TestPrData prData)

Operation to create the test procedure PR6.

This procedure has the following characteristics (see also figure below):

  • Three action nodes N1, N2 and N3.
  • One decision node.
  • Seven control flows.
  • Node action increments the value of Counter_1. The control flows and their guards are defined as follows:
  • Control flow from initial node to D1: no guard is attached to this control flow.
  • Control flow from D1 to N3: the guard returns the value of Flag_3.
  • Control flow from D1 to N2: the guard returns the value of Flag_2.
  • Control flow from D1 to N1: the guard returns the value of Flag_1.
  • Control flow from N1 to Final Node: the guard returns the value of Flag_4.
  • Control flow from N2 to Final Node: the guard returns the value of Flag_4.
  • Control flow from N3 to Final Node: the guard returns the value of Flag_4.

The control flows are added to the procedure in the order in which they are listed above.

PR6.png
Parameters
prDatathe data structure upon which the procedure operates
Returns
the descriptor of the created procedure or NULL if the creation or configuration of the procedure failed.

Definition at line 492 of file FwPrMakeTest.c.

FwPrDesc_t FwPrMakeTestPR6_3 ( struct TestPrData prData)

Operation to create the test procedure PR6.

This procedure has the following characteristics (see also figure below):

  • Three action nodes N1, N2 and N3.
  • One decision node.
  • Seven control flows.
  • Node action increments the value of Counter_1. The control flows and their guards are defined as follows:
  • Control flow from initial node to D1: no guard is attached to this control flow.
  • Control flow from D1 to N2: the guard returns the value of Flag_2.
  • Control flow from D1 to N3: the guard returns the value of Flag_3.
  • Control flow from D1 to N1: the guard returns the value of Flag_1.
  • Control flow from N1 to Final Node: the guard returns the value of Flag_4.
  • Control flow from N2 to Final Node: the guard returns the value of Flag_4.
  • Control flow from N3 to Final Node: the guard returns the value of Flag_4.

The control flows are added to the procedure in the order in which they are listed above.

PR6.png
Parameters
prDatathe data structure upon which the procedure operates
Returns
the descriptor of the created procedure or NULL if the creation or configuration of the procedure failed.

Definition at line 524 of file FwPrMakeTest.c.

FwPrDesc_t FwPrMakeTestPRDer1 ( FwPrDesc_t  prDescBase,
struct TestPrData prData 
)

Create a derived procedure and override one of its actions and one of its guards.

The base procedure is passed as an argument to the function. The function extends the base procedure and then it performs the following overrides on the derived procedure:

  • action incrCnt1By1 (increment Counter_1 by 1) is overridden with action incrCnt1By8 (increment Counter_1 by 8).
  • guard retFlag1 (return Flag_1) is overridden with guard retFlag2 (return Flag_2).

The derived state machine is created using the dynamic creation interface of FwPrDCreate.h.

Parameters
prDescBasethe base state machine
prDatathe data structure for the newly created state machine
Returns
the derived state machine

Definition at line 555 of file FwPrMakeTest.c.

FwPrDesc_t FwPrMakeTestPRDer1Static ( FwPrDesc_t  prDescBase,
struct TestPrData prData 
)

Create a derived procedure and override one of its actions and one of its guards.

The base procedure is passed as an argument to the function. This function assumes that the base state machine has 1 action, and 8 guards. The function extends the base procedure and then it performs the following overrides on the derived procedure:

  • action incrCnt1By1 (increment Counter_1 by 1) is overridden with action incrCnt1By8 (increment Counter_1 by 8).
  • guard retFlag1 (return Flag_1) is overridden with guard retFlag2 (return Flag_2).

The derived state machine is created using the static creation interface of FwPrSCreate.h.

Parameters
prDescBasethe base state machine
prDatathe data structure for the newly created state machine
Returns
the derived state machine

Definition at line 568 of file FwPrMakeTest.c.

struct TestPrData * GetTestPrData ( FwPrDesc_t  prDesc)

Get the pointer to the procedure data of a test procedure.

This function is a wrapper for the FwPrGetData function. Function FwPrGetData is defined at the level of the Procedure Module and returns the pointer to the procedure data as a pointer to void. This function cast this pointer to pointer to struct TestPrData*.

Parameters
prDescthe state machine descriptor
Returns
the procedure data

Definition at line 172 of file FwPrMakeTest.c.

Variable Documentation

int fwPrLogIndex

Location in the log array where the next entry is written.

Index for write operations in log arrays.

Definition at line 35 of file FwPrMakeTest.c.

int fwPrLogMarker[LOG_ARRAY_SIZE]

Log array where the actions of the test procedures write their markers.

Array where procedure actions write their marker.

Definition at line 26 of file FwPrMakeTest.c.

int fwPrLogNode[LOG_ARRAY_SIZE]

Log array where the actions of the test procedures write the current state of their procedure.

Array where procedure actions write the state of their SM.

Definition at line 31 of file FwPrMakeTest.c.

P&P Software GmbH, Copyright 2011, All Rights Reserved