-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8aefdb
commit a1d6c02
Showing
5 changed files
with
69 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2021 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2023 KeePassXC Team <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -239,3 +239,30 @@ void TestTools::testConvertToRegex_data() | |
<< input << static_cast<int>(Tools::RegexConvertOpts::WILDCARD_UNLIMITED_MATCH) | ||
<< QString(R"(te\|st.*t\?\[5\]\^\(test\)\;\'\,\.)"); | ||
} | ||
|
||
void TestTools::testArrayContainsValues() | ||
{ | ||
const auto values = QStringList() << "first" | ||
<< "second" | ||
<< "third"; | ||
|
||
// One missing | ||
const auto result1 = Tools::getMissingValuesFromList<QString>(values, | ||
QStringList() << "first" | ||
<< "second" | ||
<< "none"); | ||
QCOMPARE(result1.length(), 1); | ||
QCOMPARE(result1.first(), QString("none")); | ||
|
||
// All found | ||
const auto result2 = Tools::getMissingValuesFromList<QString>(values, | ||
QStringList() << "first" | ||
<< "second" | ||
<< "third"); | ||
QCOMPARE(result2.length(), 0); | ||
|
||
// None are found | ||
const auto numberValues = {1, 2, 3, 4, 5}; | ||
const auto result3 = Tools::getMissingValuesFromList<int>(numberValues, {6, 7, 8}); | ||
QCOMPARE(result3.length(), 3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2021 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2023 KeePassXC Team <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -35,6 +35,7 @@ private slots: | |
void testEscapeRegex_data(); | ||
void testConvertToRegex(); | ||
void testConvertToRegex_data(); | ||
void testArrayContainsValues(); | ||
}; | ||
|
||
#endif // KEEPASSX_TESTTOOLS_H |