Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis-Bertrand Varin <louisbvarin@gmail.com>2018-03-31 23:01:30 +0300
committerLouis-Bertrand Varin <louisbvarin@gmail.com>2018-03-31 23:01:30 +0300
commit8324d03f0a015e62b6182843b4478226a5197090 (patch)
treefaf34febaec7c7e764d357dc5e439f6f2b1fcaf3 /tests/TestKdbx4.cpp
parent74efc57369b068a0f93cb84ac68b6c17f64c8abe (diff)
Formatting the code.
Diffstat (limited to 'tests/TestKdbx4.cpp')
-rw-r--r--tests/TestKdbx4.cpp63
1 files changed, 34 insertions, 29 deletions
diff --git a/tests/TestKdbx4.cpp b/tests/TestKdbx4.cpp
index 1d50b8e7f..53207a049 100644
--- a/tests/TestKdbx4.cpp
+++ b/tests/TestKdbx4.cpp
@@ -18,17 +18,16 @@
#include "TestKdbx4.h"
#include "TestGlobal.h"
+#include "config-keepassx-tests.h"
#include "core/Metadata.h"
-#include "keys/PasswordKey.h"
-#include "keys/FileKey.h"
-#include "mock/MockChallengeResponseKey.h"
+#include "format/KdbxXmlReader.h"
+#include "format/KdbxXmlWriter.h"
#include "format/KeePass2.h"
#include "format/KeePass2Reader.h"
#include "format/KeePass2Writer.h"
-#include "format/KdbxXmlReader.h"
-#include "format/KdbxXmlWriter.h"
-#include "config-keepassx-tests.h"
-
+#include "keys/FileKey.h"
+#include "keys/PasswordKey.h"
+#include "mock/MockChallengeResponseKey.h"
QTEST_GUILESS_MAIN(TestKdbx4)
@@ -66,8 +65,11 @@ void TestKdbx4::writeXml(QBuffer* buf, Database* db, bool& hasError, QString& er
errorString = writer.errorString();
}
-void TestKdbx4::readKdbx(QIODevice* device, CompositeKey const& key, QScopedPointer<Database>& db,
- bool& hasError, QString& errorString)
+void TestKdbx4::readKdbx(QIODevice* device,
+ CompositeKey const& key,
+ QScopedPointer<Database>& db,
+ bool& hasError,
+ QString& errorString)
{
KeePass2Reader reader;
db.reset(reader.readDatabase(device, key));
@@ -78,8 +80,11 @@ void TestKdbx4::readKdbx(QIODevice* device, CompositeKey const& key, QScopedPoin
QCOMPARE(reader.version(), KeePass2::FILE_VERSION_4);
}
-void TestKdbx4::readKdbx(const QString& path, CompositeKey const& key, QScopedPointer<Database>& db,
- bool& hasError, QString& errorString)
+void TestKdbx4::readKdbx(const QString& path,
+ CompositeKey const& key,
+ QScopedPointer<Database>& db,
+ bool& hasError,
+ QString& errorString)
{
KeePass2Reader reader;
db.reset(reader.readDatabase(path, key));
@@ -139,7 +144,7 @@ void TestKdbx4::testFormat400Upgrade()
QScopedPointer<Database> sourceDb(new Database());
sourceDb->changeKdf(fastKdf(sourceDb->kdf()));
sourceDb->metadata()->setName("Wubba lubba dub dub");
- QCOMPARE(sourceDb->kdf()->uuid(), KeePass2::KDF_AES_KDBX3); // default is legacy AES-KDF
+ QCOMPARE(sourceDb->kdf()->uuid(), KeePass2::KDF_AES_KDBX3); // default is legacy AES-KDF
CompositeKey key;
key.addKey(PasswordKey("I am in great pain, please help me!"));
@@ -156,7 +161,8 @@ void TestKdbx4::testFormat400Upgrade()
sourceDb->metadata()->customData()->set("CustomPublicData", "Hey look, I turned myself into a pickle!");
if (addCustomData) {
// this, however, should
- sourceDb->rootGroup()->customData()->set("CustomGroupData", "I just killed my family! I don't care who they were!");
+ sourceDb->rootGroup()->customData()->set("CustomGroupData",
+ "I just killed my family! I don't care who they were!");
}
KeePass2Writer writer;
@@ -305,16 +311,18 @@ void TestKdbx4::testUpgradeMasterKeyIntegrity_data()
QTest::addColumn<QString>("upgradeAction");
QTest::addColumn<quint32>("expectedVersion");
- QTest::newRow("Upgrade: none") << QString("none") << KeePass2::FILE_VERSION_3;
- QTest::newRow("Upgrade: none (meta-customdata)") << QString("meta-customdata") << KeePass2::FILE_VERSION_3;
- QTest::newRow("Upgrade: none (explicit kdf-aes-kdbx3)") << QString("kdf-aes-kdbx3") << KeePass2::FILE_VERSION_3;
- QTest::newRow("Upgrade (explicit): kdf-argon2") << QString("kdf-argon2") << KeePass2::FILE_VERSION_4;
- QTest::newRow("Upgrade (explicit): kdf-aes-kdbx4") << QString("kdf-aes-kdbx4") << KeePass2::FILE_VERSION_4;
- QTest::newRow("Upgrade (implicit): public-customdata") << QString("public-customdata") << KeePass2::FILE_VERSION_4;
- QTest::newRow("Upgrade (implicit): rootgroup-customdata") << QString("rootgroup-customdata") << KeePass2::FILE_VERSION_4;
- QTest::newRow("Upgrade (implicit): group-customdata") << QString("group-customdata") << KeePass2::FILE_VERSION_4;
- QTest::newRow("Upgrade (implicit): rootentry-customdata") << QString("rootentry-customdata") << KeePass2::FILE_VERSION_4;
- QTest::newRow("Upgrade (implicit): entry-customdata") << QString("entry-customdata") << KeePass2::FILE_VERSION_4;
+ QTest::newRow("Upgrade: none") << QString("none") << KeePass2::FILE_VERSION_3;
+ QTest::newRow("Upgrade: none (meta-customdata)") << QString("meta-customdata") << KeePass2::FILE_VERSION_3;
+ QTest::newRow("Upgrade: none (explicit kdf-aes-kdbx3)") << QString("kdf-aes-kdbx3") << KeePass2::FILE_VERSION_3;
+ QTest::newRow("Upgrade (explicit): kdf-argon2") << QString("kdf-argon2") << KeePass2::FILE_VERSION_4;
+ QTest::newRow("Upgrade (explicit): kdf-aes-kdbx4") << QString("kdf-aes-kdbx4") << KeePass2::FILE_VERSION_4;
+ QTest::newRow("Upgrade (implicit): public-customdata") << QString("public-customdata") << KeePass2::FILE_VERSION_4;
+ QTest::newRow("Upgrade (implicit): rootgroup-customdata") << QString("rootgroup-customdata")
+ << KeePass2::FILE_VERSION_4;
+ QTest::newRow("Upgrade (implicit): group-customdata") << QString("group-customdata") << KeePass2::FILE_VERSION_4;
+ QTest::newRow("Upgrade (implicit): rootentry-customdata") << QString("rootentry-customdata")
+ << KeePass2::FILE_VERSION_4;
+ QTest::newRow("Upgrade (implicit): entry-customdata") << QString("entry-customdata") << KeePass2::FILE_VERSION_4;
}
void TestKdbx4::testCustomData()
@@ -335,8 +343,8 @@ void TestKdbx4::testCustomData()
const QString customDataKey2 = "CD2";
const QString customData1 = "abcäöü";
const QString customData2 = "Hello World";
- const int dataSize = customDataKey1.toUtf8().size() + customDataKey1.toUtf8().size() +
- customData1.toUtf8().size() + customData2.toUtf8().size();
+ const int dataSize = customDataKey1.toUtf8().size() + customDataKey1.toUtf8().size() + customData1.toUtf8().size()
+ + customData2.toUtf8().size();
// test custom database data
db.metadata()->customData()->set(customDataKey1, customData1);
@@ -413,10 +421,7 @@ QSharedPointer<Kdf> TestKdbx4::fastKdf(QSharedPointer<Kdf> kdf)
kdf->setRounds(1);
if (kdf->uuid() == KeePass2::KDF_ARGON2) {
- kdf->processParameters({
- {KeePass2::KDFPARAM_ARGON2_MEMORY, 1024},
- {KeePass2::KDFPARAM_ARGON2_PARALLELISM, 1}
- });
+ kdf->processParameters({{KeePass2::KDFPARAM_ARGON2_MEMORY, 1024}, {KeePass2::KDFPARAM_ARGON2_PARALLELISM, 1}});
}
return kdf;