Skip to content

Commit

Permalink
Removed library namespaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
sagatowski committed Jun 24, 2023
1 parent d054c44 commit f337232
Show file tree
Hide file tree
Showing 34 changed files with 781 additions and 782 deletions.
4 changes: 2 additions & 2 deletions TcUnit/TcUnit/DUTs/ST_AdsLogStringMessage.TcDUT
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
TYPE ST_AdsLogStringMessage :
STRUCT
MsgCtrlMask : DWORD;
MsgFmtStr : Tc2_System.T_MaxString;
StrArg : Tc2_System.T_MaxString;
MsgFmtStr : T_MaxString;
StrArg : T_MaxString;
END_STRUCT
END_TYPE]]></Declaration>
</DUT>
Expand Down
4 changes: 2 additions & 2 deletions TcUnit/TcUnit/DUTs/ST_AssertArrayResult.TcDUT
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ STRUCT
ExpectedsTypeClass : IBaseLibrary.TypeClass; // The data type of the expecteds-array
ActualsSize : UDINT; // Size in bytes of the actuals-array
ActualsTypeClass : IBaseLibrary.TypeClass; // The data type of the actuals-array
Message : Tc2_System.T_MaxString;
TestInstancePath : Tc2_System.T_MaxString;
Message : T_MaxString;
TestInstancePath : T_MaxString;
END_STRUCT
END_TYPE]]></Declaration>
</DUT>
Expand Down
4 changes: 2 additions & 2 deletions TcUnit/TcUnit/DUTs/ST_AssertResult.TcDUT
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
STRUCT
Expected : U_ExpectedOrActual;
Actual : U_ExpectedOrActual;
Message : Tc2_System.T_MaxString;
TestInstancePath : Tc2_System.T_MaxString;
Message : T_MaxString;
TestInstancePath : T_MaxString;
END_STRUCT
END_TYPE]]></Declaration>
</DUT>
Expand Down
6 changes: 3 additions & 3 deletions TcUnit/TcUnit/DUTs/ST_TestCaseResult.TcDUT
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<DUT Name="ST_TestCaseResult" Id="{9c511c0b-2edf-4938-bd37-33f5b59a1386}">
<Declaration><![CDATA[TYPE ST_TestCaseResult :
STRUCT
TestName : Tc2_System.T_MaxString;
TestClassName : Tc2_System.T_MaxString;
TestName : T_MaxString;
TestClassName : T_MaxString;
TestIsFailed : BOOL;
TestIsSkipped : BOOL;
FailureMessage : Tc2_System.T_MaxString;
FailureMessage : T_MaxString;
FailureType : E_AssertionType;
NumberOfAsserts : UINT;
Duration : LREAL; // in seconds
Expand Down
2 changes: 1 addition & 1 deletion TcUnit/TcUnit/DUTs/ST_TestSuiteResult.TcDUT
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<DUT Name="ST_TestSuiteResult" Id="{46edf1c4-cab0-428e-8570-28c096b4eecf}">
<Declaration><![CDATA[TYPE ST_TestSuiteResult :
STRUCT
Name : Tc2_System.T_MaxString; // Full class name
Name : T_MaxString; // Full class name
Identity : UINT(0..GVL_Param_TcUnit.MaxNumberOfTestSuites); // Should be 0..GVL_Param_TcUnit.MaxNumberOfTestSuites-1 but gives unknown compiler error
NumberOfTests : UINT(0..GVL_Param_TcUnit.MaxNumberOfTestsForEachTestSuite);
NumberOfFailedTests : UINT(0..GVL_Param_TcUnit.MaxNumberOfTestsForEachTestSuite);
Expand Down
2 changes: 1 addition & 1 deletion TcUnit/TcUnit/DUTs/U_ExpectedOrActual.TcDUT
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ UNION
byteExpectedOrActual : BYTE;
dwordExpectedOrActual : DWORD;
lwordExpectedOrActual : LWORD;
stringExpectedOrActual : Tc2_System.T_MaxString;
stringExpectedOrActual : T_MaxString;
udintExpectedOrActual : UDINT;
uintExpectedOrActual : UINT;
usintExpectedOrActual : USINT;
Expand Down
2 changes: 1 addition & 1 deletion TcUnit/TcUnit/GVLs/GVL_Param_TcUnit.TcGVL
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ VAR_GLOBAL CONSTANT
xUnitBufferSize : UDINT := 65535;
(* Default path and filename for the xunit testresults e.g.: for use with jenkins *)
xUnitFilePath : Tc2_System.T_MaxString := 'C:\tcunit_xunit_testresults.xml';
xUnitFilePath : T_MaxString := 'C:\tcunit_xunit_testresults.xml';
(* This is the maximum number of ADS-messages that can be stored for reporting at the same time.
Having a size of 2000 means that it's possible to report up to ~400 test cases in one single
Expand Down
4 changes: 2 additions & 2 deletions TcUnit/TcUnit/GVLs/GVL_TcUnit.TcGVL
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ VAR_GLOBAL
CurrentTestSuiteBeingCalled : POINTER TO FB_TestSuite;
(* Current name of test being called *)
CurrentTestNameBeingCalled : Tc2_System.T_MaxString;
CurrentTestNameBeingCalled : T_MaxString;
(* Used to get the current cpu cycle counter to calculate the duration of tests and test suits, respectively *)
GetCpuCounter : Tc2_System.GETCPUCOUNTER;
GetCpuCounter : GETCPUCOUNTER;
(* Stores the CPU cycle count with 100ns precision since the first entry into one of the Run methods (RUN, RUN_IN_SEQUENCE) *)
StartedAt : LWORD;
Expand Down
8 changes: 4 additions & 4 deletions TcUnit/TcUnit/ITFs/I_AssertMessageFormatter.TcIO
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<Method Name="LogAssertFailure" Id="{35efab01-6ac8-46a5-a5e1-adb4f1f5f9b2}">
<Declaration><![CDATA[METHOD LogAssertFailure
VAR_INPUT
Expected : Tc2_System.T_MaxString;
Actual : Tc2_System.T_MaxString;
Message : Tc2_System.T_MaxString;
TestInstancePath : Tc2_System.T_MaxString;
Expected : T_MaxString;
Actual : T_MaxString;
Message : T_MaxString;
TestInstancePath : T_MaxString;
END_VAR]]></Declaration>
</Method>
</Itf>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
*)
FUNCTION_BLOCK FB_AdjustAssertFailureMessageToMax253CharLength
VAR_INPUT
MsgFmtString : Tc2_System.T_MaxString; // Test instance path
StringArg : Tc2_System.T_MaxString; // Test message
MsgFmtString : T_MaxString; // Test instance path
StringArg : T_MaxString; // Test message
END_VAR
VAR_OUTPUT
MsgFmtStringProcessed : Tc2_System.T_MaxString;
StringArgProcessed : Tc2_System.T_MaxString;
MsgFmtStringProcessed : T_MaxString;
StringArgProcessed : T_MaxString;
END_VAR
VAR
MsgFmtStringTemp : Tc2_System.T_MaxString;
MsgFmtStringTemp : T_MaxString;
TestNameTooLong : STRING := '...TestName too long';
TestMsgTooLong : STRING := '...TestMsg too long';
END_VAR
Expand All @@ -26,24 +26,24 @@ END_VAR]]></Declaration>
<ST><![CDATA[// Check if any of the two strings are too long (or the combination of them)
// All OK
IF (Tc2_Standard.LEN(STR := MsgFmtString) + LEN(STR := StringArg)) <= MSG_FMT_STRING_MAX_NUMBER_OF_CHARACTERS THEN
IF (LEN(STR := MsgFmtString) + LEN(STR := StringArg)) <= MSG_FMT_STRING_MAX_NUMBER_OF_CHARACTERS THEN
MsgFmtStringProcessed := MsgFmtString;
StringArgProcessed := StringArg;
// If test instance path is longer than 253 chars, shorten it down to 253 characters and additionally with the length of the '...TestName too long'. Add the text '...TestName too long' to the test instance path. Leave no characters for the message.
ELSIF Tc2_Standard.LEN(STR := MsgFmtString) > MSG_FMT_STRING_MAX_NUMBER_OF_CHARACTERS THEN
MsgFmtStringTemp := Tc2_Standard.LEFT(STR := MsgFmtString, SIZE := (MSG_FMT_STRING_MAX_NUMBER_OF_CHARACTERS - Tc2_Standard.LEN(STR := TestNameTooLong)));
MsgFmtStringProcessed := Tc2_Standard.CONCAT(STR1 := MsgFmtStringTemp, STR2 := TestNameTooLong);
ELSIF LEN(STR := MsgFmtString) > MSG_FMT_STRING_MAX_NUMBER_OF_CHARACTERS THEN
MsgFmtStringTemp := LEFT(STR := MsgFmtString, SIZE := (MSG_FMT_STRING_MAX_NUMBER_OF_CHARACTERS - LEN(STR := TestNameTooLong)));
MsgFmtStringProcessed := CONCAT(STR1 := MsgFmtStringTemp, STR2 := TestNameTooLong);
StringArgProcessed := '';
// If test message is too long (so we cant fit the text "...TestMsg too long" to the end of it) , shorten it (so that we can fit the text)
ELSIF (MSG_FMT_STRING_MAX_NUMBER_OF_CHARACTERS - Tc2_Standard.LEN(STR := TestMsgTooLong)) >= Tc2_Standard.LEN(STR := MsgFmtString) THEN
ELSIF (MSG_FMT_STRING_MAX_NUMBER_OF_CHARACTERS - LEN(STR := TestMsgTooLong)) >= LEN(STR := MsgFmtString) THEN
MsgFmtStringProcessed := MsgFmtString;
StringArgProcessed := Tc2_Standard.LEFT(STR := StringArg,
SIZE := (MSG_FMT_STRING_MAX_NUMBER_OF_CHARACTERS - Tc2_Standard.LEN(STR := TestMsgTooLong) - Tc2_Standard.LEN(STR := MsgFmtStringProcessed)));
StringArgProcessed := Tc2_Standard.CONCAT(STR1 := StringArgProcessed, STR2 := TestMsgTooLong);
StringArgProcessed := LEFT(STR := StringArg,
SIZE := (MSG_FMT_STRING_MAX_NUMBER_OF_CHARACTERS - LEN(STR := TestMsgTooLong) - LEN(STR := MsgFmtStringProcessed)));
StringArgProcessed := CONCAT(STR1 := StringArgProcessed, STR2 := TestMsgTooLong);
// If test instance path is too long (length is between 233 and 253 characters long), shorten it and add the text '...TestName too long'. Leave no characters for the message
ELSE
MsgFmtStringTemp := Tc2_Standard.LEFT(STR := MsgFmtString, SIZE := (MSG_FMT_STRING_MAX_NUMBER_OF_CHARACTERS - Tc2_Standard.LEN(STR := TestNameTooLong)));
MsgFmtStringProcessed := Tc2_Standard.CONCAT(STR1 := MsgFmtStringTemp, STR2 := TestNameTooLong);
MsgFmtStringTemp := LEFT(STR := MsgFmtString, SIZE := (MSG_FMT_STRING_MAX_NUMBER_OF_CHARACTERS - LEN(STR := TestNameTooLong)));
MsgFmtStringProcessed := CONCAT(STR1 := MsgFmtStringTemp, STR2 := TestNameTooLong);
StringArgProcessed := '';
END_IF]]></ST>
</Implementation>
Expand Down
38 changes: 19 additions & 19 deletions TcUnit/TcUnit/POUs/FB_AdsAssertMessageFormatter.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,42 @@ FUNCTION_BLOCK FB_AdsAssertMessageFormatter IMPLEMENTS I_AssertMessageFormatter]
<Method Name="LogAssertFailure" Id="{48cbc6b0-5380-44b8-a045-57b6ad9f189d}">
<Declaration><![CDATA[METHOD PUBLIC LogAssertFailure
VAR_INPUT
Expected : Tc2_System.T_MaxString;
Actual : Tc2_System.T_MaxString;
Message : Tc2_System.T_MaxString;
TestInstancePath : Tc2_System.T_MaxString;
Expected : T_MaxString;
Actual : T_MaxString;
Message : T_MaxString;
TestInstancePath : T_MaxString;
END_VAR
VAR
AdjustAssertFailureMessageToMax253CharLength : FB_AdjustAssertFailureMessageToMax253CharLength;
TestInstancePathCleaned : Tc2_System.T_MaxString;
TestInstancePathFinal : Tc2_System.T_MaxString;
TestInstancePathCleaned : T_MaxString;
TestInstancePathFinal : T_MaxString;
ReturnValue : DINT;
TestInstancePathProcessed : Tc2_System.T_MaxString;
MessageProcessed : Tc2_System.T_MaxString;
TestInstancePathProcessed : T_MaxString;
MessageProcessed : T_MaxString;
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[TestInstancePathCleaned := F_RemoveInstancePathAndProjectNameFromTestInstancePath(TestInstancePath);
TestInstancePathFinal := Tc2_Standard.CONCAT(STR1 := 'FAILED TEST $'', STR2 := TestInstancePathCleaned);
TestInstancePathFinal := Tc2_Standard.CONCAT(STR1 := TestInstancePathFinal, STR2 := '$'');
TestInstancePathFinal := CONCAT(STR1 := 'FAILED TEST $'', STR2 := TestInstancePathCleaned);
TestInstancePathFinal := CONCAT(STR1 := TestInstancePathFinal, STR2 := '$'');
IF Tc2_Standard.LEN(STR := Expected) > 0 THEN
TestInstancePathFinal := Tc2_Standard.CONCAT(STR1 := TestInstancePathFinal, STR2 := ', EXP: ');
TestInstancePathFinal := Tc2_Standard.CONCAT(STR1 := TestInstancePathFinal, STR2 := Expected);
IF LEN(STR := Expected) > 0 THEN
TestInstancePathFinal := CONCAT(STR1 := TestInstancePathFinal, STR2 := ', EXP: ');
TestInstancePathFinal := CONCAT(STR1 := TestInstancePathFinal, STR2 := Expected);
END_IF
IF Tc2_Standard.LEN(STR := Actual) > 0 THEN
TestInstancePathFinal := Tc2_Standard.CONCAT(STR1 := TestInstancePathFinal, STR2 := ', ACT: ');
TestInstancePathFinal := Tc2_Standard.CONCAT(STR1 := TestInstancePathFinal, STR2 := Actual);
IF LEN(STR := Actual) > 0 THEN
TestInstancePathFinal := CONCAT(STR1 := TestInstancePathFinal, STR2 := ', ACT: ');
TestInstancePathFinal := CONCAT(STR1 := TestInstancePathFinal, STR2 := Actual);
END_IF
IF Tc2_Standard.LEN(STR := Message) > 0 THEN
TestInstancePathFinal := Tc2_Standard.CONCAT(STR1 := TestInstancePathFinal, STR2 := ', MSG: %s');
IF LEN(STR := Message) > 0 THEN
TestInstancePathFinal := CONCAT(STR1 := TestInstancePathFinal, STR2 := ', MSG: %s');
END_IF
AdjustAssertFailureMessageToMax253CharLength(MsgFmtString := TestInstancePathFinal,
StringArg := Message,
MsgFmtStringProcessed => TestInstancePathProcessed,
StringArgProcessed => MessageProcessed);
GVL_TcUnit.AdsMessageQueue.WriteLog(MsgCtrlMask := Tc2_System.ADSLOG_MSGTYPE_ERROR,
GVL_TcUnit.AdsMessageQueue.WriteLog(MsgCtrlMask := ADSLOG_MSGTYPE_ERROR,
MsgFmtStr := TestInstancePathProcessed,
StrArg := MessageProcessed);]]></ST>
</Implementation>
Expand Down
12 changes: 6 additions & 6 deletions TcUnit/TcUnit/POUs/FB_AdsLogStringMessageFifoQueue.TcPOU
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
FUNCTION_BLOCK FB_AdsLogStringMessageFifoQueue
VAR
ArrayBuffer : ARRAY[0..((GVL_Param_TcUnit.AdsLogMessageFifoRingBufferSize * (SIZEOF(ST_ADSLogStringMessage) + MEM_RING_BUFFER_INTERNAL_USE_PER_DATA_RECORD)) - 1)] OF BYTE;
MemRingBuffer : Tc2_Utilities.FB_MemRingBuffer;
TimerBetweenMessages : Tc2_Standard.TON := (IN := TRUE, PT := TIME_BETWEEN_MESSAGES);
MemRingBuffer : FB_MemRingBuffer;
TimerBetweenMessages : TON := (IN := TRUE, PT := TIME_BETWEEN_MESSAGES);
END_VAR
VAR CONSTANT
MEM_RING_BUFFER_INTERNAL_USE_PER_DATA_RECORD : USINT := 4;
Expand All @@ -28,7 +28,7 @@ IF GetLogCount() > 0 THEN
GetAndRemoveLogFromQueue(AdsLogStringMessage => MessageToBeSent,
Error => ErrorGet);
IF NOT ErrorGet THEN
ReturnValue := Tc2_System.ADSLOGSTR(msgCtrlMask := MessageToBeSent.MsgCtrlMask,
ReturnValue := ADSLOGSTR(msgCtrlMask := MessageToBeSent.MsgCtrlMask,
msgFmtStr := MessageToBeSent.MsgFmtStr,
strArg := MessageToBeSent.StrArg);
END_IF
Expand Down Expand Up @@ -63,8 +63,8 @@ Error := NOT MemRingBuffer.bOk;]]></ST>
METHOD INTERNAL WriteLog
VAR_INPUT
MsgCtrlMask : DWORD;
MsgFmtStr : Tc2_System.T_MaxString;
StrArg : Tc2_System.T_MaxString;
MsgFmtStr : T_MaxString;
StrArg : T_MaxString;
END_VAR
VAR_OUTPUT
Error : BOOL; // Buffer overflow
Expand All @@ -74,7 +74,7 @@ VAR
END_VAR]]></Declaration>
<Implementation>
<ST><![CDATA[(* Only log message types of ERROR if log extended results is not enabled *)
IF MsgCtrlMask = Tc2_System.ADSLOG_MSGTYPE_ERROR OR GVL_Param_TcUnit.LogExtendedResults THEN
IF MsgCtrlMask = ADSLOG_MSGTYPE_ERROR OR GVL_Param_TcUnit.LogExtendedResults THEN
AdsLogStringMessage.MsgCtrlMask := MsgCtrlMask;
AdsLogStringMessage.MsgFmtStr := MsgFmtStr;
AdsLogStringMessage.StrArg := StrArg;
Expand Down
Loading

0 comments on commit f337232

Please sign in to comment.