Test case R0280
Full test suiteDevice test case
ENO=false in Function Block
This test case it part of the test suite proposed for new devices.
Test case ID: R0280
Language: ST
tests2/t0280.st
TYPE
ARR2 : ARRAY [1..2] OF INT;
END_TYPE
FUNCTION_BLOCK FB_R0280 (* sets o:=i and io+=i, but if i>10 sets ENO:=false *)
VAR_INPUT i : INT; END_VAR
VAR_IN_OUT io : INT; END_VAR
VAR_OUTPUT o : INT; END_VAR
o := i;
io := io+i;
IF i > 10 THEN
ENO := FALSE; // ENO is FALSE => Outputs should not be copied (inout will be affected)
END_IF;
END_FUNCTION_BLOCK
PROGRAM R0280
VAR
i1, o1, io1 : INT;
i2, o2, io2 : INT;
fb1, fb2 : FB_R0280;
ar : ARR2;
b:BOOL;
END_VAR
io1 := 20;
o1 := 30;
ar[1] := 100;
ar[2] := 200;
fb1( EN:=FALSE, i := 3, io := io1 , o => o1 ,ENO =>b);
_GEB_ASSERT_(b = 0);
_GEB_ASSERT_(io1 = 20);
_GEB_ASSERT_(o1 = 30);
fb1( i := 3, io := io1 , o => o1 ,ENO =>b); (* remembers EN=false *)
_GEB_ASSERT_(b = 0);
_GEB_ASSERT_(io1 = 20);
_GEB_ASSERT_(o1 = 30);
fb1( EN:=1, i := 3, io := io1 , o => o1 ,ENO =>b);
_GEB_ASSERT_(b = 1);
_GEB_ASSERT_(io1 = 23);
_GEB_ASSERT_(o1 = 3);
fb1( i := 3, io := ar[1] , o => ar[2],ENO =>b);
_GEB_ASSERT_(b = 1);
_GEB_ASSERT_(ar[1] = 103);
_GEB_ASSERT_(ar[2] = 3);
fb1( i := 35, io := io1 , o => o1 ,ENO =>b); (* internal ENO = false )
_GEB_ASSERT_(b = 0);
_GEB_ASSERT_(io1 = 57); (* modified *)
_GEB_ASSERT_(o1 = 3); (* not modified *)
END_PROGRAM


