Test case R0281
Full test suiteDevice test case
ENO=false in Function Block 2
This test case it part of the test suite proposed for new devices.
Test case ID: R0281
Language: ST
tests2/t0281.stTYPE POINT: STRUCT X: INT; Y: INT;END_STRUCT; SS3: STRING[6]; END_TYPE FUNCTION_BLOCK FB_R0281 (* sets po=p, pio+=p so=s sio=sio + s and if p.X>10 sets ENO:=false *) VAR_INPUT p : POINT; s: SS3; END_VAR VAR_IN_OUT pio : POINT; sio: SS3; END_VAR VAR_OUTPUT po : POINT; so: SS3; END_VAR po := p; (* by copy - will not have effect outside if p.x>1 => ENO=FALSE *) so := s; (* by copy - will not have effect outside if p.x>1 => ENO=FALSE *) pio.X := pio.X + p.X; (* by reference *) pio.Y := pio.Y + p.Y; (* by reference *) sio := CONCAT(sio,s); (* by reference *) IF p.X > 10 THEN ENO := FALSE; // ENO is FALSE => Outputs should not be copied END_IF; END_FUNCTION_BLOCK PROGRAM R0281 VAR s1, s2, s3: SS3; p1, p2, p3 : POINT; fb1: FB_R0281; b:BOOL; END_VAR p1.X := 5; p1.Y := 25; p2.X := 1; p2.Y := 2; p3.X := 3; p3.Y := 4; s1 := 'A'; s2 := 'B'; s3 := 'C'; b := TRUE; // EN=FALSE fb1( EN := FALSE, p := p1, s := s1, pio := p2 , po => p3 , sio := s2, so => s3, ENO=>b); _GEB_ASSERT_(b=FALSE); _GEB_ASSERT_(p2.Y=2); _GEB_ASSERT_(p3.Y=4); _GEB_ASSERT_(s2='B'); _GEB_ASSERT_(s3='C'); b := TRUE; // EN ommited: should remember previous value (false) fb1(p := p1, s := s1, pio := p2 , po => p3 , sio := s2, so => s3,ENO=>b); _GEB_ASSERT_(b=FALSE); _GEB_ASSERT_(p2.Y=2); _GEB_ASSERT_(p3.Y=4); _GEB_ASSERT_(s2='B'); _GEB_ASSERT_(s3='C'); // EN true - ENO TRUE fb1(EN:=TRUE,p := p1, s := s1, pio := p2 , po => p3 , sio := s2, so => s3,ENO=>b); _GEB_ASSERT_(b=TRUE); _GEB_ASSERT_(p1.X=5); p1.X := 11; p1.Y := 31; s1 := 'X'; _GEB_ASSERT_(p2.X=6); _GEB_ASSERT_(p2.Y=27); _GEB_ASSERT_(p3.X=5); _GEB_ASSERT_(p3.Y=25); _GEB_ASSERT_(s2='BA'); _GEB_ASSERT_(s3='A'); // EN=true, internal ENO FALSE (inouts are affected, out are not) fb1(p := p1, s := s1, pio := p2 , po => p3 , sio := s2, so => s3,ENO=>b); _GEB_ASSERT_(b=FALSE); _GEB_ASSERT_(p1.X=11); _GEB_ASSERT_(p2.X=17); _GEB_MSG_(INT_TO_STRING(p2.X)); _GEB_ASSERT_(p2.Y=58); _GEB_MSG_(INT_TO_STRING(p2.Y)); _GEB_ASSERT_(p3.X=5); _GEB_ASSERT_(p3.Y=25); _GEB_ASSERT_(s2='BAX'); _GEB_ASSERT_(s3='A'); END_PROGRAM