summaryrefslogtreecommitdiffstats
path: root/spec/spec/requirement-action.yml
blob: 184a7b06f29f64b6e8f74015b0f925848b714e50 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
enabled-by: true
links:
- role: spec-member
  uid: root
- role: spec-refinement
  spec-key: functional-type
  spec-value: action
  uid: requirement-functional
spec-description: null
spec-example: |
  SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
  copyrights:
  - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
  enabled-by: true
  functional-type: action
  links: []
  post-conditions:
  - name: Status
    states:
    - name: Success
      test-code: |
        /* Check that the status is SUCCESS */
      text: |
        The status shall be SUCCESS.
    - name: Error
      test-code: |
        /* Check that the status is ERROR */
      text: |
        The status shall be ERROR.
    test-epilogue: null
    test-prologue: null
  - name: Data
    states:
    - name: Unchanged
      test-code: |
        /* Check that the data is unchanged */
      text: |
        The data shall be unchanged by the action.
    - name: Red
      test-code: |
        /* Check that the data is red */
      text: |
        The data shall be red.
    - name: Green
      test-code: |
        /* Check that the data is green */
      text: |
        The data shall be green.
    test-epilogue: null
    test-prologue: null
  pre-conditions:
  - name: Data
    states:
    - name: NullPtr
      test-code: |
        /* Set data pointer to NULL */
      text: |
        The data pointer shall be NULL.
    - name: Valid
      test-code: |
        /* Set data pointer to reference a valid data buffer */
      text: |
        The data pointer shall reference a valid data buffer.
    test-epilogue: null
    test-prologue: null
  - name: Option
    states:
    - name: Red
      test-code: |
        /* Set option to RED */
      text: |
        The option shall be RED.
    - name: Green
      test-code: |
        /* Set option to GREEN */
      text: |
        The option shall be GREEN.
    test-epilogue: null
    test-prologue: null
  requirement-type: functional
  skip-reasons: {}
  test-action: |
    /* Call the function of the action */
  test-brief: null
  test-cleanup: null
  test-context:
  - brief: null
    description: null
    member: void *data
  - brief: null
    description: null
    member: option_type option
  test-context-support: null
  test-description: null
  test-header: null
  test-includes: []
  test-local-includes: []
  test-name: RedGreenData
  test-prepare: null
  test-setup: null
  test-stop: null
  test-support: null
  test-target: tc-red-green-data.c
  test-teardown: null
  transition-map:
  - enabled-by: true
    post-conditions:
      Status: Error
      Data: Unchanged
    pre-conditions:
      Data: NullPtr
      Option: all
  - enabled-by: true
    post-conditions:
      Status: Success
      Data: Red
    pre-conditions:
      Data: Valid
      Option: Red
  - enabled-by: true
    post-conditions:
      Status: Success
      Data: Green
    pre-conditions:
      Data: Valid
      Option: Green
  rationale: null
  references: []
  text: |
    ${.:/text-template}
  type: requirement
spec-info:
  dict:
    attributes:
      post-conditions:
        description: null
        spec-type: requirement-action-condition-list
      pre-conditions:
        description: null
        spec-type: requirement-action-condition-list
      skip-reasons:
        description: null
        spec-type: requirement-action-skip-reasons
      test-action:
        description: |
          It shall be the test action code.
        spec-type: str
      test-brief:
        description: |
          If the value is present, then it shall be the test case brief
          description.
        spec-type: optional-str
      test-cleanup:
        description: |
          If the value is present, then it shall be the test cleanup code.  The
          code is placed in the test action loop body after the test
          post-condition checks.
        spec-type: optional-str
      test-context:
        description: null
        spec-type: requirement-action-test-context-list
      test-context-support:
        description: |
          If the value is present, then it shall be the test context support
          code.  The context support code is placed at file scope before the
          test context definition.
        spec-type: optional-str
      test-description:
        description: |
          If the value is present, then it shall be the test case description.
        spec-type: optional-str
      test-header:
        description: null
        spec-type: requirement-action-test-header
      test-includes:
        description: |
          It shall be a list of header files included via ``#include <...>``.
        spec-type: list-str
      test-local-includes:
        description: |
          It shall be a list of header files included via ``#include "..."``.
        spec-type: list-str
      test-name:
        description: null
        spec-type: test-name
      test-prepare:
        description: |
          If the value is present, then it shall be the early test preparation
          code.  The code is placed in the test action loop body before the
          test pre-condition preparations.
        spec-type: optional-str
      test-setup:
        description: null
        spec-type: requirement-action-test-fixture
      test-stop:
        description: null
        spec-type: requirement-action-test-fixture
      test-support:
        description: |
          If the value is present, then it shall be the test case support code.
          The support code is placed at file scope before the test case code.
        spec-type: optional-str
      test-target:
        description: |
          It shall be the path to the generated test case source file.
        spec-type: str
      test-teardown:
        description: null
        spec-type: requirement-action-test-fixture
      transition-map:
        description: null
        spec-type: requirement-action-transition-list
    description: |
      This set of attributes specifies functional requirements and
      corresponding validation test code.  The functional requirements of an
      action are specified.  An action performs a step in a finite state
      machine.  An action is implemented through a function or a macro.  The
      action is performed through a call of the function or an execution of the
      code of a macro expansion by an actor.  The actor is for example a task
      or an interrupt service routine.

      For action requirements which specify the function of an interface, there
      shall be exactly one link with the ${interface-function-role:/spec-name}
      to the interface of the action.

      The action requirements are specified by

      * a list of pre-conditions, each with a set of states,

      * a list of post-conditions, each with a set of states,

      * the transition of pre-condition states to post-condition states through
        the action.

      Along with the requirements, the test code to generate a validation test
      is specified.  For an action requirement it is verified that all
      variations of pre-condition states have a set of post-condition states
      specified in the transition map.  All transitions are covered by the
      generated test code.
    mandatory-attributes: all
spec-name: Action Requirement Item Type
spec-type: requirement-action
type: spec