#include <QHash>
#include <QString>
#include <QStringList>
-
+#include <QUuid>
#include <QTest>
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()