summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-01-26 14:30:06 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-01-27 13:39:37 (GMT)
commitb88141c7505e10ffaa25cc20b444da8e2cc6d9c7 (patch)
tree93a7e8ba8998ed7f7a32e2445e792aa44636be12 /tests
parent97f7c9afb295140a7d979203f41d91082ee73cd9 (diff)
downloadQt-b88141c7505e10ffaa25cc20b444da8e2cc6d9c7.zip
Qt-b88141c7505e10ffaa25cc20b444da8e2cc6d9c7.tar.gz
Qt-b88141c7505e10ffaa25cc20b444da8e2cc6d9c7.tar.bz2
BenchLib: update the result format and self-test.
Since BenchLib now uses floating point for its calculations, we should format both the value per-iteration and the total the same way. Otherwise, it would output something like "2e+08" for the total. Reviewed-by: Morten Sørvig
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/selftests/expected_benchlibcallgrind.txt2
-rw-r--r--tests/auto/selftests/tst_selftests.cpp13
2 files changed, 9 insertions, 6 deletions
diff --git a/tests/auto/selftests/expected_benchlibcallgrind.txt b/tests/auto/selftests/expected_benchlibcallgrind.txt
index caf2424..f172711 100644
--- a/tests/auto/selftests/expected_benchlibcallgrind.txt
+++ b/tests/auto/selftests/expected_benchlibcallgrind.txt
@@ -2,7 +2,7 @@
Config: Using QTest library 4.5.0, Qt 4.5.0
PASS : tst_BenchlibCallgrind::initTestCase()
RESULT : tst_BenchlibCallgrind::twoHundredMillionInstructions():
- 200,000,000 instr. loads per iteration (total: 200000000, iterations: 1)
+ 200,000,000 instruction reads per iteration (total: 200000000, iterations: 1)
PASS : tst_BenchlibCallgrind::twoHundredMillionInstructions()
PASS : tst_BenchlibCallgrind::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 89ece0f..6608439 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -97,7 +97,7 @@ inline bool qCompare
if (r1.unit == "msec") {
variance = 0.1;
}
- else if (r1.unit == "instr. loads") {
+ else if (r1.unit == "instruction reads") {
variance = 0.001;
}
else if (r1.unit == "ticks") {
@@ -434,7 +434,7 @@ BenchmarkResult BenchmarkResult::parse(QString const& line, QString* error)
/* This code avoids using a QRegExp because QRegExp might be broken. */
- /* Sample format: 4,000 msec per iteration (total: 4000, iterations: 1) */
+ /* Sample format: 4,000 msec per iteration (total: 4,000, iterations: 1) */
QString sFirstNumber;
while (!remaining.isEmpty() && !remaining.at(0).isSpace()) {
@@ -468,7 +468,7 @@ BenchmarkResult BenchmarkResult::parse(QString const& line, QString* error)
remaining = remaining.mid(sizeof(periterbit)-1);
- /* Remaining: 4000, iterations: 1) */
+ /* Remaining: 4,000, iterations: 1) */
static const char itersbit[] = ", iterations: ";
QString sTotal;
while (!remaining.startsWith(itersbit) && !remaining.isEmpty()) {
@@ -482,9 +482,12 @@ BenchmarkResult BenchmarkResult::parse(QString const& line, QString* error)
remaining = remaining.mid(sizeof(itersbit)-1);
- qint64 total = sTotal.toLongLong(&ok);
+ /* 4,000 -> 4000 */
+ sTotal.remove(',');
+
+ double total = sTotal.toDouble(&ok);
if (!ok) {
- if (error) *error = sTotal + " (total) is not a valid integer";
+ if (error) *error = sTotal + " (total) is not a valid number";
return out;
}