MCPcopy Create free account
hub / github.com/SOUI2/soui / runTest

Function runTest

third-part/jsoncpp/src/jsontestrunner/main.cpp:273–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271 return 0;
272}
273static int runTest(Options const& opts)
274{
275 int exitCode = 0;
276
277 JSONCPP_STRING input = readInputTestFile(opts.path.c_str());
278 if (input.empty()) {
279 printf("Failed to read input or empty input: %s\n", opts.path.c_str());
280 return 3;
281 }
282
283 JSONCPP_STRING basePath = removeSuffix(opts.path, ".json");
284 if (!opts.parseOnly && basePath.empty()) {
285 printf("Bad input path. Path does not end with '.expected':\n%s\n",
286 opts.path.c_str());
287 return 3;
288 }
289
290 JSONCPP_STRING const actualPath = basePath + ".actual";
291 JSONCPP_STRING const rewritePath = basePath + ".rewrite";
292 JSONCPP_STRING const rewriteActualPath = basePath + ".actual-rewrite";
293
294 Json::Value root;
295 exitCode = parseAndSaveValueTree(
296 input, actualPath, "input",
297 opts.features, opts.parseOnly, &root);
298 if (exitCode || opts.parseOnly) {
299 return exitCode;
300 }
301 JSONCPP_STRING rewrite;
302 exitCode = rewriteValueTree(rewritePath, root, opts.write, &rewrite);
303 if (exitCode) {
304 return exitCode;
305 }
306 Json::Value rewriteRoot;
307 exitCode = parseAndSaveValueTree(
308 rewrite, rewriteActualPath, "rewrite",
309 opts.features, opts.parseOnly, &rewriteRoot);
310 if (exitCode) {
311 return exitCode;
312 }
313 return 0;
314}
315int main(int argc, const char* argv[]) {
316 Options opts;
317 try {

Callers 1

mainFunction · 0.85

Calls 6

readInputTestFileFunction · 0.85
removeSuffixFunction · 0.85
parseAndSaveValueTreeFunction · 0.70
rewriteValueTreeFunction · 0.70
c_strMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected