Test case R0163
Full test suiteDevice test case
Custom string functions
This test case it part of the test suite proposed for new devices.
Test case ID: R0163
Language: ST
tests2/t0163.st
PROGRAM R0163
VAR
s1,s2,s3,s4: STRING;
ba,b1,b2 : BYTE;
END_VAR
ba := 97; // lower case a
s1 := 'HELO';
b1 := GET_CHAR_AT(s1, 1);
// _GEB_MSG_(BYTE_TO_STRING(b1));
_GEB_ASSERT_(b1 = 72); // 'H'
b1 := GET_CHAR_AT(s1, 4);
_GEB_ASSERT_(b1 = 79); // 'O'
b1 := GET_CHAR_AT(s1, 5); // illegal
_GEB_ASSERT_(b1 = 0); // illegal
s2 := SET_CHAR_AT(s1, 2, ba);
_GEB_ASSERT_(s2 = 'HaLO');
s2 := SET_CHAR_AT(s2, 1, ba);
_GEB_ASSERT_(s2 = 'aaLO');
s1 := SET_CHAR_AT(s1, 4, ba);
_GEB_ASSERT_(s1 = 'HELa');
END_PROGRAM


