summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/corelib
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@collabora.com>2012-01-22 14:46:13 +0200
committerQt by Nokia <qt-info@nokia.com>2012-02-14 02:48:35 +0100
commit3af86043ba27c2720b6d61a9457a6aefa4210efd (patch)
tree5254b59c4f19726818f701073b1f37967acbb089 /tests/benchmarks/corelib
parent28f02bcd51b30dd1981159d507b3f2dc215314e2 (diff)
Add a testcase of a list of UUIDs in string form.
UUIDs are a good testcase, because the textual content is all fairly similar. This also changes data generation to be a little neater now that we're starting to get multiple pieces of data. Change-Id: Ie4100a1ca4dbe7bf1cd73de883a9854377ac2f5e Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Diffstat (limited to 'tests/benchmarks/corelib')
-rw-r--r--tests/benchmarks/corelib/tools/qhash/main.cpp36
1 files changed, 30 insertions, 6 deletions
diff --git a/tests/benchmarks/corelib/tools/qhash/main.cpp b/tests/benchmarks/corelib/tools/qhash/main.cpp
index 6f3228d0eb..18138cbd47 100644
--- a/tests/benchmarks/corelib/tools/qhash/main.cpp
+++ b/tests/benchmarks/corelib/tools/qhash/main.cpp
@@ -45,7 +45,7 @@
#include <QHash>
#include <QString>
#include <QStringList>
-
+#include <QUuid>
#include <QTest>
@@ -69,12 +69,36 @@ private:
void tst_QHash::data()
{
- QFile smallPathsData("paths_small_data.txt");
- smallPathsData.open(QIODevice::ReadOnly);
-
QTest::addColumn<QStringList>("items");
- QTest::newRow("paths-small")
- << QString::fromLatin1(smallPathsData.readAll()).split(QLatin1Char('\n'));
+ static QStringList smallFilePaths;
+
+ {
+ // small list of file paths
+ if (smallFilePaths.isEmpty()) {
+ QFile smallPathsData("paths_small_data.txt");
+ QVERIFY(smallPathsData.open(QIODevice::ReadOnly));
+ smallFilePaths = QString::fromLatin1(smallPathsData.readAll()).split(QLatin1Char('\n'));
+ Q_ASSERT(!smallFilePaths.isEmpty());
+ }
+
+ QTest::newRow("paths-small") << smallFilePaths;
+ }
+
+ {
+ // list of UUIDs
+ static QStringList uuids;
+ if (uuids.isEmpty()) {
+ // guaranteed to be completely random, generated by http://xkcd.com/221/
+ QUuid ns = QUuid("{f43d2ef3-2fe9-4563-a6f5-5a0100c2d699}");
+ uuids.reserve(smallFilePaths.size());
+
+ foreach (const QString &path, smallFilePaths)
+ uuids.append(QUuid::createUuidV5(ns, path).toString());
+ }
+
+ QTest::newRow("uuids-list") << uuids;
+ }
+
}
void tst_QHash::qhash_qt4()