Skip to content

Commit

Permalink
Fixed some more improvements based on static code analysis.
Browse files Browse the repository at this point in the history
Set library version to 0.3.0.0. First we'll get some feedback/improvement suggestions by the community prior to considering setting it to version 1.0.
  • Loading branch information
sagatowski committed Dec 8, 2018
1 parent 685bacb commit 9ec53e2
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 28 deletions.
14 changes: 8 additions & 6 deletions TcUnit/TcUnit/POUs/FB_ADSAssertMessageFormatter.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ END_VAR
VAR
TestInstancePathCleaned : Tc2_System.T_MaxString;
FinalMessage : Tc2_System.T_MaxString;
ReturnValue : DINT;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[TestInstancePathCleaned := F_RemoveInstancePathAndProjectNameFromTestInstancePath(TestInstancePath);
Expand All @@ -38,9 +39,9 @@ END_IF
IF Tc2_Standard.LEN(STR := Message) > 0 THEN
FinalMessage := Tc2_Standard.CONCAT(STR1 := FinalMessage, STR2 := ', MSG: %s ');
END_IF
Tc2_System.ADSLOGSTR(msgCtrlMask := Tc2_System.ADSLOG_MSGTYPE_ERROR,
msgFmtStr := FinalMessage,
strArg := Message);]]></ST>
ReturnValue := Tc2_System.ADSLOGSTR(msgCtrlMask := Tc2_System.ADSLOG_MSGTYPE_ERROR,
msgFmtStr := FinalMessage,
strArg := Message);]]></ST>
</Implementation>
</Method>
<Method Name="LogMessageError" Id="{bab195d7-5e96-4c3f-8266-c59551de8d0d}">
Expand All @@ -54,6 +55,7 @@ END_VAR
VAR
TestInstancePathCleaned : Tc2_System.T_MaxString;
FinalMessage : Tc2_System.T_MaxString;
ReturnValue : DINT;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[TestInstancePathCleaned := F_RemoveInstancePathAndProjectNameFromTestInstancePath(TestInstancePath);
Expand All @@ -71,9 +73,9 @@ END_IF
IF Tc2_Standard.LEN(STR := Message) > 0 THEN
FinalMessage := Tc2_Standard.CONCAT(STR1 := FinalMessage, STR2 := ', MSG: %s ');
END_IF
Tc2_System.ADSLOGSTR(msgCtrlMask := Tc2_System.ADSLOG_MSGTYPE_ERROR,
msgFmtStr := FinalMessage,
strArg := Message);]]></ST>
ReturnValue := Tc2_System.ADSLOGSTR(msgCtrlMask := Tc2_System.ADSLOG_MSGTYPE_ERROR,
msgFmtStr := FinalMessage,
strArg := Message);]]></ST>
</Implementation>
</Method>
<LineIds Name="FB_ADSAssertMessageFormatter">
Expand Down
2 changes: 1 addition & 1 deletion TcUnit/TcUnit/POUs/FB_AssertResultStatic.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ VAR_OUTPUT
AlreadyReported : BOOL := FALSE;
END_VAR
VAR
LocationIndex : UDINT;
LocationIndex : UINT;
DataTypesNotEquals : BOOL;
DataSizeNotEquals : BOOL;
DataContentNotEquals : BOOL;
Expand Down
12 changes: 6 additions & 6 deletions TcUnit/TcUnit/POUs/Functions/F_AnyToUnionValue.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ END_VAR]]></Declaration>
BYTE_TO_ULINT(AnyValue.pValue[0]));
IBaseLibrary.TypeClass.TYPE_REAL :
nTempDWord := (SHL(SHL(SHL(BYTE_TO_DWORD(AnyValue.pValue[3]), 8) OR
nTempDWORD := (SHL(SHL(SHL(BYTE_TO_DWORD(AnyValue.pValue[3]), 8) OR
BYTE_TO_DWORD(AnyValue.pValue[2]), 8) OR
BYTE_TO_DWORD(AnyValue.pValue[1]), 8) OR
BYTE_TO_DWORD(AnyValue.pValue[0]));
ptReal := ADR(nTempDWord);
F_AnyToUnionValue.fExpectedOrActual := ptReal^;
ptREAL := ADR(nTempDWORD);
F_AnyToUnionValue.fExpectedOrActual := ptREAL^;
IBaseLibrary.TypeClass.TYPE_LREAL :
nTempLWORD :=
Expand Down Expand Up @@ -136,11 +136,11 @@ END_VAR]]></Declaration>
(* None *)
IBaseLibrary.TypeClass.TYPE_TIME :
nTempDWord := (SHL(SHL(SHL(BYTE_TO_DWORD(AnyValue.pValue[3]), 8) OR
nTempDWORD := (SHL(SHL(SHL(BYTE_TO_DWORD(AnyValue.pValue[3]), 8) OR
BYTE_TO_DWORD(AnyValue.pValue[2]), 8) OR
BYTE_TO_DWORD(AnyValue.pValue[1]), 8) OR
BYTE_TO_DWORD(AnyValue.pValue[0]));
ptTIME := ADR(nTempDWord);
ptTIME := ADR(nTempDWORD);
F_AnyToUnionValue.tExpectedOrActual := ptTIME^;
IBaseLibrary.TypeClass.TYPE_DATE :
Expand Down Expand Up @@ -198,7 +198,7 @@ END_VAR]]></Declaration>
(* None *)
IBaseLibrary.TypeClass.TYPE_LTIME :
nTempLWord :=
nTempLWORD :=
(SHL(SHL(SHL(SHL(SHL(SHL(SHL(BYTE_TO_LWORD(AnyValue.pValue[7]), 8) OR
BYTE_TO_LWORD(AnyValue.pValue[6]), 8) OR
BYTE_TO_LWORD(AnyValue.pValue[5]), 8) OR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ CharacterPositionOfProjectName := Tc2_Standard.FIND(STR1 := TestInstancePath, ST
IF CharacterPositionOfProjectName > 0 THEN
TestInstancePath := Tc2_Standard.DELETE(STR := TestInstancePath,
LEN := CharacterPositionOfProjectName-1 + LEN(ProjectNameWithDot),
LEN := CharacterPositionOfProjectName-1 + Tc2_Standard.LEN(ProjectNameWithDot),
POS := 1);
END_IF
Expand Down
22 changes: 11 additions & 11 deletions TcUnit/TcUnit/TcUnit.plcproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Documentation and examples are available at www.tcunit.org</Description>
</SelectedLibraryCategories>
<Company>www.tcunit.org</Company>
<Author>Jakob Sagatowski and other contributors, see AUTHORS file on www.github.com/tcunit/TcUnit</Author>
<ProjectVersion>1.0.0.0</ProjectVersion>
<ProjectVersion>0.3.0.0</ProjectVersion>
<!-- <OutputType>Exe</OutputType>
<RootNamespace>MyApplication</RootNamespace>
<AssemblyName>MyApplication</AssemblyName>-->
Expand Down Expand Up @@ -148,8 +148,8 @@ Documentation and examples are available at www.tcunit.org</Description>
<ProjectExtensions>
<PlcProjectOptions>
<XmlArchive>
<Data>
<o xml:space="preserve" t="OptionKey">
<Data>
<o xml:space="preserve" t="OptionKey">
<v n="Name">"&lt;ProjectRoot&gt;"</v>
<d n="SubKeys" t="Hashtable" ckt="String" cvt="OptionKey">
<v>{192FAD59-8248-4824-A8DE-9177C94C195A}</v>
Expand Down Expand Up @@ -204,14 +204,14 @@ Documentation and examples are available at www.tcunit.org</Description>
</d>
<d n="Values" t="Hashtable" />
</o>
</Data>
<TypeList>
<Type n="Boolean">System.Boolean</Type>
<Type n="Hashtable">System.Collections.Hashtable</Type>
<Type n="OptionKey">{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}</Type>
<Type n="String">System.String</Type>
</TypeList>
</XmlArchive>
</Data>
<TypeList>
<Type n="Boolean">System.Boolean</Type>
<Type n="Hashtable">System.Collections.Hashtable</Type>
<Type n="OptionKey">{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}</Type>
<Type n="String">System.String</Type>
</TypeList>
</XmlArchive>
</PlcProjectOptions>
</ProjectExtensions>
<!--
Expand Down
4 changes: 2 additions & 2 deletions TcUnit/TcUnit/TcUnit.tmc

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion TcUnit/TcUnit/Version/Global_Version.TcGVL
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// This function has been automatically generated from the project information.
VAR_GLOBAL CONSTANT
{attribute 'const_non_replaced'}
stLibVersion_TcUnit : ST_LibVersion := (iMajor := 1, iMinor := 0, iBuild := 0, iRevision := 0, sVersion := '1.0.0.0');
stLibVersion_TcUnit : ST_LibVersion := (iMajor := 0, iMinor := 3, iBuild := 0, iRevision := 0, sVersion := '0.3.0.0');
END_VAR
]]></Declaration>
</GVL>
Expand Down

0 comments on commit 9ec53e2

Please sign in to comment.