├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── img └── Banner.JPG ├── tcl_UnitTestLibrary.library └── tcl_UnitTestLibrary ├── tcl_UnitTestLibrary.sln └── tcl_UnitTestLibrary ├── _Config └── PLC │ └── tcl_UnitTestLibrary.xti ├── tcl_UnitTestLibrary.tsproj └── tcl_UnitTestLibrary ├── Functions ├── F_LogError.TcPOU └── F_LogMessage.TcPOU ├── Globals.TcGVL ├── Images ├── BlueRight.png ├── Failed.png └── Passed.png ├── String Utils ├── FormatString1.TcPOU ├── FormatString2.TcPOU ├── FormatString3.TcPOU ├── FormatStringEx1.TcPOU ├── FormatStringEx2.TcPOU └── StringSplitter.TcPOU ├── Unit Test └── T_UnitTestBase.TcPOU ├── Version └── Global_Version.TcGVL ├── _Libraries ├── beckhoff automation gmbh │ └── tc2_standard │ │ └── 3.3.3.0 │ │ └── tc2_standard.compiled-library └── red rock controls limited │ └── tcl_stringutils │ └── 1.1.3.0 │ └── tcl_stringutils.library ├── tcl_SimpleUnitTestLibrary.tmcRefac ├── tcl_UnitTestLibrary.plcproj └── tcl_UnitTestLibrary.tmc /.gitignore: -------------------------------------------------------------------------------- 1 | **/_Boot 2 | 3 | **/3s - smart software solutions gmbh 4 | **/beckhoff automation gmbh 5 | **/caa technical workgroup 6 | **/intern 7 | **/system 8 | *.suo 9 | *.~u 10 | *.bak 11 | _CompileInfo/ 12 | LineIDs.dbg 13 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to the TwinCAT_UnitTestLibrary 2 | 3 | All contributions are welcome: 4 | * Code changes should be submitted via a pull request. 5 | * Please follow the coding style of the existing code: 6 | 1. Use spaces not tabs. This can be configured in Visual Studio under **Tools→Options→TwinCAT→Plc Environment→Text Editor** by unchecking the 'Keep Tabs' checkbox. Tab width should be set to '4' 7 | 2. Do not prefix variable names according to their data type. 8 | 3. Use Separate LineIDs to minimise changes to POUs. This can be configured in Visula Studio under **Tools→Options→TwinCAT→Write Options→Separate LineIDs.** 9 | 10 | * Please report bugs using GitHub Issues 11 | * By contributing, you agree that your contributions will be licensed under the project's MIT License. 12 | 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 RedRockControls 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Pic](https://github.com/RedRockControls/tcl_TwinCAT_UnitTestLibrary/blob/main/img/Banner.JPG) 2 | 3 | # TwinCAT_UnitTestLibrary 4 | 5 | TwinCAT_UnitTestLibrary is a lightweight unit test library for testing TwinCAT3 source code - 6 | See [A TwinCAT Unit Test Library](https://www.redrockcontrols.co.uk/?p=809) 7 | 8 | It has been written with the following goals in mind: 9 | 10 | 1. Minimum setup cost for a new test - a test is defined in a function block that extends T_UnitTestBase by implementing the RunTest method. Assertion methods are used to determine the correctness of the test and to output messages to the error window should they fail 11 | 12 | 2. Tests are run automatically on online-change to provide fast feedback during test-driven development. 13 | 14 | 3. Tests can be re-run by writing to the Retest flag 15 | 16 | 17 | To create a test: 18 | 19 | * Create a function block that inherits from T_UnitTestBase 20 | * Add a RunTest method to perform the required test using assertion methods to verify correct operation 21 | * Execute the unit test somewhere 22 | 23 | The following is a recommended template for the RunTest method: 24 | 25 | 26 | ``` 27 | METHOD RunTest 28 | IF Retest THEN 29 | SUPER^.Init(); // this will clear the TestCompleted flag, causing the test to be executed again... 30 | END_IF 31 | 32 | IF TestCompleted THEN 33 | RETURN; // execute no more test code... 34 | END_IF 35 | 36 | // Actual test code - for example: 37 | CRC := F_CalculateCrc('Some Text'); 38 | AssertEquals_BYTE(Expected:= 16#3F, Actual:= CRC, Message:= 'Calculated CRC is incorrect'); 39 | TestCompleted := TRUE; 40 | ``` 41 | 42 | 43 | Code automatically formatted using 44 | 45 | ![StweepLogo](https://github.com/RedRockControls/tcl_TwinCAT_UnitTestLibrary/assets/32986382/2181db31-3c1e-449d-b568-c7b0ed50b36d) 46 | 47 | 48 | -------------------------------------------------------------------------------- /img/Banner.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedRockControls/tcl_TwinCAT_UnitTestLibrary/2d1e38536f152547420e99acf75ebc0d881b1ea6/img/Banner.JPG -------------------------------------------------------------------------------- /tcl_UnitTestLibrary.library: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedRockControls/tcl_TwinCAT_UnitTestLibrary/2d1e38536f152547420e99acf75ebc0d881b1ea6/tcl_UnitTestLibrary.library -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.757 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{B1E792BE-AA5F-4E3C-8C82-674BF9C0715B}") = "tcl_UnitTestLibrary", "tcl_UnitTestLibrary\tcl_UnitTestLibrary.tsproj", "{9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|TwinCAT CE7 (ARMV7) = Debug|TwinCAT CE7 (ARMV7) 11 | Debug|TwinCAT OS (ARMT2) = Debug|TwinCAT OS (ARMT2) 12 | Debug|TwinCAT RT (x64) = Debug|TwinCAT RT (x64) 13 | Debug|TwinCAT RT (x86) = Debug|TwinCAT RT (x86) 14 | Release|TwinCAT CE7 (ARMV7) = Release|TwinCAT CE7 (ARMV7) 15 | Release|TwinCAT OS (ARMT2) = Release|TwinCAT OS (ARMT2) 16 | Release|TwinCAT RT (x64) = Release|TwinCAT RT (x64) 17 | Release|TwinCAT RT (x86) = Release|TwinCAT RT (x86) 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Debug|TwinCAT CE7 (ARMV7).ActiveCfg = Debug|TwinCAT CE7 (ARMV7) 21 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Debug|TwinCAT CE7 (ARMV7).Build.0 = Debug|TwinCAT CE7 (ARMV7) 22 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Debug|TwinCAT OS (ARMT2).ActiveCfg = Debug|TwinCAT OS (ARMT2) 23 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Debug|TwinCAT OS (ARMT2).Build.0 = Debug|TwinCAT OS (ARMT2) 24 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Debug|TwinCAT RT (x64).ActiveCfg = Debug|TwinCAT RT (x64) 25 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Debug|TwinCAT RT (x64).Build.0 = Debug|TwinCAT RT (x64) 26 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Debug|TwinCAT RT (x86).ActiveCfg = Debug|TwinCAT RT (x86) 27 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Debug|TwinCAT RT (x86).Build.0 = Debug|TwinCAT RT (x86) 28 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Release|TwinCAT CE7 (ARMV7).ActiveCfg = Release|TwinCAT CE7 (ARMV7) 29 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Release|TwinCAT CE7 (ARMV7).Build.0 = Release|TwinCAT CE7 (ARMV7) 30 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Release|TwinCAT OS (ARMT2).ActiveCfg = Release|TwinCAT OS (ARMT2) 31 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Release|TwinCAT OS (ARMT2).Build.0 = Release|TwinCAT OS (ARMT2) 32 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Release|TwinCAT RT (x64).ActiveCfg = Release|TwinCAT RT (x64) 33 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Release|TwinCAT RT (x64).Build.0 = Release|TwinCAT RT (x64) 34 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Release|TwinCAT RT (x86).ActiveCfg = Release|TwinCAT RT (x86) 35 | {9BD4BDFF-636C-4050-B9FD-A19D7CCB6398}.Release|TwinCAT RT (x86).Build.0 = Release|TwinCAT RT (x86) 36 | {75084952-274E-476C-B561-408E43820B7F}.Debug|TwinCAT CE7 (ARMV7).ActiveCfg = Debug|TwinCAT CE7 (ARMV7) 37 | {75084952-274E-476C-B561-408E43820B7F}.Debug|TwinCAT CE7 (ARMV7).Build.0 = Debug|TwinCAT CE7 (ARMV7) 38 | {75084952-274E-476C-B561-408E43820B7F}.Debug|TwinCAT OS (ARMT2).ActiveCfg = Debug|TwinCAT OS (ARMT2) 39 | {75084952-274E-476C-B561-408E43820B7F}.Debug|TwinCAT OS (ARMT2).Build.0 = Debug|TwinCAT OS (ARMT2) 40 | {75084952-274E-476C-B561-408E43820B7F}.Debug|TwinCAT RT (x64).ActiveCfg = Debug|TwinCAT RT (x64) 41 | {75084952-274E-476C-B561-408E43820B7F}.Debug|TwinCAT RT (x64).Build.0 = Debug|TwinCAT RT (x64) 42 | {75084952-274E-476C-B561-408E43820B7F}.Debug|TwinCAT RT (x86).ActiveCfg = Debug|TwinCAT RT (x86) 43 | {75084952-274E-476C-B561-408E43820B7F}.Debug|TwinCAT RT (x86).Build.0 = Debug|TwinCAT RT (x86) 44 | {75084952-274E-476C-B561-408E43820B7F}.Release|TwinCAT CE7 (ARMV7).ActiveCfg = Release|TwinCAT CE7 (ARMV7) 45 | {75084952-274E-476C-B561-408E43820B7F}.Release|TwinCAT CE7 (ARMV7).Build.0 = Release|TwinCAT CE7 (ARMV7) 46 | {75084952-274E-476C-B561-408E43820B7F}.Release|TwinCAT OS (ARMT2).ActiveCfg = Release|TwinCAT OS (ARMT2) 47 | {75084952-274E-476C-B561-408E43820B7F}.Release|TwinCAT OS (ARMT2).Build.0 = Release|TwinCAT OS (ARMT2) 48 | {75084952-274E-476C-B561-408E43820B7F}.Release|TwinCAT RT (x64).ActiveCfg = Release|TwinCAT RT (x64) 49 | {75084952-274E-476C-B561-408E43820B7F}.Release|TwinCAT RT (x64).Build.0 = Release|TwinCAT RT (x64) 50 | {75084952-274E-476C-B561-408E43820B7F}.Release|TwinCAT RT (x86).ActiveCfg = Release|TwinCAT RT (x86) 51 | {75084952-274E-476C-B561-408E43820B7F}.Release|TwinCAT RT (x86).Build.0 = Release|TwinCAT RT (x86) 52 | EndGlobalSection 53 | GlobalSection(SolutionProperties) = preSolution 54 | HideSolutionNode = FALSE 55 | EndGlobalSection 56 | GlobalSection(ExtensibilityGlobals) = postSolution 57 | SolutionGuid = {E986ABF5-1CFF-402B-BC06-44C990347F18} 58 | EndGlobalSection 59 | EndGlobal 60 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/_Config/PLC/tcl_UnitTestLibrary.xti: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | tcl_UnitTestLibrary Instance 6 | {08500001-0000-0000-F000-000000000064} 7 | 8 | 9 | 1 10 | Default 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary.tsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UnitTestEvents 6 | 7 | 8 | AssertionFailed 9 | 10 | Error 11 | 12 | 13 | TestPassed 14 | 15 | Info 16 | 17 | 18 | TestFailed 19 | 20 | Error 21 | 22 | 23 | TestRunComplete 24 | 25 | Info 26 | 27 | 28 | TestRunStarting 29 | 30 | Info 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | PlcTask 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/Functions/F_LogError.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 12 | 13 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/Functions/F_LogMessage.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 12 | 13 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/Globals.TcGVL: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/Images/BlueRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedRockControls/tcl_TwinCAT_UnitTestLibrary/2d1e38536f152547420e99acf75ebc0d881b1ea6/tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/Images/BlueRight.png -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/Images/Failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedRockControls/tcl_TwinCAT_UnitTestLibrary/2d1e38536f152547420e99acf75ebc0d881b1ea6/tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/Images/Failed.png -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/Images/Passed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedRockControls/tcl_TwinCAT_UnitTestLibrary/2d1e38536f152547420e99acf75ebc0d881b1ea6/tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/Images/Passed.png -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/String Utils/FormatString1.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 14 | 15 | , 27 | nErrId =>, 28 | sOut => FormatString1); 29 | ]]> 30 | 31 | 32 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/String Utils/FormatString2.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 15 | 16 | , 28 | nErrId =>, 29 | sOut => FormatString2); 30 | ]]> 31 | 32 | 33 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/String Utils/FormatString3.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 16 | 17 | , 29 | nErrId =>, 30 | sOut => FormatString3); 31 | ]]> 32 | 33 | 34 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/String Utils/FormatStringEx1.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 14 | 15 | , 28 | nErrId =>, 29 | sOut => FormatStringEx1); 30 | ]]> 31 | 32 | 33 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/String Utils/FormatStringEx2.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 15 | 16 | , 28 | nErrId =>, 29 | sOut => FormatStringEx2); 30 | ]]> 31 | 32 | 33 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/String Utils/StringSplitter.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 0 THEN // delimitter found 52 | 53 | // extract next sub-string 54 | GetNext := LEFT(SubjectString,NextDelimiterPosition - 1); 55 | 56 | // remove sub-string from subject string 57 | RemainingLength := LEN(SubjectString) - NextDelimiterPosition - LEN(Delimiter) + 1; 58 | SubjectString := RIGHT(SubjectString,RemainingLength); 59 | 60 | // // strip any delimitters from front of remaining string 61 | // WHILE FIND(SubjectString,Delimiter1) = 1 DO 62 | // SubjectString := RIGHT(SubjectString,LEN(SubjectString) - LEN(Delimiter1)); 63 | // END_WHILE 64 | // WHILE FIND(SubjectString,Delimiter2) = 1 DO 65 | // SubjectString := RIGHT(SubjectString,LEN(SubjectString) - LEN(Delimiter2)); 66 | // END_WHILE 67 | ELSE 68 | GetNext := SubjectString; // return what is left 69 | SubjectString := ''; 70 | END_IF]]> 71 | 72 | 73 | 74 | 76 | 77 | 80 | 81 | 82 | 83 | 87 | 88 | ''; 89 | ]]> 90 | 91 | 92 | 93 | 100 | 101 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | "White" 114 | false 115 | 116 | 117 | 118 | System.Boolean 119 | {bb741845-1ec5-4be9-bb0d-2cf7058af574} 120 | System.String 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/Unit Test/T_UnitTestBase.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 39 | 40 | Actual.TypeClass THEN 45 | F_LogError(TestName, FormatStringEx1('Assertion Failed - %s', Message)); 46 | TestFailed := TRUE; 47 | TestCompleted := TRUE; 48 | RETURN; 49 | 50 | ELSIF Expected.diSize <> Actual.diSize THEN 51 | F_LogError(TestName, FormatStringEx1('Assertion Failed - %s', Message)); 52 | TestFailed := TRUE; 53 | TestCompleted := TRUE; 54 | RETURN; 55 | 56 | ELSIF ComparisonResult <> 0 THEN 57 | F_LogError(TestName, FormatStringEx1('Assertion Failed - %s', Message)); 58 | TestFailed := TRUE; 59 | TestCompleted := TRUE; 60 | RETURN; 61 | END_IF 62 | 63 | AssertEquals_ANY := TRUE; 64 | ]]> 65 | 66 | 67 | 68 | 79 | 80 | Actual THEN 81 | ExpectedAsString := BOOL_TO_STRING(Expected); 82 | ActualAsString := BOOL_TO_STRING(Actual); 83 | F_LogError(TestName, 84 | FormatString3('%s: expected=%s, actual=%s', 85 | F_STRING(Message), 86 | F_STRINGEX(ExpectedAsString), 87 | F_STRINGEX(ActualAsString))); 88 | TestFailed := TRUE; 89 | TestCompleted := TRUE; 90 | RETURN; 91 | END_IF 92 | 93 | AssertEquals_BOOL := TRUE; 94 | ]]> 95 | 96 | 97 | 98 | 105 | 106 | Actual THEN 107 | F_LogError(TestName, 108 | FormatString3('%s: expected=0x%.2X, actual=0x%.2X', 109 | F_STRING(Message), 110 | F_BYTE(Expected), 111 | F_BYTE(Actual))); 112 | TestFailed := TRUE; 113 | TestCompleted := TRUE; 114 | RETURN; 115 | END_IF 116 | 117 | AssertEquals_BYTE := TRUE; 118 | ]]> 119 | 120 | 121 | 122 | 129 | 130 | Actual THEN 131 | F_LogError(TestName, 132 | FormatString3('%s: expected=%d, actual=%d', 133 | F_STRING(Message), 134 | F_DINT(Expected), 135 | F_DINT(Actual))); 136 | TestFailed := TRUE; 137 | TestCompleted := TRUE; 138 | RETURN; 139 | END_IF 140 | 141 | AssertEquals_DINT := TRUE; 142 | ]]> 143 | 144 | 145 | 146 | 153 | 154 | Actual THEN 155 | F_LogError(TestName, 156 | FormatString3('%s: expected=%d, actual=%d', 157 | F_STRING(Message), 158 | F_INT(Expected), 159 | F_INT(Actual))); 160 | TestFailed := TRUE; 161 | TestCompleted := TRUE; 162 | RETURN; 163 | END_IF 164 | 165 | AssertEquals_INT := TRUE; 166 | ]]> 167 | 168 | 169 | 170 | 177 | 178 | Actual THEN 179 | F_LogError(TestName, 180 | FormatString3('%s: expected=%d, actual=%d', 181 | F_STRING(Message), 182 | F_LINT(Expected), 183 | F_LINT(Actual))); 184 | TestFailed := TRUE; 185 | TestCompleted := TRUE; 186 | RETURN; 187 | END_IF 188 | 189 | AssertEquals_LINT := TRUE; 190 | ]]> 191 | 192 | 193 | 194 | 202 | 203 | Delta THEN 204 | F_LogError(TestName, 205 | FormatString3('%s: expected= %.3f, actual= %.3f', 206 | F_STRING(Message), 207 | F_LREAL(Expected), 208 | F_LREAL(Actual))); 209 | TestFailed := TRUE; 210 | TestCompleted := TRUE; 211 | RETURN; 212 | END_IF 213 | 214 | AssertEquals_LREAL := TRUE; 215 | ]]> 216 | 217 | 218 | 219 | 226 | 227 | Actual THEN 228 | F_LogError(TestName, 229 | FormatString3('%s: expected=%d, actual=%d', 230 | F_STRING(Message), 231 | F_PVOID(Expected), 232 | F_PVOID(Actual))); 233 | TestFailed := TRUE; 234 | TestCompleted := TRUE; 235 | RETURN; 236 | END_IF 237 | 238 | AssertEquals_PVOID := TRUE; 239 | ]]> 240 | 241 | 242 | 243 | 251 | 252 | Delta THEN 253 | F_LogError(TestName, 254 | FormatString3('%s: expected=%.3f, actual=%.3f', 255 | F_STRING(Message), 256 | F_REAL(Expected), 257 | F_REAL(Actual))); 258 | TestFailed := TRUE; 259 | TestCompleted := TRUE; 260 | RETURN; 261 | END_IF 262 | 263 | AssertEquals_REAL := TRUE; 264 | ]]> 265 | 266 | 267 | 268 | 275 | 276 | Actual THEN 277 | F_LogError(TestName, 278 | FormatString3('%s: expected=%s, actual=%s', 279 | F_STRING(Message), 280 | F_STRING(Expected), 281 | F_STRING(Actual))); 282 | TestFailed := TRUE; 283 | TestCompleted := TRUE; 284 | RETURN; 285 | END_IF 286 | 287 | AssertEquals_STRING := TRUE; 288 | ]]> 289 | 290 | 291 | 292 | 299 | 300 | Actual THEN 301 | F_LogError(TestName, 302 | FormatString3('%s: expected=%d, actual=%d', 303 | F_STRING(Message), 304 | F_UDINT(Expected), 305 | F_UDINT(Actual))); 306 | TestFailed := TRUE; 307 | TestCompleted := TRUE; 308 | RETURN; 309 | END_IF 310 | 311 | AssertEquals_UDINT := TRUE; 312 | ]]> 313 | 314 | 315 | 316 | 323 | 324 | Actual THEN 325 | F_LogError(TestName, 326 | FormatString3('%s: expected=%d, actual=%d', 327 | F_STRING(Message), 328 | F_UINT(Expected), 329 | F_UINT(Actual))); 330 | TestFailed := TRUE; 331 | TestCompleted := TRUE; 332 | RETURN; 333 | END_IF 334 | 335 | AssertEquals_UINT := TRUE; 336 | ]]> 337 | 338 | 339 | 340 | 347 | 348 | Actual THEN 349 | F_LogError(TestName, 350 | FormatString3('%s: expected=%d, actual=%d', 351 | F_STRING(Message), 352 | F_ULINT(Expected), 353 | F_ULINT(Actual))); 354 | TestFailed := TRUE; 355 | TestCompleted := TRUE; 356 | RETURN; 357 | END_IF 358 | 359 | AssertEquals_ULINT := TRUE; 360 | ]]> 361 | 362 | 363 | 364 | 371 | 372 | Actual THEN 373 | F_LogError(TestName, 374 | FormatString3('%s: expected=%d, actual=%d', 375 | F_STRING(Message), 376 | F_USINT(Expected), 377 | F_USINT(Actual))); 378 | TestFailed := TRUE; 379 | TestCompleted := TRUE; 380 | RETURN; 381 | END_IF 382 | 383 | AssertEquals_USINT := TRUE; 384 | ]]> 385 | 386 | 387 | 388 | 394 | 395 | 406 | 407 | 408 | 409 | 415 | 416 | 427 | 428 | 429 | 430 | 435 | 436 | 440 | 441 | 442 | 443 | 449 | 450 | 451 | 452 | 453 | 454 | 460 | 461 | 480 | 481 | 482 | 483 | 485 | 486 | 489 | 490 | 492 | 493 | 494 | 495 | 496 | 499 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 509 | 510 | 511 | 512 | 513 | 514 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/Version/Global_Version.TcGVL: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 13 | 14 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/_Libraries/beckhoff automation gmbh/tc2_standard/3.3.3.0/tc2_standard.compiled-library: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedRockControls/tcl_TwinCAT_UnitTestLibrary/2d1e38536f152547420e99acf75ebc0d881b1ea6/tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/_Libraries/beckhoff automation gmbh/tc2_standard/3.3.3.0/tc2_standard.compiled-library -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/_Libraries/red rock controls limited/tcl_stringutils/1.1.3.0/tcl_stringutils.library: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedRockControls/tcl_TwinCAT_UnitTestLibrary/2d1e38536f152547420e99acf75ebc0d881b1ea6/tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/_Libraries/red rock controls limited/tcl_stringutils/1.1.3.0/tcl_stringutils.library -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_SimpleUnitTestLibrary.tmcRefac: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | RESET 6 | Reset 7 | Abort 8 | 9 | 10 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary.plcproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.0.0.0 4 | 2.0 5 | {75084952-274e-476c-b561-408e43820b7f} 6 | True 7 | true 8 | true 9 | false 10 | tcl_UnitTestLibrary 11 | 3.1.4023.0 12 | {e40807bb-832f-45b5-97fd-909168ae8314} 13 | {a7e92dba-8355-4c6f-bf3a-45d7b77ebe20} 14 | {3e61b47b-6d10-45f2-84f5-03dae3651578} 15 | {028b744a-fba2-4ad6-9a1a-384ea0117297} 16 | {c39e8777-3f3b-40cc-9943-835de0d8115c} 17 | {88497f9f-773c-45a3-b469-3185dbd00fb4} 18 | false 19 | Red Rock Controls Limited 20 | tcl_UnitTestLibrary 21 | 1.1.3.0 22 | 23 | 24 | {0d08a09c-9493-4b37-a26c-544e7211ff2d} 25 | 1.0.0.0 26 | tcl_ClassLibraries 27 | 28 | 29 | 30 | {0d08a09c-9493-4b37-a26c-544e7211ff2d} 31 | 32 | Roger Christopher 33 | AssertEquals_USINT added 34 | 35 | 36 | 37 | 38 | Code 39 | 40 | 41 | Code 42 | 43 | 44 | Code 45 | true 46 | 47 | 48 | Code 49 | 50 | 51 | Code 52 | 53 | 54 | Code 55 | 56 | 57 | Code 58 | 59 | 60 | Code 61 | 62 | 63 | Code 64 | 65 | 66 | Code 67 | 68 | 69 | Code 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | Tc2_Standard, * (Beckhoff Automation GmbH) 81 | Tc2_Standard 82 | 83 | 84 | Tc2_System, * (Beckhoff Automation GmbH) 85 | Tc2_System 86 | 87 | 88 | Tc2_Utilities, * (Beckhoff Automation GmbH) 89 | Tc2_Utilities 90 | 91 | 92 | Tc3_Module, * (Beckhoff Automation GmbH) 93 | Tc3_Module 94 | 95 | 96 | 97 | 98 | Content 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | "<ProjectRoot>" 107 | 108 | {192FAD59-8248-4824-A8DE-9177C94C195A} 109 | 110 | "{192FAD59-8248-4824-A8DE-9177C94C195A}" 111 | 112 | 113 | 114 | {246001F4-279D-43AC-B241-948EB31120E1} 115 | 116 | "{246001F4-279D-43AC-B241-948EB31120E1}" 117 | 118 | 119 | UnicodeStrings 120 | false 121 | GlobalTextListFilePath 122 | "" 123 | ExtendedSettings 124 | false 125 | GlobalVisuImageFilePath 126 | "%APPLICATIONPATH%\;%APPLICATIONPATH%\" 127 | GeneralPropertySupport 128 | false 129 | 130 | 131 | {29BD8D0C-3586-4548-BB48-497B9A01693F} 132 | 133 | "{29BD8D0C-3586-4548-BB48-497B9A01693F}" 134 | 135 | Rules 136 | 137 | "Rules" 138 | 139 | 167 140 | 141 | "167" 142 | 143 | 144 | bActive 145 | False 146 | 147 | 148 | 4 149 | 150 | "4" 151 | 152 | 153 | bActive 154 | False 155 | 156 | 157 | 33 158 | 159 | "33" 160 | 161 | 162 | bActive 163 | True 164 | 165 | 166 | 6 167 | 168 | "6" 169 | 170 | 171 | bActive 172 | False 173 | 174 | 175 | 27 176 | 177 | "27" 178 | 179 | 180 | bActive 181 | False 182 | 183 | 184 | 28 185 | 186 | "28" 187 | 188 | 189 | bActive 190 | False 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | {8F99A816-E488-41E4-9FA3-846536012284} 200 | 201 | "{8F99A816-E488-41E4-9FA3-846536012284}" 202 | 203 | 204 | 205 | {40450F57-0AA3-4216-96F3-5444ECB29763} 206 | 207 | "{40450F57-0AA3-4216-96F3-5444ECB29763}" 208 | 209 | 210 | ActiveVisuProfile 211 | IR0whWr8bwfwBwAAiD2qpQAAAABVAgAA37x72QAAAAABAAAAAAAAAAEaUwB5AHMAdABlAG0ALgBTAHQAcgBpAG4AZwACTHsAZgA5ADUAYgBiADQAMgA2AC0ANQA1ADIANAAtADQAYgA0ADUALQA5ADQAMAAwAC0AZgBiADAAZgAyAGUAN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zQAAEtF9AAHy0t0C4vGgPQMAutAQAAANAxC60XAAAA0DIarQDQMy8aA9AwC60CAAAA0DELrQMAAADQMhqtANA0Gq0A0DUarQA= 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | System.Boolean 220 | System.Collections.Hashtable 221 | {54dd0eac-a6d8-46f2-8c27-2f43c7e49861} 222 | System.String 223 | 224 | 225 | 226 | 227 | -------------------------------------------------------------------------------- /tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary/tcl_UnitTestLibrary.tmc: -------------------------------------------------------------------------------- 1 | ST_LibVersion288iMajorUINT160iMinorUINT1616iBuildUINT1632iRevisionUINT1648nFlagsDWORD3264sVersionSTRING(23)19296EPlcPersistentStatus8USINT012PlcAppSystemInfo2048ObjIdOTCID320TaskCntUDINT3232OnlineChangeCntUDINT3264FlagsDWORD3296AdsPortUINT16128BootDataLoadedBOOL8144OldBootDataBOOL8152AppTimestampDT32160KeepOutputsOnBPBOOL8192ShutdownInProgressBOOL8200LicensesPendingBOOL8208BSODOccuredBOOL8216LoggedInBOOL8224PersistentStatusEPlcPersistentStatus8232TComSrvPtrITComObjectServer32256TcComInterfaceAppNameSTRING(63)512512ProjectNameSTRING(63)5121024PlcTaskSystemInfo1024ObjIdOTCID320CycleTimeUDINT3232PriorityUINT1664AdsPortUINT1680CycleCountUDINT3296DcTaskTimeLINT64128LastExecTimeUDINT32192FirstCycleBOOL8224CycleTimeExceededBOOL8232InCallAfterOutputUpdateBOOL8240RTViolationBOOL8248TaskNameSTRING(63)512512tcl_UnitTestLibrary{08500001-0000-0000-F000-000000000064}ApplicationNamePort_851ChangeDate2024-07-23T09:30:22GeneratedCodeSize49152GlobalDataSize16384 --------------------------------------------------------------------------------