implement qcronscheduler, tests update

This commit is contained in:
2017-04-28 01:47:42 +03:00
parent 8be4cc6e82
commit 1b4d1d6944
55 changed files with 412 additions and 144 deletions

View File

@ -26,6 +26,7 @@
void TestAWPatternFunctions::initTestCase()
{
AWTestLibrary::init();
}
@ -59,18 +60,29 @@ void TestAWPatternFunctions::test_findFunctionCalls()
void TestAWPatternFunctions::test_findKeys()
{
QStringList keys = AWTestLibrary::randomStringList(20);
QStringList bars = AWTestLibrary::randomStringList(20);
int count = AWTestLibrary::randomInt(200);
QStringList allKeys;
for (int i = 0; i < count; i++) {
auto key = AWTestLibrary::randomString(20);
while (allKeys.indexOf(QRegExp(QString("^%1.*").arg(key))) != -1)
key = AWTestLibrary::randomString(20);
allKeys.append(key);
}
auto keys = AWTestLibrary::randomSelect(allKeys);
auto bars = AWTestLibrary::randomSelect(allKeys);
std::for_each(bars.begin(), bars.end(),
[](QString &bar) { bar.prepend(QString("bar")); });
QStringList noise = AWTestLibrary::randomStringList(200);
QStringList allKeys = keys + bars + noise;
QString pattern = QString("$%1 $%2")
.arg(keys.join(QString(" $")))
.arg(bars.join(QString(" $")));
allKeys.append(bars);
allKeys.sort();
std::reverse(allKeys.begin(), allKeys.end());
keys.sort();
bars.sort();
QStringList foundKeys
= AWPatternFunctions::findKeys(pattern, allKeys, false);
foundKeys.sort();