tests/syntax/sfc/sfc.txt
author mjsousa
Sun, 13 Jul 2014 13:47:16 +0100
changeset 910 a0518971127d
parent 109 3af0b849b9c6
permissions -rwxr-xr-x
Narrow array subscripts correctly, even in the presence of other datatype errors (so we do not generate error messages for array subscripts that do not contain errors).
109
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
     1
PROGRAM MAIN_TEST
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
     2
  VAR
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
     3
    QX1 AT %QX1 : BOOL := 1;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
     4
    QX2 AT %QX2 : BOOL := 0;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
     5
    QX3 AT %QX3 : BOOL;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
     6
    IX1 AT %IX1 : BOOL;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
     7
    IX2 AT %IX2 : BOOL;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
     8
    IX3 AT %IX3 : BOOL;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
     9
  END_VAR
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    10
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    11
  INITIAL_STEP GO:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    12
  END_STEP
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    13
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    14
  TRANSITION FROM GO TO STEP1
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    15
    := IX1 = FALSE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    16
  END_TRANSITION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    17
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    18
  STEP STEP1:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    19
    ONSTEP1(N);
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    20
  END_STEP
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    21
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    22
  ACTION ONSTEP1:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    23
    QX1 := TRUE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    24
    QX2 := TRUE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    25
  END_ACTION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    26
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    27
  TRANSITION FROM STEP1 TO STEP2
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    28
    := IX2 = TRUE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    29
  END_TRANSITION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    30
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    31
  STEP STEP2:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    32
    INLINE1(P);
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    33
  END_STEP
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    34
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    35
  ACTION INLINE1:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    36
    QX1 := QX2 XOR QX1; QX2 := NOT QX2;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    37
  END_ACTION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    38
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    39
  TRANSITION FROM STEP2 TO A1
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    40
    := QX1 = FALSE AND QX2 = FALSE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    41
  END_TRANSITION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    42
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    43
  STEP A1:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    44
    INLINE2(N);
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    45
  END_STEP
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    46
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    47
  ACTION INLINE2:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    48
    IX1 := TRUE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    49
  END_ACTION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    50
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    51
  TRANSITION FROM A1 TO STEP2
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    52
    := IX1 = TRUE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    53
  END_TRANSITION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    54
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    55
  TRANSITION FROM STEP2 TO (D1, D2, D3)
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    56
    := QX1 = TRUE AND QX2 = TRUE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    57
  END_TRANSITION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    58
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    59
  STEP D1:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    60
    INLINE5(N);
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    61
  END_STEP
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    62
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    63
  ACTION INLINE5:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    64
    QX1 := FALSE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    65
  END_ACTION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    66
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    67
  TRANSITION FROM D1 TO E1
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    68
    := NOT ( QX1 OR QX2 OR QX3 );
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    69
  END_TRANSITION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    70
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    71
  STEP E1:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    72
    INLINE8(N);
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    73
  END_STEP
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    74
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    75
  ACTION INLINE8:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    76
    QX1 := TRUE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    77
  END_ACTION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    78
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    79
  TRANSITION FROM (E1, E2, E3) TO GO
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    80
    := QX1 AND QX2 AND QX3;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    81
  END_TRANSITION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    82
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    83
  STEP D2:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    84
    INLINE6(N);
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    85
  END_STEP
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    86
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    87
  ACTION INLINE6:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    88
    QX2 := FALSE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    89
  END_ACTION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    90
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    91
  TRANSITION FROM D2 TO E2
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    92
    := NOT ( QX1 OR QX2 OR QX3 );
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    93
  END_TRANSITION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    94
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    95
  STEP E2:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    96
    INLINE9(N);
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    97
  END_STEP
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    98
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
    99
  ACTION INLINE9:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   100
    QX2 := TRUE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   101
  END_ACTION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   102
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   103
  STEP D3:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   104
    INLINE7(N);
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   105
  END_STEP
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   106
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   107
  ACTION INLINE7:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   108
    QX2 := FALSE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   109
  END_ACTION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   110
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   111
  TRANSITION FROM D3 TO E3
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   112
    := NOT ( QX1 OR QX2 OR QX3 );
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   113
  END_TRANSITION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   114
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   115
  STEP E3:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   116
    INLINE10(N);
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   117
  END_STEP
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   118
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   119
  ACTION INLINE10:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   120
    QX3 := TRUE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   121
  END_ACTION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   122
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   123
  TRANSITION FROM STEP2 TO A3
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   124
    := QX1 = TRUE AND QX2 = FALSE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   125
  END_TRANSITION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   126
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   127
  STEP A3:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   128
    INLINE4(N);
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   129
  END_STEP
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   130
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   131
  ACTION INLINE4:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   132
    IX1 := TRUE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   133
  END_ACTION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   134
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   135
  TRANSITION FROM A3 TO STEP2
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   136
    := IX1 = TRUE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   137
  END_TRANSITION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   138
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   139
  TRANSITION FROM STEP2 TO A2
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   140
    := QX1 = FALSE AND QX2 = TRUE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   141
  END_TRANSITION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   142
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   143
  STEP A2:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   144
    INLINE3(N);
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   145
  END_STEP
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   146
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   147
  ACTION INLINE3:
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   148
    IX1 := FALSE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   149
  END_ACTION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   150
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   151
  TRANSITION FROM A2 TO STEP2
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   152
    := IX1 = FALSE;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   153
  END_TRANSITION
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   154
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   155
END_PROGRAM
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   156
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   157
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   158
CONFIGURATION STD_CONF
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   159
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   160
  RESOURCE STD_RESSOURCE ON BEREMIZ
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   161
    TASK STD_TASK(INTERVAL := t#100ms,PRIORITY := 0);
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   162
    PROGRAM MAIN_INSTANCE : MAIN_TEST;
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   163
  END_RESOURCE
3af0b849b9c6 Regression tests. Not yet finished...
mario
parents:
diff changeset
   164
END_CONFIGURATION