CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
require_goto_statements.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Unit test utilities
4
5Author: Diffblue Ltd.
6
7\*******************************************************************/
8
11
13
14#include <regex>
15
17
18#ifndef CPROVER_JAVA_TESTING_UTILS_REQUIRE_GOTO_STATEMENTS_H
19#define CPROVER_JAVA_TESTING_UTILS_REQUIRE_GOTO_STATEMENTS_H
20
21// NOLINTNEXTLINE(readability/namespace)
23{
25{
26 std::optional<code_assignt> null_assignment;
27 std::vector<code_assignt> non_null_assignments;
28};
29
30class no_decl_found_exceptiont : public std::exception
31{
32public:
33 explicit no_decl_found_exceptiont(const std::string &var_name)
34 : message{"Failed to find declaration for: " + var_name}
35 {
36 }
37
38 virtual const char *what() const throw()
39 {
40 return message.c_str();
41 }
42
43private:
44 std::string message;
45};
46
48 const std::vector<codet> &statements,
50 const std::optional<irep_idt> &superclass_name,
51 const irep_idt &component_name,
52 const symbol_table_baset &symbol_table);
53
55 const std::vector<codet> &statements,
56 const irep_idt &component_name);
57
58std::vector<codet> get_all_statements(const exprt &function_value);
59
60const std::vector<codet>
62
65 const std::vector<codet> &instructions);
66
68 const std::regex &pointer_name_match,
69 const std::vector<codet> &instructions);
70
73 const std::vector<codet> &entry_point_instructions);
74
77 const std::optional<irep_idt> &superclass_name,
78 const irep_idt &component_name,
80 const std::optional<irep_idt> &typecast_name,
81 const std::vector<codet> &entry_point_instructions,
82 const symbol_table_baset &symbol_table);
83
86 const std::optional<irep_idt> &superclass_name,
89 const std::vector<codet> &entry_point_instructions,
90 const symbol_table_baset &symbol_table);
91
94 const std::vector<codet> &entry_point_statements);
95
96std::vector<code_function_callt> find_function_calls(
97 const std::vector<codet> &statements,
99}
100
101#endif // CPROVER_JAVA_TESTING_UTILS_REQUIRE_GOTO_STATEMENTS_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
A goto_instruction_codet representing the declaration of a local variable.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
Base class for all expressions.
Definition expr.h:56
The symbol table base class interface.
irep_idt require_entry_point_argument_assignment(const irep_idt &argument_name, const std::vector< codet > &entry_point_statements)
Checks that the input argument (of method under test) with given name is assigned a single non-null o...
std::vector< code_function_callt > find_function_calls(const std::vector< codet > &statements, const irep_idt &function_call_identifier)
Verify that a collection of statements contains a function call to a function whose symbol identifier...
std::vector< codet > get_all_statements(const exprt &function_value)
Expand value of a function to include all child codets.
pointer_assignment_locationt find_struct_component_assignments(const std::vector< codet > &statements, const irep_idt &structure_name, const std::optional< irep_idt > &superclass_name, const irep_idt &component_name, const symbol_table_baset &symbol_table)
Find assignment statements of the form:
pointer_assignment_locationt find_pointer_assignments(const irep_idt &pointer_name, const std::vector< codet > &instructions)
For a given variable name, gets the assignments to it in the provided instructions.
const std::vector< codet > require_entry_point_statements(const symbol_table_baset &symbol_table)
pointer_assignment_locationt find_this_component_assignment(const std::vector< codet > &statements, const irep_idt &component_name)
Find assignment statements that set this->{component_name}.
irep_idt require_struct_component_assignment(const irep_idt &structure_name, const std::optional< irep_idt > &superclass_name, const irep_idt &component_name, const irep_idt &component_type_name, const std::optional< irep_idt > &typecast_name, const std::vector< codet > &entry_point_instructions, const symbol_table_baset &symbol_table)
Checks that the component of the structure (possibly inherited from the superclass) is assigned an ob...
const code_declt & require_declaration_of_name(const irep_idt &variable_name, const std::vector< codet > &entry_point_instructions)
Find the declaration of the specific variable.
const irep_idt & require_struct_array_component_assignment(const irep_idt &structure_name, const std::optional< irep_idt > &superclass_name, const irep_idt &array_component_name, const irep_idt &array_type_name, const std::vector< codet > &entry_point_instructions, const symbol_table_baset &symbol_table)
Checks that the array component of the structure (possibly inherited from the superclass) is assigned...