Skip to content

Commit

Permalink
Corrected TcUnit verifier to do System.Globalization.CultureInfo.Inva…
Browse files Browse the repository at this point in the history
…riantCulture for checking doubles.
  • Loading branch information
sagatowski committed Aug 5, 2024
1 parent cc72c09 commit ec984d3
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,14 @@ protected void AssertContainsResultSet(string testName, string className, string
return;
}

var actualDuration = double.Parse(match.Groups["Duration"].Value);
var actualDuration = double.Parse(match.Groups["Duration"].Value, System.Globalization.CultureInfo.InvariantCulture);
if (System.Math.Abs(actualDuration - expectedDuration) > expectedDurationTolerance)
{
log.Info($"{errorMessagePrefix} does not have expected duration: abs({actualDuration} - {expectedDuration}) > {expectedDurationTolerance}");
return;
}
}
catch
catch
{
log.Info($"{errorMessagePrefix} does not contain expected results");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<TcSmProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.beckhoff.com/schemas/2012/07/TcSmProject" TcSmVersion="1.0" TcVersion="3.1.4024.53">
<TcSmProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.beckhoff.com/schemas/2012/07/TcSmProject" TcSmVersion="1.0" TcVersion="3.1.4024.59">
<Project ProjectGUID="{3B151CEE-1DB6-4543-9B44-7AFACBDFB147}" TargetNetId="127.0.0.1.1.1" Target64Bit="true" ShowHideConfigurations="#x3c7">
<System>
<Tasks>
Expand Down
56 changes: 54 additions & 2 deletions TcUnit/TcUnit/TcUnit.plcproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Implicit_Jitter_Distribution>{9ba5f403-6725-42f3-958a-e49cc23e0e00}</Implicit_Jitter_Distribution>
<LibraryReferences>{d4c50e9b-48cc-4451-9f8a-44fa2a49ee45}</LibraryReferences>
<CombineIds>true</CombineIds>
<Released>true</Released>
<Released>false</Released>
<Title>TcUnit</Title>
<DefaultNamespace>TcUnit</DefaultNamespace>
<Description>TwinCAT unit testing framework.
Expand All @@ -32,7 +32,7 @@ Documentation and examples are available at www.tcunit.org</Description>
</SelectedLibraryCategories>
<Company>www.tcunit.org</Company>
<Author>Jakob Sagatowski and contributors</Author>
<ProjectVersion>1.3.2.0</ProjectVersion>
<ProjectVersion>1.3.1.0</ProjectVersion>
<WriteProductVersion>false</WriteProductVersion>
<!-- <OutputType>Exe</OutputType>
<RootNamespace>MyApplication</RootNamespace>
Expand Down Expand Up @@ -268,10 +268,62 @@ Documentation and examples are available at www.tcunit.org</Description>
<PlaceholderReference Include="Tc2_System">
<DefaultResolution>Tc2_System, * (Beckhoff Automation GmbH)</DefaultResolution>
<Namespace>Tc2_System</Namespace>
<Parameters>
<Parameter ListName="PARAM" xmlns="">
<Key>TABLE_UPPER_BOUND</Key>
<Value>15</Value>
</Parameter>
<Parameter ListName="PARAM" xmlns="">
<Key>STRING_LENGTH_EXP</Key>
<Value>255</Value>
</Parameter>
<Parameter ListName="PARAM" xmlns="">
<Key>STRING_LENGTH_ADDRESS</Key>
<Value>20</Value>
</Parameter>
<Parameter ListName="PARAM" xmlns="">
<Key>STRING_LENGTH_COMMENT</Key>
<Value>255</Value>
</Parameter>
<Parameter ListName="PARAM" xmlns="">
<Key>STRING_LENGTH_OUTSTRING</Key>
<Value>255</Value>
</Parameter>
<Parameter ListName="PARAM" xmlns="">
<Key>TABLE_SHOW_VALID_ITEMS</Key>
<Value>FALSE</Value>
</Parameter>
</Parameters>
</PlaceholderReference>
<PlaceholderReference Include="Tc2_Utilities">
<DefaultResolution>Tc2_Utilities, * (Beckhoff Automation GmbH)</DefaultResolution>
<Namespace>Tc2_Utilities</Namespace>
<Parameters>
<Parameter ListName="PARAMETERLIST" xmlns="">
<Key>NMAXLICENSES</Key>
<Value>50</Value>
</Parameter>
<Parameter ListName="PARAMETERLIST" xmlns="">
<Key>NMAXLICENSEDEVICES</Key>
<Value>16</Value>
</Parameter>
<Parameter ListName="PARAMETERLIST" xmlns="">
<Key>NMAXCPUCOUNT</Key>
<Value>64</Value>
</Parameter>
<Parameter ListName="PARAMETERLIST" xmlns="">
<Key>CMAXCHARACTERS</Key>
<Value>16#FFFFFFF0</Value>
</Parameter>
<Parameter ListName="PARAMETERLIST" xmlns="">
<Key>NMAXFILESONDONGLE</Key>
<Value>20</Value>
</Parameter>
<Parameter ListName="PARAMETERLIST" xmlns="">
<Key>CMAXCSVFIELDVALUESIZE</Key>
<Value>255</Value>
</Parameter>
</Parameters>
</PlaceholderReference>
</ItemGroup>
<ItemGroup>
Expand Down
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 := 3, iBuild := 2, iRevision := 0, nFlags := 1, sVersion := '1.3.2.0');
stLibVersion_TcUnit : ST_LibVersion := (iMajor := 1, iMinor := 3, iBuild := 1, iRevision := 0, nFlags := 0, sVersion := '1.3.1.0');
END_VAR
]]></Declaration>
</GVL>
Expand Down

0 comments on commit ec984d3

Please sign in to comment.