Test case R0165
Full test suiteDevice test case
Strings with length
This test case it part of the test suite proposed for new devices.
Test case ID: R0165
Language: ST
tests2/t0165.st
PROGRAM R0165
VAR
s: STRING;
s2: STRING[2];
s10: STRING[10];
s255: STRING(255);
// WSTRING currently not supported, this is converted to STRING
ws: WSTRING;
ws2: WSTRING[2];
ws10: WSTRING[10];
ws255: WSTRING(255);
// this would fail s256: STRING(713);
END_VAR
s := 'Hi, this is a quite long string'; // should fit in default length
_GEB_ASSERT_(s = 'Hi, this is a quite long string');
_GEB_ASSERT_(LEN(s) = 31);
_GEB_ASSERT_(LEN(s2) = 0);
s2 := s; // should truncate to 2: 'Hi'
_GEB_ASSERT_(LEN(s2) = 2);
s2 := 'X';
_GEB_ASSERT_(LEN(s2) = 1);
s10 := s;
_GEB_ASSERT_(LEN(s10) = 10);
s255 := s10;
_GEB_ASSERT_(LEN(s255) = 10);
s255 := s;
_GEB_ASSERT_(LEN(s255) = 31);
ws := "Hi, this is a quite long wstring"; // should fit in default length
_GEB_ASSERT_(ws = "Hi, this is a quite long wstring");
_GEB_ASSERT_(LEN(ws) = 32);
_GEB_ASSERT_(LEN(ws2) = 0);
ws2 := ws; // should truncate to 2: 'Hi'
_GEB_ASSERT_(LEN(ws2) = 2);
ws2 := 'X';
_GEB_ASSERT_(LEN(s2) = 1);
ws10 := ws;
_GEB_ASSERT_(LEN(ws10) = 10);
ws255 := ws10;
_GEB_ASSERT_(LEN(ws255) = 10);
ws255 := ws;
_GEB_ASSERT_(LEN(ws255) = 32);
END_PROGRAM


