MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / validateRef

Function validateRef

engine/Evaluator/Validate.cpp:360–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358}
359
360ValidationSummary validateRef(const std::string& refDir, GameState& gs, bool verbose)
361{
362 ValidationSummary summary;
363 EvalState& state = static_cast<EvalState&>(gs);
364 auto files = listFiles(refDir, ".json");
365
366 for (auto& file : files)
367 {
368 std::string content = readAll(file);
369 if (content.empty())
370 continue;
371
372 std::string fname = extractJsonString(content, "name");
373 if (fname.empty())
374 {
375 size_t sep = file.find_last_of("/\\");
376 fname = sep != std::string::npos ? file.substr(sep + 1) : file;
377 }
378
379 std::string exArr = extractJsonStringArray(content, "examples");
380 auto examples = parseStringArray(exArr);
381
382 for (int i = 0; i < (int)examples.size(); i++)
383 {
384 std::string src = fname;
385 auto res = tryEval(src, i, examples[i], "sqf", state);
386
387 if (res.status == "pass")
388 summary.passed++;
389 else if (res.status == "fail")
390 summary.failed++;
391 else
392 summary.skipped++;
393
394 if (verbose || res.status != "pass")
395 summary.results.push_back(res);
396 }
397 }
398 return summary;
399}

Callers 2

ValidateRefMethod · 0.85
test_validate.cppFile · 0.85

Calls 8

listFilesFunction · 0.85
readAllFunction · 0.85
extractJsonStringFunction · 0.85
extractJsonStringArrayFunction · 0.85
parseStringArrayFunction · 0.85
tryEvalFunction · 0.85
sizeMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected