From 6dd5ec296dd210c53d502b80e406795c143428b4 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 26 Mar 2024 14:05:35 +0100 Subject: [PATCH] Convert qDebug() to report_info() in testing code Signed-off-by: Berthold Stoeger --- tests/testgitstorage.cpp | 6 +++--- tests/testparseperformance.cpp | 6 +++--- tests/testplan.cpp | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/testgitstorage.cpp b/tests/testgitstorage.cpp index 35959c4c3..cdac7f1b3 100644 --- a/tests/testgitstorage.cpp +++ b/tests/testgitstorage.cpp @@ -6,6 +6,7 @@ #include "core/dive.h" #include "core/divelist.h" #include "core/divelog.h" +#include "core/errorhelper.h" #include "core/file.h" #include "core/subsurface-string.h" #include "core/format.h" @@ -19,7 +20,6 @@ #include #include #include -#include #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) #include #endif @@ -132,8 +132,8 @@ void TestGitStorage::initTestCase() cloudTestRepo = gitUrl + "[" + randomBranch + ']'; localCacheDir = get_local_dir(gitUrl.c_str(), randomBranch.c_str()); localCacheRepo = localCacheDir + "[" + randomBranch + "]"; - qDebug() << "repo used:" << cloudTestRepo.c_str(); - qDebug() << "local cache:" << localCacheRepo.c_str(); + report_info("repo used: %s", cloudTestRepo.c_str()); + report_info("local cache: %s", localCacheRepo.c_str()); // make sure we deal with any proxy settings that are needed QNetworkProxy proxy; diff --git a/tests/testparseperformance.cpp b/tests/testparseperformance.cpp index 4c8f66b56..eac021da8 100644 --- a/tests/testparseperformance.cpp +++ b/tests/testparseperformance.cpp @@ -3,13 +3,13 @@ #include "core/device.h" #include "core/divelog.h" #include "core/divesite.h" +#include "core/errorhelper.h" #include "core/trip.h" #include "core/file.h" #include "core/git-access.h" #include "core/settings/qPrefProxy.h" #include "core/settings/qPrefCloudStorage.h" #include -#include #include #include "QTextCodec" @@ -61,8 +61,8 @@ void TestParsePerformance::parseSsrf() // parsing of a V2 file should work QFile largeSsrfFile(SUBSURFACE_TEST_DATA "/dives/large-anon.ssrf"); if (!largeSsrfFile.exists()) { - qDebug() << "missing large sample data file - available at " LARGE_TEST_REPO; - qDebug() << "clone the repo, uncompress the file and copy it to " SUBSURFACE_TEST_DATA "/dives/large-anon.ssrf"; + report_info("missing large sample data file - available at " LARGE_TEST_REPO); + report_info("clone the repo, uncompress the file and copy it to " SUBSURFACE_TEST_DATA "/dives/large-anon.ssrf"); return; } QBENCHMARK { diff --git a/tests/testplan.cpp b/tests/testplan.cpp index 74448a1a1..b916d8f27 100644 --- a/tests/testplan.cpp +++ b/tests/testplan.cpp @@ -3,11 +3,11 @@ #include "core/deco.h" #include "core/dive.h" #include "core/event.h" +#include "core/errorhelper.h" #include "core/planner.h" #include "core/qthelper.h" #include "core/subsurfacestartup.h" #include "core/units.h" -#include #define DEBUG 1 @@ -425,18 +425,18 @@ bool compareDecoTime(int actualRunTimeSeconds, int benchmarkRunTimeSeconds, int int totalDifferenceAllowed = lrint(0.001 * permilDifferenceAllowed * benchmarkRunTimeSeconds + absoluteDifferenceAllowedSeconds); int totalDifference = abs(actualRunTimeSeconds - benchmarkRunTimeSeconds); - qDebug("Calculated run time = %d seconds", actualRunTimeSeconds); - qDebug("Expected run time = %d seconds", benchmarkRunTimeSeconds); - qDebug("Allowed time difference is %g percent plus %d seconds = %d seconds", + report_info("Calculated run time = %d seconds", actualRunTimeSeconds); + report_info("Expected run time = %d seconds", benchmarkRunTimeSeconds); + report_info("Allowed time difference is %g percent plus %d seconds = %d seconds", permilDifferenceAllowed * 0.1, absoluteDifferenceAllowedSeconds, totalDifferenceAllowed); - qDebug("total difference = %d seconds", totalDifference); + report_info("total difference = %d seconds", totalDifference); result = (totalDifference <= totalDifferenceAllowed); } if ((knownSsrfRunTimeSeconds > 0) && (actualRunTimeSeconds != knownSsrfRunTimeSeconds)) { - QWARN("Calculated run time does not match known Subsurface runtime"); - qWarning("Calculated runtime: %d", actualRunTimeSeconds); - qWarning("Known Subsurface runtime: %d", knownSsrfRunTimeSeconds); + report_error("Calculated run time does not match known Subsurface runtime"); + report_error("Calculated runtime: %d", actualRunTimeSeconds); + report_error("Known Subsurface runtime: %d", knownSsrfRunTimeSeconds); } return result; }