Skip to content

Commit

Permalink
TcUnit now works with TwinCAT 4020 (as well as with 4022/4024), thoug…
Browse files Browse the repository at this point in the history
…h some major changes needed to be done.

Removed FB_AnyComparator as it was discovered that it's not possible to use ANY-types in VAR_INPUT double-stacked (call to a method/function with ANY-variables, and then again calling a method/function with ANY-variables inside of that as well).
This fix also solved the issue with TwinCAT 4020.

Solved the following issues:
#28 - "TcUnit returns erroneous results with 4020.32"
#73 - "Add tester for free function F_AnyToUnionValue()"
#83 - "Add tests for WRITE_PROTECTED_ functions"
  • Loading branch information
sagatowski committed Jan 8, 2020
1 parent 135307a commit c50dcd8
Show file tree
Hide file tree
Showing 14 changed files with 651 additions and 363 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TcUnit.Verifier
{
class FB_WriteProtectedFunctions : TestFunctionBlockAssert
{
public FB_WriteProtectedFunctions(IEnumerable<ErrorList.Error> errors, string testFunctionBlockInstance = null)
: base(errors, testFunctionBlockInstance)
{
Test_WRITE_PROTECTED_BOOL();
Test_WRITE_PROTECTED_BYTE();
Test_WRITE_PROTECTED_DATE();
Test_WRITE_PROTECTED_DATE_AND_TIME();
Test_WRITE_PROTECTED_DINT();
Test_WRITE_PROTECTED_DWORD();
Test_WRITE_PROTECTED_INT();
TEST_WRITE_PROTECTED_LINT();
Test_WRITE_PROTECTED_LREAL();
Test_WRITE_PROTECTED_LWORD();
Test_WRITE_PROTECTED_REAL();
Test_WRITE_PROTECTED_SINT();
Test_WRITE_PROTECTED_STRING();
Test_WRITE_PROTECTED_TIME();
Test_WRITE_PROTECTED_TIME_OF_DAY();
Test_WRITE_PROTECTED_UDINT();
Test_WRITE_PROTECTED_UINT();
Test_WRITE_PROTECTED_USINT();
Test_WRITE_PROTECTED_ULINT();
Test_WRITE_PROTECTED_WORD();

}

private void Test_WRITE_PROTECTED_BOOL()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_BOOL";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_BYTE()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_BYTE";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_DATE()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_DATE";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_DATE_AND_TIME()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_DATE_AND_TIME";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_DINT()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_DINT";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_DWORD() {
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_DWORD";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_INT()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_INT";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void TEST_WRITE_PROTECTED_LINT()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@TEST_WRITE_PROTECTED_LINT";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_LREAL()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_LREAL";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_LWORD()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_LWORD";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_REAL()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_REAL";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_SINT()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_SINT";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_STRING()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_STRING";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_TIME()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_TIME";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_TIME_OF_DAY()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_TIME_OF_DAY";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_UDINT()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_UDINT";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_UINT()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_UINT";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_USINT()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_USINT";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_ULINT()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_ULINT";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

private void Test_WRITE_PROTECTED_WORD()
{
string testMessage = "PRG_TEST." + _testFunctionBlockInstance + "@Test_WRITE_PROTECTED_WORD";
AssertDoesNotContainMessage(testMessage, EnvDTE80.vsBuildErrorLevel.vsBuildErrorLevelHigh);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ static int Main(string[] args)
new FB_SkipAssertionsWhenFinished(errors);
new FB_AdjustAssertFailureMessageToMax253CharLengthTest(errors);
new FB_CheckIfSpecificTestIsFinished(errors);
new FB_WriteProtectedFunctions(errors);
new FB_TestFinishedNamed(errors);

log.Info("Done.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<Compile Include="AutomationInterface.cs" />
<Compile Include="Constants.cs" />
<Compile Include="ErrorList.cs" />
<Compile Include="FB_WriteProtectedFunctions.cs" />
<Compile Include="FB_ExtendedTestInformation.cs" />
<Compile Include="FB_SkipAssertionsWhenFinished.cs" />
<Compile Include="FB_AdjustAssertFailureMessageToMax253CharLengthTest.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@
<SubType>Content</SubType>
</None>
</ItemGroup>
<ItemGroup>
<LibraryReference Include="Base Interfaces,newest,System">
<Namespace>IBaseLibrary</Namespace>
</LibraryReference>
</ItemGroup>
<ProjectExtensions>
<PlcProjectOptions>
<XmlArchive>
Expand Down

0 comments on commit c50dcd8

Please sign in to comment.