File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed
regression/cbmc-cover/mcdc1 Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int input1 , input2 ;
4
+
5
+ if (input1 && input2 )
6
+ {
7
+ // ok
8
+ }
9
+
10
+ if (!input1 )
11
+ input2 = 1 ;
12
+
13
+ if (input1 && input2 ) // masked!
14
+ {
15
+ }
16
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --cover mcdc
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^\*\* 17 of 18 covered
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ Date: May 2016
11
11
#include < algorithm>
12
12
13
13
#include < util/i2string.h>
14
+ #include < util/expr_util.h>
14
15
15
16
#include " cover.h"
16
17
@@ -186,6 +187,19 @@ void collect_mcdc_controlling_rec(
186
187
{
187
188
if (src.id ()==ID_and)
188
189
{
190
+ if (src.operands ().size ()==2 )
191
+ {
192
+ exprt cond1=
193
+ conjunction ({ src.op0 (), not_exprt (src.op1 ()) });
194
+
195
+ exprt cond2=
196
+ conjunction ({ not_exprt (src.op0 ()), src.op1 () });
197
+
198
+ result.insert (cond1);
199
+ result.insert (cond2);
200
+ }
201
+ else
202
+ collect_mcdc_controlling_rec (make_binary (src), result);
189
203
}
190
204
else if (src.id ()==ID_or)
191
205
{
@@ -532,8 +546,10 @@ void instrument_cover_goals(
532
546
533
547
for (const auto & p : controlling)
534
548
{
549
+ std::string p_string=from_expr (ns, " " , p);
550
+
535
551
std::string description=
536
- " MC/DC independence condition" ;
552
+ " MC/DC independence condition ` " +p_string+ " ' " ;
537
553
538
554
goto_program.insert_before_swap (i_it);
539
555
i_it->make_assertion (p);
You can’t perform that action at this time.
0 commit comments