MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / runCommandLine

Method runCommandLine

edrav2/eprj/jsoncpp/src/test_lib_json/jsontest.cpp:309–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309int Runner::runCommandLine(int argc, const char* argv[]) const {
310 // typedef std::deque<JSONCPP_STRING> TestNames;
311 Runner subrunner;
312 for (int index = 1; index < argc; ++index) {
313 JSONCPP_STRING opt = argv[index];
314 if (opt == "--list-tests") {
315 listTests();
316 return 0;
317 } else if (opt == "--test-auto") {
318 preventDialogOnCrash();
319 } else if (opt == "--test") {
320 ++index;
321 if (index < argc) {
322 size_t testNameIndex;
323 if (testIndex(argv[index], testNameIndex)) {
324 subrunner.add(tests_[testNameIndex]);
325 } else {
326 fprintf(stderr, "Test '%s' does not exist!\n", argv[index]);
327 return 2;
328 }
329 } else {
330 printUsage(argv[0]);
331 return 2;
332 }
333 } else {
334 printUsage(argv[0]);
335 return 2;
336 }
337 }
338 bool succeeded;
339 if (subrunner.testCount() > 0) {
340 succeeded = subrunner.runAllTest(subrunner.testCount() > 1);
341 } else {
342 succeeded = runAllTest(true);
343 }
344 return succeeded ? 0 : 1;
345}
346
347#if defined(_MSC_VER) && defined(_DEBUG)
348// Hook MSVCRT assertions to prevent dialog from appearing

Callers 1

mainFunction · 0.80

Calls 5

printUsageFunction · 0.85
testCountMethod · 0.80
runAllTestMethod · 0.80
listTestsFunction · 0.50
addMethod · 0.45

Tested by

no test coverage detected