Test case R0910
Full test suiteDevice test case
External native C library
This test case it part of the test suite proposed for new devices.
Test case ID: R0910
Language: ST
tests2/t0910.st(* requires functions NF1 NF6STR and fbs NFB2 NFB3 declared inside lib/native/func1.st, implemented in library *) (* timestorun = 2 *) PROGRAM X02NATIVE VAR C1: INT; C2: INT; fb: NFB2; fb3 : NFB3 ; s1 ,s2,s3 :STRING; r1 : REAL; END_VAR VAR_EXTERNAL _T_PARAMS : TEST_PARAMS; END_VAR C1 := 3; C2 := 5; C1 := NF1(C1,42); // 45 C2 := NONNATIVE1F1(C2,42); // 47 C1 := C1 + 3; // 48 C2 := C2 + 3; // 50 s1 := 'Hi'; s2 := NF6STR(s1,'Bye'); // s2: Hi-Bye // _GEB_MSG_(s2); r1 := 1.6; fb(); // fb.cont = 101 | 103 fb(I1 := 3, I2 := r1); // fb.cont = 102 | 104 fb3(si := ''); s3 := CONCAT(INT_TO_STRING(400 +(_T_PARAMS.cycle-1)*2),'YES'); // _GEB_MSG_('--'); //_GEB_MSG_(fb3.so ); //_GEB_MSG_(s3 ); //_GEB_MSG_('=='); _GEB_ASSERT_(fb3.so = s3); fb3(si := s1,I1:=7); // fb3.cont = 402 | 404 IF _T_PARAMS.cycle = _T_PARAMS.timestorun THEN // last iteration _GEB_ASSERT_(C1 = 48); _GEB_ASSERT_(C2 = 50); _GEB_ASSERT_(s2 = 'Hi-Bye'); // _GEB_MSG_(INT_TO_STRING(fb.O1)); _GEB_ASSERT_(fb.O1 = 106); _GEB_ASSERT_EQFLOAT_(fb.O2 , 2.1); _GEB_ASSERT_(fb.O1 = 106); _GEB_ASSERT_EQFLOAT_(fb.O2 , 2.1); // _GEB_MSG_(fb3.so); _GEB_ASSERT_(fb3.so = 'Hi403NO'); END_IF; END_PROGRAM // just for comparison FUNCTION NONNATIVE1F1 : INT VAR_INPUT i,j : INT ; END_VAR NONNATIVE1F1 := ADD_INT(i , j); END_FUNCTION