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>
This commit is contained in:
parent
8034bc9e83
commit
693a286600
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user