ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
ctest.h
Go to the documentation of this file.
1#ifndef CPROVER_GOTO_SYMEX_CTEST_H
2#define CPROVER_GOTO_SYMEX_CTEST_H
3
6#include <string>
7#include <vector>
8#include <mutex>
9
10class smt_convt;
11
14{
15private:
16 struct test_variable
17 {
18 std::string verifier_type; // "int", "uint", "char", "uchar", "float", etc.
19 // for __VERIFIER_nondet_TYPE
20 std::string c_type; // C type: "int", "unsigned int", "float", etc.
21 std::string value; // The concrete value
22 };
23
24 std::vector<std::vector<test_variable>> test_cases;
25 std::string function_name;
26 std::vector<std::string> source_files;
27 mutable std::mutex data_mutex;
28
32 static std::string fingerprint(const std::vector<test_variable> &tc);
33
35 std::string clean_variable_name(const std::string &name) const;
36
38 std::string extract_function_name(
39 const symex_target_equationt &target,
40 smt_convt &smt_conv) const;
41
43 std::string type_to_c_string(const type2tc &type) const;
44 std::string type_to_verifier_string(const type2tc &type) const;
45
47 std::string format_c_value(const expr2tc &value) const;
48
49public:
50 ctest_generator() = default;
51
54 static constexpr const char *default_output_dir = "esbmc-ctest";
55
57 void clear();
58
61 void collect(
62 const symex_target_equationt &target,
63 smt_convt &smt_conv,
64 const namespacet &ns);
65
68 void generate(const std::string &output_dir) const;
69
71 void generate_single(
72 const std::string &output_dir,
73 const symex_target_equationt &target,
74 smt_convt &smt_conv,
75 const namespacet &ns);
76
78 bool has_tests() const;
79};
80
81#endif
bool has_tests() const
Check if any test cases have been collected.
Definition ctest.cpp:405
void generate_single(const std::string &output_dir, const symex_target_equationt &target, smt_convt &smt_conv, const namespacet &ns)
Single-shot generation for non-coverage mode.
Definition ctest.cpp:713
void generate(const std::string &output_dir) const
Generate C test files and CMakeLists.txt from collected data into output_dir.
Definition ctest.cpp:626
ctest_generator()=default
void clear()
Clear collected data (called at start of coverage run).
Definition ctest.cpp:350
void collect(const symex_target_equationt &target, smt_convt &smt_conv, const namespacet &ns)
Collect test data from a counterexample (called for each CEX in coverage mode).
Definition ctest.cpp:358
static constexpr const char * default_output_dir
Output goes to a dedicated subdirectory: writing into the working directory silently destroyed files ...
Definition ctest.h:54
Definition namespace.h:10
Slim, frontend-facing SMT interface.
Definition smt_conv.h:30
Definition symex_target_equation.h:21
Definition toml.hpp:1531
irep_container< type2t > type2tc
Definition irep2.h:430
irep_container< expr2t > expr2tc
Definition irep2.h:431