Test case R0009
Full test suiteDevice test case
MUX function
This test case it part of the test suite proposed for new devices.
Test case ID: R0009
Language: ST
tests2/t0009.stPROGRAM T0009 VAR I0,I1: INT; S0,S1 : STRING; DT0,DT1 : DT; B0,B1,B2: BOOL; END_VAR VAR_TEMP I2 : INT; S2 : STRING; END_VAR I0 := ADD_INT(IN2 := 2, IN3 := 3); I0 := ADD_INT(5,6); I0 := MUX(3,10,20,30); // empty _GEB_ASSERT_(I0 = 0 ); I1 := MUX(1,10,20,30); // 20 _GEB_ASSERT_(I1 = 20 ); I2 := MUX(14,10,20,30); // ?? undefined // _GEB_ASSERT_(I2 = 0 ); I2 := MUX(K:=3, IN2 := 20,IN1:=20); // empty _GEB_ASSERT_(I2 = 0 ); I2 := MUX(K:=2, IN2 := 10,IN3:=20); // 10 _GEB_ASSERT_(I2 = 10 ); I2 := MUX(K:=1, IN0 := 5,IN1:= I2-3); // 7 _GEB_ASSERT_(I2 = 7 ); S0 := MUX(3, 'HI','BYE','X'); // empty _GEB_ASSERT_(S0 = '' ); S1 := MUX(1, 'HI','BYE','X'); // BYE _GEB_ASSERT_(S1 = 'BYE' ); S2 := MUX(14,'HI','BYE','X'); // ?? undefined DT0 := MUX(3, DT#1984-06-25-00:18:19, DT#2084-01-1-00:18:19); // DT1 := MUX(1, DT#1984-06-25-00:18:19, DT#2084-01-1-00:18:19); // _GEB_ASSERT_(DT1 = DT#2084-01-1-00:18:19); DT1 := MUX(14, DT#1984-06-25-00:18:19, DT#2084-01-1-00:18:19); // B1 := 0; B2 := TRUE; B0 := MUX(1,B1,B2); _GEB_ASSERT_(B0 = TRUE); B0 := MUX(0,B1,B2); _GEB_ASSERT_(B0 = FALSE); B0 := MUX(3,B1,B2); _GEB_ASSERT_(B0 = FALSE); END_PROGRAM