From f28aab7bd9dbfe59f9cb70bcc25d2c3f6a192849 Mon Sep 17 00:00:00 2001 From: Jeremie Guichard <djebrest@gmail.com> Date: Sat, 25 Feb 2017 23:00:58 +0700 Subject: Fix trailing '\r' test failure on Windows Windows implementation of fwrite changes \n to \r\n for files opened in text mode. It caused failures in TestMerge and TestParse when comparing written files against reference data. Signed-off-by: Jeremie Guichard <djebrest@gmail.com> --- tests/testmerge.cpp | 4 ++-- tests/testparse.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/testmerge.cpp b/tests/testmerge.cpp index 6661880d1..4ff317ad3 100644 --- a/tests/testmerge.cpp +++ b/tests/testmerge.cpp @@ -29,7 +29,7 @@ void TestMerge::testMergeEmpty() QStringList readin = orgS.readAll().split("\n"); QStringList written = outS.readAll().split("\n"); while(readin.size() && written.size()){ - QCOMPARE(readin.takeFirst(), written.takeFirst()); + QCOMPARE(readin.takeFirst().trimmed(), written.takeFirst().trimmed()); } clear_dive_file_data(); } @@ -53,7 +53,7 @@ void TestMerge::testMergeBackwards() QStringList readin = orgS.readAll().split("\n"); QStringList written = outS.readAll().split("\n"); while(readin.size() && written.size()){ - QCOMPARE(readin.takeFirst(), written.takeFirst()); + QCOMPARE(readin.takeFirst().trimmed(), written.takeFirst().trimmed()); } clear_dive_file_data(); } diff --git a/tests/testparse.cpp b/tests/testparse.cpp index a42a53fc8..a85a7c141 100644 --- a/tests/testparse.cpp +++ b/tests/testparse.cpp @@ -122,7 +122,7 @@ void TestParse::testParseCompareOutput() QStringList readin = orgS.readAll().split("\n"); QStringList written = outS.readAll().split("\n"); while(readin.size() && written.size()){ - QCOMPARE(readin.takeFirst(), written.takeFirst()); + QCOMPARE(readin.takeFirst().trimmed(), written.takeFirst().trimmed()); } clear_dive_file_data(); } @@ -149,7 +149,7 @@ void TestParse::testParseCompareDM4Output() QStringList readin = orgS.readAll().split("\n"); QStringList written = outS.readAll().split("\n"); while(readin.size() && written.size()){ - QCOMPARE(readin.takeFirst(), written.takeFirst()); + QCOMPARE(readin.takeFirst().trimmed(), written.takeFirst().trimmed()); } clear_dive_file_data(); } @@ -222,7 +222,7 @@ void TestParse::testParseCompareHUDCOutput() QStringList written = outS.readAll().split("\n"); while(readin.size() && written.size()){ - QCOMPARE(readin.takeFirst(), written.takeFirst()); + QCOMPARE(readin.takeFirst().trimmed(), written.takeFirst().trimmed()); } clear_dive_file_data(); @@ -379,7 +379,7 @@ void TestParse::testParseCompareNewFormatOutput() // currently the CSV parse fails // while(readin.size() && written.size()){ -// QCOMPARE(readin.takeFirst(), written.takeFirst()); +// QCOMPARE(readin.takeFirst().trimmed(), written.takeFirst().trimmed()); // } clear_dive_file_data(); @@ -414,7 +414,7 @@ void TestParse::testParseCompareDLDOutput() QStringList readin = orgS.readAll().split("\n"); QStringList written = outS.readAll().split("\n"); while(readin.size() && written.size()){ - QCOMPARE(readin.takeFirst(), written.takeFirst()); + QCOMPARE(readin.takeFirst().trimmed(), written.takeFirst().trimmed()); } clear_dive_file_data(); } @@ -436,7 +436,7 @@ void TestParse::testParseMerge() QStringList readin = orgS.readAll().split("\n"); QStringList written = outS.readAll().split("\n"); while(readin.size() && written.size()){ - QCOMPARE(readin.takeFirst(), written.takeFirst()); + QCOMPARE(readin.takeFirst().trimmed(), written.takeFirst().trimmed()); } clear_dive_file_data(); } -- cgit v1.2.3-70-g09d2