![]() |
Open Test Framework
|
|
A literal (Latin littera "letter") denotes a character string used to directly represent the values of data types. In order for literals to be identified, they must conform to certain syntactical rules, e.g. B. be enclosed in quotation marks like "This is a string".
Inside OTF all literals has OTL syntax, see Expressions. The following list contains literal examples in OTL syntax of all OTX data types which support literals. Detailed information about the literals can be found in the definition of the OTX data type.
| OTX Data Type | OTL Literal Example | Notes |
|---|---|---|
| Boolean | true false | Not case sensitive |
| Integer | -9223372036854775808 -2 0 1 9223372036854775807 | |
| Float | -2.56899 -1.03344 0.0 -0.0 0.0125 NaN -Infinity | |
| String | "Hello World" "\"Hello World\"""\n" "file:///c:/test.txt""file:\\\\\\c:\\test.txt""\\]$""Line1\r\n\tLine2" | Hello World"Hello World" (see Escaping)New line file:///c:/test.txtfile:\\\c:\test.txtRegExp for seeking a line ended with "]" Line1 Line2 |
| ByteField | &0A &0F10 &0123456789ABCDEF &NULL | Not case sensitive except &NULL for empty byte field |
| List | {"literal of list", "with type has literals"}{&01, &02, &FF}{{{1,2}, {3,4}}, {{1,2}, {3,4}}} | |
| Map | {"Key1" : "literal of map with value type has literals"}{1 : &01, 5 : &02, 2 : &FF}{"k1" : {1, 2, 3}}{1 : {"key1" : true, "key2" : false}, 2 : {"k1" : true}} | |
| UserException | @UserException:"Indentifier"/"ExceptionText"@UserException:"SelfDefinedException1"/"Incorrect data input." | |
| Empty Value | NULL | The element in an expression is omitted |
Special characters in OTL StringLiterals must be escaped because they are reserved for syntax or have special meaning. An escape character starts with a backslash "\" and the backslash itself will be expressed by "\\". The following table lists all supported escape characters:
Important: Except for the special characters listed here, all other UTF-8 characters (like
"€"or"µ"or"é"or"☺") can be used directly within the OTLStringLiterals.
| Special character (escaped) | Ascii code (decimal) | Description | Example as OTL string literal | Real value |
|---|---|---|---|---|
\t | 09 | Tabulator | "A\tB | A B |
\n | 10 | New Line | "\n" | New Line |
\r | 13 | Carriage Return | "\r" | Carriage Return |
\" | 34 | Double Quotation Marks | "\"Hello World\"" | "Hello World" |
\\ | 92 | Backslash | "file:\\\\\\c:\\test.txt" | file:\\\c:\test.txt |
| OTX Data Type | OTL Literal Example | Notes |
|---|---|---|
| Enumeration | Color.RedMyEnumerationSignature1.MyEnumerationElement1 | |
| Structure | Address{name = "Sherlock Holmes", street = "Baker Street", code = 221, city = "London"}MyStructurSignature1{Element1 = true, Element2 = {1, 2, 3}} |
| OTX Data Type | OTL Literal Example | Notes |
|---|---|---|
| Quantity | 12.53 [@Unit, "D:/ODX_RS_UNIT_LIB.odx", "(km/h)/s", 3]37.5 [@Unit, "ODX_RS_UNIT_LIB.odx", "°", 2] | |
| Unit | [@Unit, "ODX_RS_UNIT_LIB.odx", "1/min2"][@Unit, "Z:/ODX_RS_UNIT_LIB.odx", "kΩ"] |
| OTX Data Type | OTL Literal Example | Possible Values |
|---|---|---|
| ConfirmationType | @ConfirmationType:YES | { YES | NO | CANCEL } |
| MessageType | @MessageType:INFO | { INFO | WARNING | ERROR | YESNO_QUESTION | YESNOCANCEL_QUESTION } |
| OTX Data Type | OTL Literal Example | Notes |
|---|---|---|
| TranslationKey | @TranslationKey:"text_ID_value"@TranslationKey:"Key01" | |
| OTX Data Type | OTL Literal Example | Possible Values |
|---|---|---|
| LogLevel | @LogLevel:ALL | { ALL | TRACE | DEBUG | INFO | WARN | ERROR | FATAL | OFF } |
| | |
| OTX Data Type | OTL Literal Example | Possible Values |
|---|---|---|
| Encoding | @Encoding:ISO-8859-1 | { US-ASCII | ISO-8859-1 | UTF-8 | UTF-16BE | UTF-16LE | UTF-16 | BIN | OCT | HEX } |
| OTX Data Type | OTL Literal Example | Possible Values |
|---|---|---|
| ResponseState | @ResponseState:FAILED | { FAILED | INVALID | NEGATIVE | POSITIVE } |
| ResultState | @ResultState:ALL_NEGATIVE | { ALL_FAILED | ALL_INVALID | ALL_NEGATIVE | ALL_POSITIVE | FAILED | INVALID | NEGATIVE | POSITIVE } |
| OTX Data Type | OTL Literal Example | Possible Values |
|---|---|---|
| ComChannelCategory | @ComChannelCategory:BASE_VARIANT | { BASE_VARIANT | FUNCTIONAL_GROUP | PROTOCOL } |
| OTX Data Type | OTL Literal Example | Possible Values |
|---|---|---|
| McdDataType | @McdDataType:ASCIISTRING | { ASCIISTRING | BITFIELD | BOOLEAN | BYTEFIELD | FLOAT32 | FLOAT64 | INT16 | INT32 | UINT64 | INT8 | UINT16 | UINT32 | UINT64 | UINT8 | UNICODE2STRING | DTC | END_OF_PDU | ENVDATA | ENVDATADESC | FIELD | KEY | LENGTHKEY | MULTIPLEXER | NO_TYPE | STRUCT_FIELD | STRUCTURE | TABLE | TABLE_ROW | TEXTTABLE } |
| | |
| | |
| OTX Data Type | OTL Literal Example | Possible Values |
|---|---|---|
| Audience | @Audience:SUPPLIER | { SUPPLIER | DEVELOPMENT | MANUFACTURING | AFTERSALES | AFTERMARKET } |
| | |