Change all the files in the directory 'Test' to follow coding standards
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
FUNCTION_BLOCK FB_tcUNIT_common
|
||||
|
||||
VAR
|
||||
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
@@ -12,7 +13,7 @@ END_VAR]]></Declaration>
|
||||
<Method Name="mEnableAxis" Id="{12e91532-7139-4c17-998e-4c670b584b9d}">
|
||||
<Declaration><![CDATA[METHOD mEnableAxis : BOOL
|
||||
VAR_INPUT
|
||||
iAxisIndex: INT; // The idex of the axis to action the method on.
|
||||
iAxisIndex: UINT; // The idex of the axis to action the method on.
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[GVL.aAxes[iAxisIndex].stControl.bEnable := TRUE;]]></ST>
|
||||
@@ -21,7 +22,7 @@ END_VAR]]></Declaration>
|
||||
<Method Name="mExecute" Id="{010bd927-5568-40db-a7c5-fcfe995a5cb1}">
|
||||
<Declaration><![CDATA[METHOD mExecute : BOOL
|
||||
VAR_INPUT
|
||||
iAxisIndex: INT; // The idex of the axis to action the method on.
|
||||
iAxisIndex: UINT; // The idex of the axis to action the method on.
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[GVL.aAxes[iAxisIndex].stControl.bExecute := TRUE;]]></ST>
|
||||
@@ -31,7 +32,7 @@ END_VAR]]></Declaration>
|
||||
<Declaration><![CDATA[METHOD mPrepareDefaultMove
|
||||
|
||||
VAR_INPUT
|
||||
iAxisIndex: INT; // The idex of the axis to action the method on.
|
||||
iAxisIndex: UINT; // The idex of the axis to action the method on.
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Prepare an axis so it is ready to action a move using target defaults when executed.
|
||||
@@ -53,7 +54,7 @@ GVL.aAxes[iAxisIndex].stConfig.fPosition := tcUNIT_GVL.fDEFAULT_POSITION;]]></ST
|
||||
<Declaration><![CDATA[METHOD mPrepareMove
|
||||
|
||||
VAR_INPUT
|
||||
iAxisIndex: INT; // The idex of the axis to action the method on.
|
||||
iAxisIndex: UINT; // The idex of the axis to action the method on.
|
||||
fTargetVelocity: LREAL;
|
||||
fTargetAcceleration: LREAL;
|
||||
fTargetDeceleration: LREAL;
|
||||
@@ -79,7 +80,7 @@ GVL.aAxes[iAxisIndex].stConfig.fPosition := fTargetPosition;]]></ST>
|
||||
<Declaration><![CDATA[METHOD mSetAxisDefaults
|
||||
|
||||
VAR_INPUT
|
||||
iAxisIndex: INT; // The idex of the axis to action the method on.
|
||||
iAxisIndex: UINT; // The idex of the axis to action the method on.
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Set PLC default values for the axis. Note: Status values can take multiple cycles to updated. This is not an instant reset.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
FUNCTION_BLOCK FB_Axis_TEST EXTENDS tcUnit.FB_TestSuite
|
||||
VAR
|
||||
fbCommon: FB_tcUNIT_common;
|
||||
iTargetAxis: INT := 1; // The <index> of the axis within GVL.aAxes[<index>] to test against.
|
||||
iTargetAxis: UINT := 1; // The <index> of the axis within GVL.aAxes[<index>] to test against.
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Declare methods defined in the FB_Axis_TEST POU to be included (executed) in the test suite
|
||||
@@ -52,6 +52,7 @@ VAR
|
||||
InitialValue: LREAL;
|
||||
Result: LREAL;
|
||||
ExpectedResult: LREAL;
|
||||
|
||||
nCycle: UINT;
|
||||
nCycleMax: UINT := 100;
|
||||
END_VAR]]></Declaration>
|
||||
@@ -96,7 +97,7 @@ END_VAR]]></Declaration>
|
||||
ExpectedResult := tcUNIT_gvl.fDEFAULT_TARGET_ACCELERATION;
|
||||
fbCommon.mPrepareDefaultMove(iTargetAxis);
|
||||
|
||||
Result := GVL.aAxes[1].stConfig.fAcceleration;
|
||||
Result := GVL.aAxes[iTargetAxis].stConfig.fAcceleration;
|
||||
|
||||
AssertEquals(Expected := ExpectedResult,
|
||||
Actual := Result,
|
||||
@@ -110,6 +111,7 @@ TEST_FINISHED();]]></ST>
|
||||
VAR
|
||||
Result: BOOL;
|
||||
ExpectedResult: BOOL;
|
||||
|
||||
nCycle: UINT;
|
||||
nMaxCycles: UINT := 30;
|
||||
END_VAR]]></Declaration>
|
||||
@@ -119,7 +121,7 @@ END_VAR]]></Declaration>
|
||||
// example of test that requires multiple cycles to complete. Due to stateful behaviour of the axis structure.
|
||||
|
||||
ExpectedResult := TRUE;
|
||||
GVL.aAxes[1].stControl.bEnable := ExpectedResult;
|
||||
GVL.aAxes[iTargetAxis].stControl.bEnable := ExpectedResult;
|
||||
|
||||
Result := GVL.aAxes[iTargetAxis].stStatus.bEnabled;
|
||||
|
||||
@@ -167,7 +169,7 @@ AssertEquals_LREAL(Expected := ExpectedResult,
|
||||
VAR
|
||||
Result: BOOL;
|
||||
ExpectedResult: BOOL;
|
||||
|
||||
|
||||
nCycle: UINT;
|
||||
nMaxCycles: UINT := 30;
|
||||
END_VAR]]></Declaration>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
PROGRAM tcUNIT_STD_LIB_RUN
|
||||
VAR
|
||||
// Declare standard library POU tests to be run
|
||||
fbFB_Axis: FB_Axis_TEST;
|
||||
fbAxisTest: FB_Axis_TEST;
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[TcUnit.RUN();]]></ST>
|
||||
|
||||
Reference in New Issue
Block a user