Test case R0150
Full test suiteDevice test case
Date/time types and functions
This test case it part of the test suite proposed for new devices.
Test case ID: R0150
Language: ST
tests2/t0150.stPROGRAM TEST_R0150 VAR tod0,tod1 , tod2 ,tod3 : TIME_OF_DAY; dt0,dt1 , dt2 ,dt3 ,dt4,dt5 : DATE_AND_TIME; t0,t1 ,t2 ,t3 : TIME; da0,da1 : DATE; END_VAR dt1 := DT#1986-01-29-08:40:00.12 ; dt2 := ADD_DT_TIME ( dt1 , T#2d_1h_1s ); tod1 := DT_TO_TOD(dt1) ; da1 := DT_TO_DATE(dt1); t1 := T#01h00m01s244ms ; IF t1 < T#3d_1h_1s_255ms THEN dt3 := ADD_DT_TIME(dt1 ,ADD_TIME(t1, t1)) ; END_IF; dt4 := DATE_TO_DT (da1 ); t2 := DIVTIME(t1 , 3 ); t2 := ADD_TIME(t2, T#2d01h00m01s244ms); t3 := MULTIME(t1 , 0.25 ); dt5 := CONCAT_DATE_TOD(DATE#1967-02-11, tod1 ); _GEB_ASSERT_(da0 = DATE#2000-01-01); _GEB_ASSERT_(da1 = DATE#1986-01-29); _GEB_ASSERT_(dt0 = DT#2000-01-01-00:00:00.000); _GEB_ASSERT_(dt1 = DT#1986-01-29-08:40:00.120); _GEB_ASSERT_(dt2 = DT#1986-01-31-09:40:01.120); _GEB_ASSERT_(dt3 = DT#1986-01-29-10:40:02.608); _GEB_ASSERT_(dt4 = DT#1986-01-29-00:00:00.000); // _GEB_MSG_(DT_TO_STRING(dt5)); _GEB_ASSERT_(dt5 = DT#1967-02-11-08:40:00.120); _GEB_ASSERT_(t0 = T#0s); _GEB_ASSERT_(t1 = T#01h00m01s244ms); _GEB_ASSERT_(t2 = T#2d01h20m01s658ms); _GEB_ASSERT_(t3 = T#15m00s311ms); _GEB_ASSERT_(tod0 = TOD#00:00:00.000); _GEB_ASSERT_(tod1 = TOD#08:40:00.120); END_PROGRAM