| 253 | } |
| 254 | |
| 255 | bool runTest(QString file1, QString file2, QString file3, QString expectedResultFile, QString actualResultFile, qsizetype maxLength) |
| 256 | { |
| 257 | gOptions = std::make_unique <Options>(); |
| 258 | Diff3LineList actualDiff3LineList, expectedDiff3LineList; |
| 259 | QByteArray encoding="UTF-8"; |
| 260 | QTextStream out(stdout); |
| 261 | |
| 262 | gOptions->m_bIgnoreCase = false; |
| 263 | gOptions->m_bDiff3AlignBC = true; |
| 264 | |
| 265 | SourceData m_sd1, m_sd2, m_sd3; |
| 266 | |
| 267 | QString msgprefix = "Running test with "; |
| 268 | QString filepattern = QString(file1).replace("_base.", "_*."); |
| 269 | QString msgsuffix = QString("...%1").arg("", maxLength - filepattern.length()); |
| 270 | out << msgprefix << filepattern << msgsuffix; |
| 271 | if(verbose) |
| 272 | { |
| 273 | out << endl; |
| 274 | } |
| 275 | out.flush(); |
| 276 | |
| 277 | m_sd1.setFilename(file1); |
| 278 | m_sd1.readAndPreprocess(encoding, false); |
| 279 | |
| 280 | m_sd2.setFilename(file2); |
| 281 | m_sd2.readAndPreprocess(encoding, false); |
| 282 | |
| 283 | m_sd3.setFilename(file3); |
| 284 | m_sd3.readAndPreprocess(encoding, false); |
| 285 | |
| 286 | determineFileAlignment(m_sd1, m_sd2, m_sd3, actualDiff3LineList); |
| 287 | |
| 288 | loadExpectedAlignmentFile(expectedResultFile, expectedDiff3LineList); |
| 289 | |
| 290 | Diff3LineList::iterator p_actual = actualDiff3LineList.begin(); |
| 291 | Diff3LineList::iterator p_expected = expectedDiff3LineList.begin(); |
| 292 | bool equal = true; |
| 293 | bool sequenceError = false; |
| 294 | bool consistencyError = false; |
| 295 | |
| 296 | equal = (actualDiff3LineList.size() == expectedDiff3LineList.size()); |
| 297 | |
| 298 | int latestLineA = -1; |
| 299 | int latestLineB = -1; |
| 300 | int latestLineC = -1; |
| 301 | while(equal && (p_actual != actualDiff3LineList.end())) |
| 302 | { |
| 303 | /* Check if all line numbers are in sequence */ |
| 304 | if(p_actual->getLineA().isValid()) |
| 305 | { |
| 306 | if(p_actual->getLineA() <= latestLineA) |
| 307 | { |
| 308 | sequenceError = true; |
| 309 | } |
| 310 | else |
| 311 | { |
| 312 | latestLineA = p_actual->getLineA(); |
no test coverage detected