FB_AdjustAssertFailureMessageToMax253CharLength Function Block

This function block is responsible for making sure that the asserted test instance path and test message are not loo long. The total printed message can not be more than 253 characters long.


Inputs

NameTypeDescription
TestInstancePathT_MaxString
TestMessageT_MaxString

Outputs

NameTypeDescription
TestInstancePathProcessedT_MaxString
TestMessageProcessedT_MaxString

Variables

NameTypeDefaultDescription
TestInstancePathTemporaryT_MaxString
MESSAGE_FORMATTED_STRING_MAX_NUMBER_OF_CHARACTERSINT253This is actually 254, but if StrArg-argument is used (which it is in TcUnit) it is 253.
TEST_NAME_TOO_LONGSTRING'...TestName too long'
TEST_MESSAGE_TOO_LONGSTRING'...TestMsg too long'
Declaration source
(*
    This function block is responsible for making sure that the asserted test instance path and test message are not
    loo long. The total printed message can not be more than 253 characters long.
*)
FUNCTION_BLOCK FB_AdjustAssertFailureMessageToMax253CharLength
VAR_INPUT
    TestInstancePath : T_MaxString;
    TestMessage : T_MaxString;
END_VAR
VAR_OUTPUT
    TestInstancePathProcessed : T_MaxString;
    TestMessageProcessed : T_MaxString;
END_VAR
VAR_TEMP
    TestInstancePathTemporary : T_MaxString;
END_VAR
VAR CONSTANT
    MESSAGE_FORMATTED_STRING_MAX_NUMBER_OF_CHARACTERS : INT := 253; // This is actually 254, but if StrArg-argument is used (which it is in TcUnit) it is 253.
    TEST_NAME_TOO_LONG : STRING := '...TestName too long';
    TEST_MESSAGE_TOO_LONG : STRING := '...TestMsg too long';
END_VAR