-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
48 lines (32 loc) · 1.19 KB
/
main.cpp
File metadata and controls
48 lines (32 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "PrintMatcher.hpp"
#include "TestBuilder.hpp"
#include "StructParser.hpp"
#include "test.h"
#include "test_main.h"
static llvm::cl::OptionCategory MyToolCategory("my-tool options");
void generate_tests(int argc, char **argv)
{
const char **cargv = const_cast<const char **>(argv);
CommonOptionsParser OptionsParser(argc, cargv, MyToolCategory);
ClangTool Tool(OptionsParser.getCompilations(),
OptionsParser.getSourcePathList());
DeclarationMatcher Matcher = functionDecl().bind("FunctionDecl");
auto [t, s] = TestBuilder::get_tests_and_signatures(Tool, Matcher);
auto sign = s.at(0);
TestMain test_main(1, argv);
test_main.fuzz(sign, 5).run();
}
void test_struct_parsing(int argc, char **argv)
{
const char **cargv = const_cast<const char **>(argv);
CommonOptionsParser OptionsParser(argc, cargv, MyToolCategory);
ClangTool Tool(OptionsParser.getCompilations(),
OptionsParser.getSourcePathList());
DeclarationMatcher Matcher = recordDecl(isStruct()).bind("StructDecl");
StructParser::print_structures(Tool, Matcher);
}
int main(int argc, char **argv)
{
test_struct_parsing(argc, argv);
return 0;
}