Skip to content

Commit 3b3542a

Browse files
do not produce test goals for constructor and destructor methods
Signed-off-by: Lucas Cordeiro <lucasccordeiro@gmail.com>
1 parent 52c8ed9 commit 3b3542a

File tree

7 files changed

+14
-9
lines changed

7 files changed

+14
-9
lines changed

regression/cbmc-cover/consider_goals1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ if_icmp1.class
33
--cover location --no-trivial-tests
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\*\* 13 of 29 covered (44.8%)
6+
^\*\* 12 of 27 covered (44.4%)
77
--
88
^warning: ignoring

regression/cbmc-cover/consider_goals2/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ Person.class
33
--cover location --no-trivial-tests
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\*\* 5 of 5 covered (100.0%)
6+
^\*\* 4 of 4 covered (100.0%)
77
--
88
^warning: ignoring

regression/cbmc-cover/consider_goals3/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ Person.class
33
--cover location --no-trivial-tests
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\*\* 12 of 15 covered (80.0%)
6+
^\*\* 11 of 14 covered (78.6%)
77
--
88
^warning: ignoring

regression/cbmc-cover/consider_goals4/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ Person.class
33
--cover location --no-trivial-tests
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\*\* 15 of 23 covered (65.2%)
6+
^\*\* 14 of 22 covered (63.6%)
77
--
88
^warning: ignoring

regression/cbmc-cover/consider_goals5/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ Person.class
33
--cover location --no-trivial-tests
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\*\* 16 of 24 covered (66.7%)
6+
^\*\* 15 of 23 covered (65.2%)
77
--
88
^warning: ignoring

regression/cbmc-cover/consider_goals6/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ Account.class
33
--cover location --no-trivial-tests
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\*\* 17 of 18 covered (94.4%)
6+
^\*\* 13 of 13 covered (100.0%)
77
--
88
^warning: ignoring

src/goto-instrument/cover.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Date: May 2016
88
99
\*******************************************************************/
1010

11+
#include <iostream>
12+
1113
#include <algorithm>
1214
#include <iterator>
1315

@@ -1608,9 +1610,12 @@ bool consider_goals(
16081610
++count_decl;
16091611
}
16101612

1611-
//this might be a get or set method (pattern)
1612-
result = !((count_decl==0) && (count_goto<=1) &&
1613-
(count_assignments>0 && count_assignments<5));
1613+
//check whether this is a constructor/destructor or a get/set (pattern)
1614+
if (!count_goto && !count_assignments && !count_decl)
1615+
result=false;
1616+
else
1617+
result = !((count_decl==0) && (count_goto<=1) &&
1618+
(count_assignments>0 && count_assignments<5));
16141619

16151620
return result;
16161621
}

0 commit comments

Comments
 (0)