Test case R0114
Full test suiteDevice test case
FB/function informal calls, with INOUT arguments
This test case it part of the test suite proposed for new devices.
Test case ID: R0114
Language: ST
tests2/t0114.st(* o1/o2: computes sum/product of inputs; io3 is incremented by 1 ; io4 by 10; return sum of o1 o2 *) FUNCTION F1_R0114 : INT VAR_INPUT in1, in2 : INT; END_VAR VAR_IN_OUT io3,io4 : INT; END_VAR VAR_OUTPUT o1, o2 : INT; END_VAR io3 := io3 + 1; io4 := io4 + 10; (* this will have an interesting behaviour if in3 and in4 points to the same variable! *) o1 := in2 + in1; o2 := in1 * in2; F1_R0114 := o1 + o2; END_FUNCTION PROGRAM R0114 VAR i1,iox3,iox4, fo,foo,ff : INT; b : BOOL; END_VAR i1 := 3; iox3 := 5; iox4 := 30; //ff := F1_R0114(i1, 4, io3+1, fo, foo); // this woutr trigger an error, inout must be a varref ff := F1_R0114(i1, 4, iox3, iox4,fo, foo); _GEB_ASSERT_(fo = 7); _GEB_ASSERT_(foo = 12); _GEB_ASSERT_(ff = 19); _GEB_ASSERT_(iox3 = 6); _GEB_ASSERT_(iox4 = 40); b:=0; iox3 := 5; iox4 := 30; ff := F1_R0114(in1:=i1, in2:=4, io3:=iox3, io4:=iox4,o1=>fo, o2=>foo,ENO=>b); // equivalent _GEB_ASSERT_(fo = 7); _GEB_ASSERT_(foo = 12); _GEB_ASSERT_(ff = 19); _GEB_ASSERT_(iox3 = 6); _GEB_ASSERT_(iox4 = 40); _GEB_ASSERT_(b = TRUE); iox3 := 5; ff := F1_R0114(in1:=i1, in2:=4, io3:=iox3, io4:=iox3,o1=>fo, o2=>foo,ENO=>b); // two in_out coincide! (this does not work in the simulator) _GEB_ASSERT_(fo = 7); _GEB_ASSERT_(foo = 12); _GEB_ASSERT_(ff = 19); //_GEB_ASSERT_(iox3 = 16); _GEB_MSG_(INT_TO_STRING(iox3)); END_PROGRAM