| 12 | static std::unique_ptr<GenTestHelper> GenHelper; |
| 13 | |
| 14 | static void SetUpTestCase() { |
| 15 | |
| 16 | const std::string ProjectName = "test_fuzzinputgenerator"; |
| 17 | const std::string LibCode = "void API_1(int P1) {}\n" |
| 18 | "void API_2(const char *P2) {}\n" |
| 19 | "void API_3(int *P1) {}\n"; |
| 20 | |
| 21 | TAHelper = TestHelperFactory().createTATestHelper( |
| 22 | LibCode, "lib", CompileHelper::SourceType_C); |
| 23 | ASSERT_TRUE(TAHelper); |
| 24 | ASSERT_TRUE(TAHelper->analyze()); |
| 25 | |
| 26 | DirectionAnalysisReport DirectionReport; |
| 27 | DirectionReport.set("API_4", 0, Dir_Out); |
| 28 | |
| 29 | FilePathAnalysisReport FilePathReport; |
| 30 | FilePathReport.set("API_2", 0); |
| 31 | |
| 32 | ArrayAnalysisReport ArrayReport; |
| 33 | ArrayReport.set("API_6", 0, 1); |
| 34 | |
| 35 | std::vector<std::string> APINames = {"API_1", "API_2", "API_3", "API_4", |
| 36 | "API_5", "API_6", "API_7"}; |
| 37 | std::vector<std::string> SrcPaths = {getUTSourcePath(ProjectName)}; |
| 38 | auto CH = TestHelperFactory().createCompileHelper( |
| 39 | getProjectBaseDirPath(ProjectName), SrcPaths, "-O0 -g", |
| 40 | CompileHelper::SourceType_C); |
| 41 | ASSERT_TRUE(CH); |
| 42 | |
| 43 | auto AL = std::make_shared<APIManualLoader>( |
| 44 | std::set<std::string>(APINames.begin(), APINames.end())); |
| 45 | ASSERT_TRUE(AL); |
| 46 | |
| 47 | auto Loader = std::make_shared<UTLoader>(CH, AL); |
| 48 | ASSERT_TRUE(Loader); |
| 49 | Loader->setDirectionReport(DirectionReport); |
| 50 | Loader->setFilePathReport(FilePathReport); |
| 51 | Loader->setArrayReport(ArrayReport); |
| 52 | |
| 53 | UAHelper = std::make_shared<UATestHelper>(); |
| 54 | ASSERT_TRUE(UAHelper && UAHelper->analyze(Loader)); |
| 55 | |
| 56 | GenHelper = std::make_unique<GenTestHelper>(UAHelper); |
| 57 | ASSERT_TRUE(GenHelper->generate(getProjectBaseDirPath(ProjectName), |
| 58 | getProjectOutDirPath(ProjectName), |
| 59 | APINames)); |
| 60 | } |
| 61 | |
| 62 | static void TearDownTestCase() { |
| 63 |
nothing calls this directly
no test coverage detected