FB_AdsAssertMessageFormatter Function Block
Implements I_AssertMessageFormatter
This function block is responsible for printing the results of the assertions using the built-in ADSLOGSTR functionality provided by the Tc2_System library. This sends the result using ADS, which is consumed by the error list of Visual Studio.
Methods
LogAssertFailure
PUBLIC
Parameters
| Name | Type | Description |
|---|---|---|
Expected |
T_MaxString | |
Actual |
T_MaxString | |
Message |
T_MaxString | |
TestInstancePath |
T_MaxString |
Implementation
TestInstancePathCleaned := F_RemoveInstancePathAndProjectNameFromTestInstancePath(TestInstancePath);
TestInstancePathFinal := CONCAT(STR1 := 'FAILED TEST $'',
STR2 := TestInstancePathCleaned);
TestInstancePathFinal := CONCAT(STR1 := TestInstancePathFinal,
STR2 := '$'');
TestInstancePathFinal := CONCAT(STR1 := TestInstancePathFinal,
STR2 := ', EXP: ');
TestInstancePathFinal := CONCAT(STR1 := TestInstancePathFinal,
STR2 := Expected);
TestInstancePathFinal := CONCAT(STR1 := TestInstancePathFinal,
STR2 := ', ACT: ');
TestInstancePathFinal := CONCAT(STR1 := TestInstancePathFinal,
STR2 := Actual);
IF LEN(STR := Message) > 0 THEN
TestInstancePathFinal := CONCAT(STR1 := TestInstancePathFinal,
STR2 := ', MSG: %s');
END_IF
AdjustAssertFailureMessageToMax253CharLength(TestInstancePath := TestInstancePathFinal,
TestMessage := Message,
TestInstancePathProcessed => TestInstancePathProcessed,
TestMessageProcessed => MessageProcessed);
GVL_TcUnit.AdsMessageQueue.WriteLog(MsgCtrlMask := ADSLOG_MSGTYPE_ERROR,
MsgFmtStr := TestInstancePathProcessed,
StrArg := MessageProcessed);
Used by
Declaration source
(*
This function block is responsible for printing the results of the assertions using the built-in
ADSLOGSTR functionality provided by the Tc2_System library. This sends the result using ADS, which
is consumed by the error list of Visual Studio.
*)
FUNCTION_BLOCK FB_AdsAssertMessageFormatter IMPLEMENTS I_AssertMessageFormatter