diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2016-12-27 13:46:13 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-12-27 08:27:21 -0800 |
commit | 3776c285e22de7153ad00d8c0cf8cee1b5dc929f (patch) | |
tree | e22d75be62bf07b9ee9f697a2f3c2450704c8b34 /tests | |
parent | 27b4ef321ade223902ab083aa5a100962c7295f9 (diff) | |
download | subsurface-3776c285e22de7153ad00d8c0cf8cee1b5dc929f.tar.gz |
Test line-by-line for equality on Test
We where testing the whole document, wich made qDebug
completely bogus to see where we failed at testing the
generated file. If we test line-by-line, we can know
more easily where we failed.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testparse.cpp | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/tests/testparse.cpp b/tests/testparse.cpp index e9d313e5d..6f1b6eb16 100644 --- a/tests/testparse.cpp +++ b/tests/testparse.cpp @@ -119,9 +119,11 @@ void TestParse::testParseCompareOutput() out.open(QFile::ReadOnly); QTextStream orgS(&org); QTextStream outS(&out); - QString readin = orgS.readAll(); - QString written = outS.readAll(); - QCOMPARE(readin, written); + QStringList readin = orgS.readAll().split("\n"); + QStringList written = outS.readAll().split("\n"); + while(readin.size() && written.size()){ + QCOMPARE(readin.takeFirst(), written.takeFirst()); + } clear_dive_file_data(); } @@ -144,9 +146,11 @@ void TestParse::testParseCompareDM4Output() out.open(QFile::ReadOnly); QTextStream orgS(&org); QTextStream outS(&out); - QString readin = orgS.readAll(); - QString written = outS.readAll(); - QCOMPARE(readin, written); + QStringList readin = orgS.readAll().split("\n"); + QStringList written = outS.readAll().split("\n"); + while(readin.size() && written.size()){ + QCOMPARE(readin.takeFirst(), written.takeFirst()); + } clear_dive_file_data(); } @@ -211,9 +215,11 @@ void TestParse::testParseCompareHUDCOutput() out.open(QFile::ReadOnly); QTextStream orgS(&org); QTextStream outS(&out); - QString readin = orgS.readAll(); - QString written = outS.readAll(); - QCOMPARE(readin, written); + QStringList readin = orgS.readAll().split("\n"); + QStringList written = outS.readAll().split("\n"); + while(readin.size() && written.size()){ + QCOMPARE(readin.takeFirst(), written.takeFirst()); + } clear_dive_file_data(); } @@ -357,9 +363,11 @@ void TestParse::testParseCompareNewFormatOutput() out.open(QFile::ReadOnly); QTextStream orgS(&org); QTextStream outS(&out); - QString readin = orgS.readAll(); - QString written = outS.readAll(); - QCOMPARE(readin, written); + QStringList readin = orgS.readAll().split("\n"); + QStringList written = outS.readAll().split("\n"); + while(readin.size() && written.size()){ + QCOMPARE(readin.takeFirst(), written.takeFirst()); + } clear_dive_file_data(); } @@ -389,9 +397,11 @@ void TestParse::testParseCompareDLDOutput() out.open(QFile::ReadOnly); QTextStream orgS(&org); QTextStream outS(&out); - QString readin = orgS.readAll(); - QString written = outS.readAll(); - QCOMPARE(readin, written); + QStringList readin = orgS.readAll().split("\n"); + QStringList written = outS.readAll().split("\n"); + while(readin.size() && written.size()){ + QCOMPARE(readin.takeFirst(), written.takeFirst()); + } clear_dive_file_data(); } |