summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Burchell <robin+qt@viroteck.net>2012-02-28 20:49:19 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-29 22:39:00 +0100
commit693a286600e601fde05049c0819034ed8f7a71d6 (patch)
tree92d0f9c00ce7862e2fef6383022683ab4feb744c /tests
parent8034bc9e833a07c8f4b193849055097f0be7f619 (diff)
Add a test using lots of similar strings.
This attempts to emulate a dictionary usecase of sorts, done in code to avoid bloating the git repository by adding an actual word list. Change-Id: I878bc4af8877ba780ee699932f240c0d9c8ff12c Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/benchmarks/corelib/tools/qhash/main.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/benchmarks/corelib/tools/qhash/main.cpp b/tests/benchmarks/corelib/tools/qhash/main.cpp
index 18138cbd47..db33200d43 100644
--- a/tests/benchmarks/corelib/tools/qhash/main.cpp
+++ b/tests/benchmarks/corelib/tools/qhash/main.cpp
@@ -67,6 +67,8 @@ private:
///////////////////// QHash /////////////////////
+#include <QDebug>
+
void tst_QHash::data()
{
QTest::addColumn<QStringList>("items");
@@ -99,6 +101,40 @@ void tst_QHash::data()
QTest::newRow("uuids-list") << uuids;
}
+ {
+ // lots of strings with alphabetical characters, vaguely reminiscent of
+ // a dictionary.
+ //
+ // this programatically generates a series like:
+ // AAAAAA
+ // AAAAAB
+ // AAAAAC
+ // ...
+ // AAAAAZ
+ // AAAABZ
+ // ...
+ // AAAAZZ
+ // AAABZZ
+ QByteArray id("AAAAAAA");
+ static QStringList dict;
+
+ if (dict.isEmpty()) {
+ for (int i = id.length() - 1; i > 0;) {
+ dict.append(id);
+ char c = id.at(i);
+ id[i] = ++c;
+
+ if (c == 'Z') {
+ // wrap to next digit
+ i--;
+ id[i] = 'A';
+ }
+ }
+ }
+
+ QTest::newRow("dictionary") << dict;
+ }
+
}
void tst_QHash::qhash_qt4()