UnicodeAssertions
Short summary
Class provides assert statements for UTF-8 and UTF-16 strings with an undefined length.
Attention: All strings are handled as null terminated byte/word streams. For UTF-8 is end of the string 16#00 For UTF-16 is end of the string 16#00_00
Attention:
The interface IUnicodeAssertions uses ANY_STRING,
for this it's not possible to use literals/constants,
because for ANY types generates the compiler __SYSTEM.AnyType
and __SYSTEM.AnyType contains a pointer
| Access | Abstract | Final | Extends | Implements |
|---|---|---|---|---|
| INTERNAL | No | No | AbstractAssertion | IUnicodeStringAssertions |
UML Diagram
Parameters
none
Properties
className
Type: CNM_AbstractObject.ClassName
This abstract property returns the class name of the concrete object, …
Methods
contains
- Parameters:
stringToCheck(ANY_STRING): current string to checksearchString(ANY_STRING): string must be found instringToCheckmessage(AssertMessage): message if the assertion is falseignoreCases(BOOL):TRUEmeans ignore cases;FALSEmeans cases must be equal toonormalizeStrings(BOOL): normalize both strings for check
- Return type:
VOID
This assertion method checks if the current string stringToCheck contains the search string…
containsNo
- Parameters:
stringToCheck(ANY_STRING): current string to checksearchString(ANY_STRING): string that must not be found instringToCheckmessage(AssertMessage): message if the assertion is falseignoreCases(BOOL):TRUEmeans ignore cases;FALSEmeans cases must be equal toonormalizeStrings(BOOL): normalize both strings for check
- Return type:
VOID
This assertion method checks if the current string stringToCheck not contains the search string…
endsWith
- Parameters:
stringToCheck(ANY_STRING): current string to checkend(ANY_STRING): expected end ofstringToCheckmessage(AssertMessage): message if the assertion is falseignoreCases(BOOL):TRUEmeans ignore cases;FALSEmeans cases must be equal tootrim(BOOL):TRUEmeans truncation of spaces on the right side ofstringToChecknormalizeStrings(BOOL): normalize both strings for check
- Return type:
VOID
This assertion method checks if the current string stringToCheck ends with end…
isEmpty
- Parameters:
stringToCheck(ANY_STRING): current string to checkmessage(AssertMessage): message if the assertion is false
- Return type:
VOID
This assertion method checks if the current string stringToCheck is empty…
isEqualTo
- Parameters:
stringToCheck(ANY_STRING): current string to checkexpected(ANY_STRING):stringToCheckmust be equal to expectedmessage(AssertMessage): message if the assertion is falseignoreCases(BOOL):TRUEmeans ignore cases;FALSEmeans cases must be equal toonormalizeStrings(BOOL): normalize both strings for check
- Return type:
VOID
This assertion method checks if the current string stringToCheck is equal to expected…
isNotEmpty
- Parameters:
stringToCheck(ANY_STRING): current string to checkmessage(AssertMessage): message if the assertion is false
- Return type:
VOID
This assertion method checks if the current string stringToCheck is not empty…
isNotEqualTo
- Parameters:
stringToCheck(ANY_STRING): current string to checkunexpected(ANY_STRING):stringToCheckmust be not equal to expectedmessage(AssertMessage): message if the assertion is falseignoreCases(BOOL):TRUEmeans ignore cases;FALSEmeans cases must be equal toonormalizeStrings(BOOL): normalize both strings for check
- Return type:
VOID
This assertion method checks if the current string stringToCheck is not equal to unexpected…
lengthIsBetween
- Parameters:
stringToCheck(ANY_STRING): current string to checkminLength(UDINT): lower limit of the string lengthmaxLength(UDINT): upper limit of the string lengthstringLengthUnit(UnicodeStringLengthUnit): string length units of measurementmessage(AssertMessage): message if the assertion is false
- Return type:
VOID
This assertion method checks if the current string stringToCheck is length…
lengthIsExact
- Parameters:
stringToCheck(ANY_STRING): current string to checkexpectedLength(UDINT): expected length ofstringToCheckstringLengthUnit(UnicodeStringLengthUnit): string length units of measurementmessage(AssertMessage): message if the assertion is false
- Return type:
VOID
This assertion method checks if the current string stringToCheck is length…
lengthIsMax
- Parameters:
stringToCheck(ANY_STRING): current string to checkmaxLength(UDINT): upper limit of the length ofstringToCheckstringLengthUnit(UnicodeStringLengthUnit): string length units of measurementmessage(AssertMessage): message if the assertion is false
- Return type:
VOID
This assertion method checks if the current string stringToCheck is length…
lengthIsMin
- Parameters:
stringToCheck(ANY_STRING): current string to checkminLength(UDINT): lower limit of the length ofstringToCheckstringLengthUnit(UnicodeStringLengthUnit): string length units of measurementmessage(AssertMessage): message if the assertion is false
- Return type:
VOID
This assertion method checks if the current string stringToCheck is length…
setCallBack
- Parameters:
callBack(IAssertCallBack): the class that must be informed if an assertion is false
- Return type:
VOID
This methods is the setter for the callback class if an assertion was false…
startsWith
- Parameters:
stringToCheck(ANY_STRING): current string to checkstart(ANY_STRING): expected start ofstringToCheckmessage(AssertMessage): message if the assertion is falseignoreCases(BOOL):TRUEmeans ignore cases;FALSEmeans cases must be equal tootrim(BOOL):TRUEmeans truncation of spaces on the left side ofstringToChecknormalizeStrings(BOOL): normalize both strings for check
- Return type:
VOID
This assertion method checks if the current string stringToCheck starts with start…
Code
Declaration
{attribute 'reflection'}
FUNCTION_BLOCK INTERNAL UnicodeAssertions EXTENDS AbstractAssertion IMPLEMENTS IUnicodeStringAssertions
VAR
(* class to handle the utf 8 string assertions *)
utf8Assertions :Utf8StringPointerAssertions();
(* class to handle the utf 16 string assertions *)
utf16Assertions :Utf16StringPointerAssertions();
END_VAR