Regression tests. Not yet finished...
authormario
Sat, 09 Feb 2008 08:59:05 +0100
changeset 109 3af0b849b9c6
parent 108 f9e001952488
child 110 28af43a8f970
Regression tests. Not yet finished...
tests/syntax/configuration/configuration.txt
tests/syntax/enumeration/enumerationvalue.txt
tests/syntax/sfc/sfc.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/syntax/configuration/configuration.txt	Sat Feb 09 08:59:05 2008 +0100
@@ -0,0 +1,67 @@
+
+
+
+PROGRAM foo
+VAR_INPUT
+  single, interval, priority : BOOL;
+END_VAR
+  LD single
+  LD interval
+  LD priority
+END_PROGRAM
+
+
+PROGRAM priority
+VAR_INPUT
+  bar : BOOL;
+END_VAR
+  LD bar
+END_PROGRAM
+
+
+PROGRAM single
+VAR_INPUT
+  bar : BOOL;
+END_VAR
+  LD bar
+END_PROGRAM
+
+
+PROGRAM interval
+VAR_INPUT
+  bar : BOOL;
+END_VAR
+  LD bar
+END_PROGRAM
+
+
+
+
+
+CONFIGURATION config1
+ TASK fast(PRIORITY := 4);
+ PROGRAM P1 WITH fast:
+       FOO(single := TRUE, interval := TRUE, priority := TRUE);
+END_CONFIGURATION
+
+
+CONFIGURATION config2
+ TASK fast(SINGLE := 3, PRIORITY := 4);
+ PROGRAM P1 WITH fast:
+       FOO(single := TRUE, interval := TRUE, priority := TRUE);
+END_CONFIGURATION
+
+
+CONFIGURATION config3
+ TASK fast(INTERVAL := T#1s, PRIORITY := 4);
+ PROGRAM P1 WITH fast:
+       FOO(single := TRUE, interval := TRUE, priority := TRUE);
+END_CONFIGURATION
+
+
+CONFIGURATION config4
+ TASK fast(SINGLE := 3, INTERVAL := T#1s, PRIORITY := 4);
+ PROGRAM P1 WITH fast:
+       FOO(single := TRUE, interval := TRUE, priority := TRUE);
+END_CONFIGURATION
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/syntax/enumeration/enumerationvalue.txt	Sat Feb 09 08:59:05 2008 +0100
@@ -0,0 +1,41 @@
+
+
+
+TYPE
+ enum_type00 : (enum_v1, XXXX, enum_v2) := XXXX;
+END_TYPE
+
+TYPE
+ enum_type01 : (XXXX, enum_v2) := XXXX;
+END_TYPE
+
+TYPE
+ enum_type02 : (enum_v1, XXXX) := XXXX;
+END_TYPE
+
+TYPE
+ enum_type03 : (XXXX) := XXXX;
+END_TYPE
+
+
+
+
+function foo : int
+ var_input
+  a_1, b_1: int;
+ end_var
+ var
+  c_1, d_1: enum_type00;
+(*
+  enum_v1 : enum_type00;
+*)
+ end_var
+  c_1 := enum_type00#XXXX;
+  c_1 := XXXX;
+  c_1 := enum_v1;
+(*
+  enum_v1 := enum_v1;
+*)
+end_function
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/syntax/sfc/sfc.txt	Sat Feb 09 08:59:05 2008 +0100
@@ -0,0 +1,164 @@
+PROGRAM MAIN_TEST
+  VAR
+    QX1 AT %QX1 : BOOL := 1;
+    QX2 AT %QX2 : BOOL := 0;
+    QX3 AT %QX3 : BOOL;
+    IX1 AT %IX1 : BOOL;
+    IX2 AT %IX2 : BOOL;
+    IX3 AT %IX3 : BOOL;
+  END_VAR
+
+  INITIAL_STEP GO:
+  END_STEP
+
+  TRANSITION FROM GO TO STEP1
+    := IX1 = FALSE;
+  END_TRANSITION
+
+  STEP STEP1:
+    ONSTEP1(N);
+  END_STEP
+
+  ACTION ONSTEP1:
+    QX1 := TRUE;
+    QX2 := TRUE;
+  END_ACTION
+
+  TRANSITION FROM STEP1 TO STEP2
+    := IX2 = TRUE;
+  END_TRANSITION
+
+  STEP STEP2:
+    INLINE1(P);
+  END_STEP
+
+  ACTION INLINE1:
+    QX1 := QX2 XOR QX1; QX2 := NOT QX2;
+  END_ACTION
+
+  TRANSITION FROM STEP2 TO A1
+    := QX1 = FALSE AND QX2 = FALSE;
+  END_TRANSITION
+
+  STEP A1:
+    INLINE2(N);
+  END_STEP
+
+  ACTION INLINE2:
+    IX1 := TRUE;
+  END_ACTION
+
+  TRANSITION FROM A1 TO STEP2
+    := IX1 = TRUE;
+  END_TRANSITION
+
+  TRANSITION FROM STEP2 TO (D1, D2, D3)
+    := QX1 = TRUE AND QX2 = TRUE;
+  END_TRANSITION
+
+  STEP D1:
+    INLINE5(N);
+  END_STEP
+
+  ACTION INLINE5:
+    QX1 := FALSE;
+  END_ACTION
+
+  TRANSITION FROM D1 TO E1
+    := NOT ( QX1 OR QX2 OR QX3 );
+  END_TRANSITION
+
+  STEP E1:
+    INLINE8(N);
+  END_STEP
+
+  ACTION INLINE8:
+    QX1 := TRUE;
+  END_ACTION
+
+  TRANSITION FROM (E1, E2, E3) TO GO
+    := QX1 AND QX2 AND QX3;
+  END_TRANSITION
+
+  STEP D2:
+    INLINE6(N);
+  END_STEP
+
+  ACTION INLINE6:
+    QX2 := FALSE;
+  END_ACTION
+
+  TRANSITION FROM D2 TO E2
+    := NOT ( QX1 OR QX2 OR QX3 );
+  END_TRANSITION
+
+  STEP E2:
+    INLINE9(N);
+  END_STEP
+
+  ACTION INLINE9:
+    QX2 := TRUE;
+  END_ACTION
+
+  STEP D3:
+    INLINE7(N);
+  END_STEP
+
+  ACTION INLINE7:
+    QX2 := FALSE;
+  END_ACTION
+
+  TRANSITION FROM D3 TO E3
+    := NOT ( QX1 OR QX2 OR QX3 );
+  END_TRANSITION
+
+  STEP E3:
+    INLINE10(N);
+  END_STEP
+
+  ACTION INLINE10:
+    QX3 := TRUE;
+  END_ACTION
+
+  TRANSITION FROM STEP2 TO A3
+    := QX1 = TRUE AND QX2 = FALSE;
+  END_TRANSITION
+
+  STEP A3:
+    INLINE4(N);
+  END_STEP
+
+  ACTION INLINE4:
+    IX1 := TRUE;
+  END_ACTION
+
+  TRANSITION FROM A3 TO STEP2
+    := IX1 = TRUE;
+  END_TRANSITION
+
+  TRANSITION FROM STEP2 TO A2
+    := QX1 = FALSE AND QX2 = TRUE;
+  END_TRANSITION
+
+  STEP A2:
+    INLINE3(N);
+  END_STEP
+
+  ACTION INLINE3:
+    IX1 := FALSE;
+  END_ACTION
+
+  TRANSITION FROM A2 TO STEP2
+    := IX1 = FALSE;
+  END_TRANSITION
+
+END_PROGRAM
+
+
+CONFIGURATION STD_CONF
+
+  RESOURCE STD_RESSOURCE ON BEREMIZ
+    TASK STD_TASK(INTERVAL := t#100ms,PRIORITY := 0);
+    PROGRAM MAIN_INSTANCE : MAIN_TEST;
+  END_RESOURCE
+END_CONFIGURATION