MCPcopy Create free account
hub / github.com/Samsung/UTopia / createLoader

Method createLoader

tests/generation/TestUTModify.cpp:103–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101 }
102
103 std::unique_ptr<GenLoader>
104 createLoader(SourceFileManager &SFM, const std::set<std::string> APINames,
105 const std::string TargetName,
106 const std::set<std::string> UTNames) const {
107 std::vector<std::string> TargetSrcPaths = {SFM.getFilePath(TargetName)};
108 auto TAHelper = TestHelperFactory().createTATestHelper(
109 SFM.getSrcDirPath(), TargetSrcPaths, CompileHelper::SourceType_CPP);
110 if (!TAHelper || !TAHelper->analyze())
111 return nullptr;
112
113 std::string TAReportDirPath = SFM.getSrcDirPath() + "/target";
114 if (!fs::create_directories(TAReportDirPath))
115 return nullptr;
116
117 std::string TAReportPath = TAReportDirPath + "/TA.json";
118 if (!TAHelper->dumpReport(TAReportPath))
119 return nullptr;
120
121 if (!SFM.addFile(TAReportPath))
122 return nullptr;
123
124 std::shared_ptr<APILoader> AL = std::make_shared<APIManualLoader>(APINames);
125 if (!AL)
126 return nullptr;
127
128 std::vector<std::string> UTPaths;
129 for (const auto &UTName : UTNames)
130 UTPaths.emplace_back(SFM.getFilePath(UTName));
131
132 auto UAHelper = TestHelperFactory().createUATestHelper(
133 SFM.getSrcDirPath(), UTPaths, CompileHelper::SourceType_CPP);
134 if (!UAHelper || !UAHelper->analyze(TAReportDirPath, AL, "gtest"))
135 return nullptr;
136
137 std::string UAReportPath = SFM.getSrcDirPath() + "/UA.json";
138 if (!UAHelper->dumpReport(UAReportPath))
139 return nullptr;
140 SFM.addFile(UAReportPath);
141
142 auto Loader = std::make_unique<GenLoader>();
143 if (!Loader || !Loader->load(TAReportDirPath, SFM.getFilePath("UA.json")))
144 return nullptr;
145
146 return Loader;
147 }
148};
149
150TEST_F(TestUTModify, ModifyP) {

Callers

nothing calls this directly

Calls 9

TestHelperFactoryClass · 0.85
createTATestHelperMethod · 0.80
getSrcDirPathMethod · 0.80
dumpReportMethod · 0.80
addFileMethod · 0.80
createUATestHelperMethod · 0.80
getFilePathMethod · 0.45
analyzeMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected