Skip to content

Commit a3f8e59

Browse files
author
Daniel Kroening
authored
Merge pull request #3535 from edstenson/review_test_suite
Updated language use in test-suite.md
2 parents 713a71f + 0b10c84 commit a3f8e59

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

doc/cprover-manual/test-suite.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## Test Suite Generation with CBMC
44

5-
### A Small Tutorial with A Case Study
5+
### A Small Tutorial with a Case Study
66

7-
We assume that CBMC is installed on your system. If not so, follow
7+
We assume that CBMC is installed on your system. If not, follow
88
\ref man_install-cbmc "these instructions".
99

1010
CBMC can be used to automatically generate test cases that satisfy a
@@ -24,14 +24,14 @@ suite generation functionality in CBMC, by means of a case study. The
2424
following program is an excerpt from a real-time embedded benchmark
2525
[PapaBench](https://www.irit.fr/recherches/ARCHI/MARCH/rubrique.php3?id_rubrique=97),
2626
and implements part of a fly-by-wire autopilot for an Unmanned Aerial
27-
Vehicle (UAV). It is adjusted mildly for our purposes.
27+
Vehicle (UAV). We have adjusted it slightly for our purposes.
2828

2929
The aim of function `climb_pid_run` is to control the vertical climb of
3030
the UAV. Details on the theory behind this operation are documented in
3131
the [wiki](https://wiki.paparazziuav.org/wiki/Theory_of_Operation) for
32-
the Paparazzi UAV project. The behaviour of this simple controller,
32+
the Paparazzi UAV project. The behavior of this simple controller,
3333
supposing that the desired speed is 0.5 meters per second, is plotted in
34-
the Figure below.
34+
the figure below.
3535

3636
![The pid controller](https://github.com/diffblue/cbmc/raw/develop/doc/assets/pid.png "The pid controller")
3737

@@ -115,7 +115,7 @@ the Figure below.
115115
77: }
116116
```
117117

118-
In order to test the PID controller, we construct a main control loop,
118+
To test the PID controller, we construct a main control loop,
119119
which repeatedly invokes the function `climb_pid_run` (line 69). This
120120
PID function has two input variables: the desired speed `desired_climb`
121121
and the estimated speed `estimated_z_dot`. In the beginning of each loop
@@ -126,26 +126,27 @@ guarantees that both values are bounded within a valid range. The
126126
and outputs of interest for generating test suites.
127127

128128
To demonstrate the automatic test suite generation in CBMC, we call the
129-
following command and we are going to explain the command line options
130-
one by one.
129+
following command:
131130

132131
cbmc pid.c --cover mcdc --unwind 6 --xml-ui
133132

134-
The option `--cover mcdc` specifies the code coverage criterion. There
135-
are four conditional statements in the PID function: in line 41, line
136-
44, line 48 and line 49. To satisfy MC/DC, the test suite has to meet
133+
We'll describe those command line options one by one. The option `--cover mcdc`
134+
specifies the code coverage criterion. There
135+
are four conditional statements in the PID function: in lines 41,
136+
44, 48, and 49. To satisfy MC/DC, the test suite has to meet
137137
multiple requirements. For instance, each conditional statement needs to
138138
evaluate to *true* and *false*. Consider the condition
139139
`"pprz>=0 && pprz<=MAX_PPRZ"` in line 41. CBMC instruments three
140140
coverage goals to control the respective evaluated results of
141-
`"pprz>=0"` and `"pprz<=MAX_PPRZ"`. We list them in below and they
142-
satisfy the MC/DC rules. Note that `MAX_PPRZ` is defined as 16 \* 600 in
143-
line 06 of the program.
141+
`"pprz>=0"` and `"pprz<=MAX_PPRZ"`. They
142+
satisfy the MC/DC rules.
144143

145144
!(pprz >= (float)0) && pprz <= (float)(16 * 600) id="climb_pid_run.coverage.1"
146145
pprz >= (float)0 && !(pprz <= (float)(16 * 600)) id="climb_pid_run.coverage.2"
147146
pprz >= (float)0 && pprz <= (float)(16 * 600) id="climb_pid_run.coverage.3"
148147

148+
Note that `MAX_PPRZ` is defined as 16 \* 600 in line 06 of the program.
149+
149150
The "id" of each coverage goal is automatically assigned by CBMC. For
150151
every coverage goal, a test suite (if there exists) that satisfies such
151152
a goal is printed out in XML format, as the parameter `--xml-ui` is
@@ -190,18 +191,17 @@ the coverage goals it is for are clearly described.
190191
(iteration 6) desired_climb=-1.000000f, estimator_z_dot=1.000000f
191192

192193
The option `--unwind 6` unwinds the loop inside the main function body
193-
six times. In order to achieve the complete coverage on all the
194+
six times. To achieve complete coverage on all the
194195
instrumented goals in the PID function `climb_pid_run`, the loop must be
195-
unwound sufficient enough times. For example, `climb_pid_run` needs to
196+
unwound enough times. For example, `climb_pid_run` needs to
196197
be called at least six times for evaluating the condition
197198
`climb_sum_err>MAX_CLIMB_SUM_ERR` in line 48 to *true*. This corresponds
198-
to the Test 5. An introduction to the use of loop unwinding can be found
199-
in [Understanding Loop Unwinding](cbmc-loops.shtml).
199+
to Test 5. To learn more about loop unwinding take a look at [Understanding Loop Unwinding](cbmc-loops.shtml).
200200

201-
In this small tutorial, we present the automatic test suite generation
201+
In this tutorial, we present the automatic test suite generation
202202
functionality of CBMC, by applying the MC/DC code coverage criterion to
203203
a PID controller case study. In addition to `--cover mcdc`, other
204-
coverage criteria like `branch`, `decision`, `path` etc. are also
204+
coverage criteria such as `branch`, `decision`, and `path`. are also
205205
available when calling CBMC.
206206

207207
### Coverage Criteria

0 commit comments

Comments
 (0)