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>
This commit is contained in:
Tomaz Canabrava 2016-12-27 13:46:13 +01:00 committed by Dirk Hohndel
parent 27b4ef321a
commit 3776c285e2

View file

@ -119,9 +119,11 @@ void TestParse::testParseCompareOutput()
out.open(QFile::ReadOnly); out.open(QFile::ReadOnly);
QTextStream orgS(&org); QTextStream orgS(&org);
QTextStream outS(&out); QTextStream outS(&out);
QString readin = orgS.readAll(); QStringList readin = orgS.readAll().split("\n");
QString written = outS.readAll(); QStringList written = outS.readAll().split("\n");
QCOMPARE(readin, written); while(readin.size() && written.size()){
QCOMPARE(readin.takeFirst(), written.takeFirst());
}
clear_dive_file_data(); clear_dive_file_data();
} }
@ -144,9 +146,11 @@ void TestParse::testParseCompareDM4Output()
out.open(QFile::ReadOnly); out.open(QFile::ReadOnly);
QTextStream orgS(&org); QTextStream orgS(&org);
QTextStream outS(&out); QTextStream outS(&out);
QString readin = orgS.readAll(); QStringList readin = orgS.readAll().split("\n");
QString written = outS.readAll(); QStringList written = outS.readAll().split("\n");
QCOMPARE(readin, written); while(readin.size() && written.size()){
QCOMPARE(readin.takeFirst(), written.takeFirst());
}
clear_dive_file_data(); clear_dive_file_data();
} }
@ -211,9 +215,11 @@ void TestParse::testParseCompareHUDCOutput()
out.open(QFile::ReadOnly); out.open(QFile::ReadOnly);
QTextStream orgS(&org); QTextStream orgS(&org);
QTextStream outS(&out); QTextStream outS(&out);
QString readin = orgS.readAll(); QStringList readin = orgS.readAll().split("\n");
QString written = outS.readAll(); QStringList written = outS.readAll().split("\n");
QCOMPARE(readin, written); while(readin.size() && written.size()){
QCOMPARE(readin.takeFirst(), written.takeFirst());
}
clear_dive_file_data(); clear_dive_file_data();
} }
@ -357,9 +363,11 @@ void TestParse::testParseCompareNewFormatOutput()
out.open(QFile::ReadOnly); out.open(QFile::ReadOnly);
QTextStream orgS(&org); QTextStream orgS(&org);
QTextStream outS(&out); QTextStream outS(&out);
QString readin = orgS.readAll(); QStringList readin = orgS.readAll().split("\n");
QString written = outS.readAll(); QStringList written = outS.readAll().split("\n");
QCOMPARE(readin, written); while(readin.size() && written.size()){
QCOMPARE(readin.takeFirst(), written.takeFirst());
}
clear_dive_file_data(); clear_dive_file_data();
} }
@ -389,9 +397,11 @@ void TestParse::testParseCompareDLDOutput()
out.open(QFile::ReadOnly); out.open(QFile::ReadOnly);
QTextStream orgS(&org); QTextStream orgS(&org);
QTextStream outS(&out); QTextStream outS(&out);
QString readin = orgS.readAll(); QStringList readin = orgS.readAll().split("\n");
QString written = outS.readAll(); QStringList written = outS.readAll().split("\n");
QCOMPARE(readin, written); while(readin.size() && written.size()){
QCOMPARE(readin.takeFirst(), written.takeFirst());
}
clear_dive_file_data(); clear_dive_file_data();
} }