MCPcopy Create free account
hub / github.com/KDE/kdiff3 / main

Function main

test/alignmenttest.cpp:440–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

438
439
440int main(int argc, char *argv[])
441{
442 bool allOk = true;
443 qsizetype maxLength = 0;
444 QTextStream out(stdout);
445 QDir testdatadir("testdata");
446
447 /* Print data at various steps in the algorithm to get an idea where to look for the root cause of a failing test */
448 if((argc == 2) && (!strcmp(argv[1], "-v")))
449 {
450 verbose = true;
451 }
452
453 QStringList baseFiles = gettestdatafiles("testdata");
454 QListIterator<QString> it(baseFiles);
455
456 for (qsizetype i = 0; i < baseFiles.size(); i++)
457 {
458 maxLength = std::max<qsizetype>(baseFiles.at(i).length(), maxLength);
459 }
460 maxLength += testdatadir.path().length() + 1;
461
462 while (it.hasNext())
463 {
464 QString fileName = it.next();
465
466 QRegularExpression baseFileRegExp("(.*)_base\\.(.*)");
467 QRegularExpressionMatch match = baseFileRegExp.match(fileName);
468
469 QString prefix = match.captured(1);
470 QString suffix = match.captured(2);
471
472 QString contrib1FileName(prefix + "_contrib1." + suffix);
473 QString contrib2FileName(prefix + "_contrib2." + suffix);
474 QString expectedResultFileName(prefix + "_expected_result." + suffix);
475 QString actualResultFileName(prefix + "_actual_result." + suffix);
476
477 if(QFile(contrib1FileName).exists() &&
478 QFile(contrib2FileName).exists() &&
479 QFile(expectedResultFileName).exists())
480 {
481 bool ok = runTest(fileName, contrib1FileName, contrib2FileName, expectedResultFileName, actualResultFileName, maxLength);
482
483 allOk = allOk && ok;
484 }
485 else
486 {
487 out << "Skipping " << fileName << " " << contrib1FileName << " " << contrib2FileName << " " << expectedResultFileName << " " << endl;
488 }
489 }
490
491 out << (allOk ? "All OK" : "Not all OK") << endl;
492
493 return allOk ? 0 : -1;
494}

Callers

nothing calls this directly

Calls 5

gettestdatafilesFunction · 0.85
runTestFunction · 0.85
sizeMethod · 0.45
nextMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected