cprover
cover.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Coverage Instrumentation
4 
5 Author: Daniel Kroening
6 
7 Date: May 2016
8 
9 \*******************************************************************/
10 
13 
14 #ifndef CPROVER_GOTO_INSTRUMENT_COVER_H
15 #define CPROVER_GOTO_INSTRUMENT_COVER_H
16 
17 #include "cover_filter.h"
18 #include "cover_instrument.h"
19 #include "util/make_unique.h"
20 
21 class cmdlinet;
22 class goto_modelt;
24 class message_handlert;
25 class optionst;
26 
27 #define OPT_COVER \
28  "(cover):" \
29  "(cover-failed-assertions)" \
30  "(show-test-suite)"
31 
32 #define HELP_COVER \
33  " --cover CC create test-suite with coverage criterion " \
34  "CC\n" \
35  " --cover-failed-assertions do not stop coverage checking at failed " \
36  "assertions\n" \
37  " (this is the default for --cover " \
38  "assertions)\n" \
39  " --show-test-suite print test suite for coverage criterion " \
40  "(requires --cover)\n"
41 
43 {
44  LOCATION,
45  BRANCH,
46  DECISION,
47  CONDITION,
48  PATH,
49  MCDC,
50  ASSERTION,
51  COVER // __CPROVER_cover(x) annotations
52 };
53 
55 {
61  // cover instruments point to goal_filters, so they must be stored on the heap
62  std::unique_ptr<goal_filterst> goal_filters =
63  util_make_unique<goal_filterst>();
67 };
68 
70  const symbol_tablet &,
71  const cover_configt &,
74  message_handlert &message_handler);
75 
77  const symbol_tablet &,
78  const cover_configt &,
79  goto_programt &,
81  message_handlert &message_handler);
82 
85 
87  const optionst &,
88  const irep_idt &main_function_id,
89  const symbol_tablet &,
91 
93  const cover_configt &,
96 
97 void parse_cover_options(const cmdlinet &, optionst &);
98 
100  const cover_configt &,
101  const symbol_tablet &,
102  goto_functionst &,
103  message_handlert &);
104 
106  const cover_configt &,
107  goto_modelt &,
108  message_handlert &);
109 
110 #endif // CPROVER_GOTO_INSTRUMENT_COVER_H
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:37
get_cover_config
cover_configt get_cover_config(const optionst &, const symbol_tablet &, message_handlert &)
Build data structures controlling coverage from command-line options.
Definition: cover.cpp:180
symbol_tablet
The symbol table.
Definition: symbol_table.h:14
complexity_violationt::NONE
@ NONE
cover_configt::goal_filters
std::unique_ptr< goal_filterst > goal_filters
Definition: cover.h:62
optionst
Definition: options.h:23
parse_cover_options
void parse_cover_options(const cmdlinet &, optionst &)
Parses coverage-related command line options.
Definition: cover.cpp:142
cover_configt::cover_failed_assertions
bool cover_failed_assertions
Definition: cover.h:57
goto_modelt
Definition: goto_model.h:26
coverage_criteriont
coverage_criteriont
Definition: cover.h:43
cover_configt::mode
irep_idt mode
Definition: cover.h:59
coverage_criteriont::LOCATION
@ LOCATION
cover_configt::cover_instrumenters
cover_instrumenterst cover_instrumenters
Definition: cover.h:64
cmdlinet
Definition: cmdline.h:21
goto_programt::make_assertion
static instructiont make_assertion(const exprt &g, const source_locationt &l=source_locationt::nil())
Definition: goto_program.h:951
instrument_cover_goals
void instrument_cover_goals(const symbol_tablet &, const cover_configt &, goto_functionst &, coverage_criteriont, message_handlert &message_handler)
make_unique.h
cover_configt::traces_must_terminate
bool traces_must_terminate
Definition: cover.h:58
cover_configt::make_assertion
cover_instrumenter_baset::assertion_factoryt make_assertion
Definition: cover.h:65
cover_instrument.h
Coverage Instrumentation.
message_handlert
Definition: message.h:28
cover_instrumenter_baset::assertion_factoryt
std::function< goto_programt::instructiont(const exprt &, const source_locationt &)> assertion_factoryt
The type of function used to make goto_program assertions.
Definition: cover_instrument.h:42
goto_functionst
A collection of goto functions.
Definition: goto_functions.h:25
cover_configt::function_filters
function_filterst function_filters
Definition: cover.h:60
goto_programt
A generic container class for the GOTO intermediate representation of one function.
Definition: goto_program.h:71
cover_configt
Definition: cover.h:55
function_filterst
A collection of function filters to be applied in conjunction.
Definition: cover_filter.h:62
goto_model_functiont
Interface providing access to a single function in a GOTO model, plus its associated symbol table.
Definition: goto_model.h:183
cover_filter.h
Filters for the Coverage Instrumentation.
cover_configt::keep_assertions
bool keep_assertions
Definition: cover.h:56
cover_instrumenterst
A collection of instrumenters to be run.
Definition: cover_instrument.h:103