| 19 | std::unique_ptr<Options> gOptions = std::make_unique<Options>(); |
| 20 | |
| 21 | class Diff3LineTest: public QObject |
| 22 | { |
| 23 | Q_OBJECT; |
| 24 | private Q_SLOTS: |
| 25 | void initTestCase() |
| 26 | { |
| 27 | Diff3LineList diffList; |
| 28 | Diff3Line entry; |
| 29 | |
| 30 | QVERIFY(diffList.empty()); |
| 31 | QVERIFY(!entry.isEqualAB()); |
| 32 | QVERIFY(!entry.isEqualBC()); |
| 33 | QVERIFY(!entry.isEqualAC()); |
| 34 | QVERIFY(!entry.isWhiteLine(e_SrcSelector::A)); |
| 35 | QVERIFY(!entry.isWhiteLine(e_SrcSelector::B)); |
| 36 | QVERIFY(!entry.isWhiteLine(e_SrcSelector::C)); |
| 37 | } |
| 38 | |
| 39 | void calcDiffTest() |
| 40 | { |
| 41 | Diff3LineList diff3List; |
| 42 | /* |
| 43 | Start with something simple. This diff list indicates one different line fallowed by three equal lines |
| 44 | *This was generated with a two-way compare. |
| 45 | |
| 46 | Not all functions in Diff3Line will work since there is no data actually loaded. |
| 47 | */ |
| 48 | DiffList diffList = {{0, 1, 1}, {3, 0, 0}}; |
| 49 | |
| 50 | diff3List.calcDiff3LineListUsingAB(&diffList); |
| 51 | QCOMPARE(diff3List.size(), 4); |
| 52 | |
| 53 | Diff3LineList::const_iterator entry = diff3List.begin(); |
| 54 | QCOMPARE(entry->getLineA(), 0); |
| 55 | QCOMPARE(entry->getLineB(), 0); |
| 56 | QCOMPARE(entry->getLineC(), LineRef::invalid); |
| 57 | QVERIFY(!entry->isEqualAB()); |
| 58 | QVERIFY(!entry->isEqualAC()); |
| 59 | QVERIFY(!entry->isEqualBC()); |
| 60 | ++entry; |
| 61 | |
| 62 | QCOMPARE(entry->getLineA(), 1); |
| 63 | QCOMPARE(entry->getLineB(), 1); |
| 64 | QCOMPARE(entry->getLineC(), LineRef::invalid); |
| 65 | QVERIFY(entry->isEqualAB()); |
| 66 | QVERIFY(!entry->isEqualAC()); |
| 67 | QVERIFY(!entry->isEqualBC()); |
| 68 | ++entry; |
| 69 | |
| 70 | QCOMPARE(entry->getLineA(), 2); |
| 71 | QCOMPARE(entry->getLineB(), 2); |
| 72 | QCOMPARE(entry->getLineC(), LineRef::invalid); |
| 73 | QVERIFY(entry->isEqualAB()); |
| 74 | QVERIFY(!entry->isEqualAC()); |
| 75 | QVERIFY(!entry->isEqualBC()); |
| 76 | ++entry; |
| 77 | |
| 78 | QCOMPARE(entry->getLineA(), 3); |
nothing calls this directly
no outgoing calls
no test coverage detected