Add transform key benchmark to TestKeys.

This commit is contained in:
Felix Geyer 2014-01-19 15:26:32 +01:00
parent 586de64293
commit b07de47e35
2 changed files with 21 additions and 0 deletions

View File

@ -165,4 +165,24 @@ void TestKeys::testFileKeyError()
errorMsg = "";
}
void TestKeys::benchmarkTransformKey()
{
QByteArray env = qgetenv("BENCHMARK");
if (env.isEmpty() || env == "0" || env == "no") {
QSKIP("Benchmark skipped. Set env variable BENCHMARK=1 to enable.", SkipAll);
}
PasswordKey pwKey;
pwKey.setPassword("password");
CompositeKey compositeKey;
compositeKey.addKey(pwKey);
QByteArray seed(32, '\x4B');
QBENCHMARK {
compositeKey.transform(seed, 1e6);
}
}
QTEST_GUILESS_MAIN(TestKeys)

View File

@ -31,6 +31,7 @@ private Q_SLOTS:
void testFileKey_data();
void testCreateFileKey();
void testFileKeyError();
void benchmarkTransformKey();
};
#endif // KEEPASSX_TESTKEYS_H