mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-08-29 03:39:57 +00:00
Replace yahoo finance to stooq (#131)
Old code is dropped to separated provider
This commit is contained in:
@ -30,9 +30,7 @@ void TestAWPatternFunctions::initTestCase()
|
||||
}
|
||||
|
||||
|
||||
void TestAWPatternFunctions::cleanupTestCase()
|
||||
{
|
||||
}
|
||||
void TestAWPatternFunctions::cleanupTestCase() {}
|
||||
|
||||
|
||||
void TestAWPatternFunctions::test_findFunctionCalls()
|
||||
@ -40,11 +38,9 @@ void TestAWPatternFunctions::test_findFunctionCalls()
|
||||
QString name = QString("aw_%1").arg(AWTestLibrary::randomString(1, 10));
|
||||
QString code = AWTestLibrary::randomString(1, 20);
|
||||
QStringList args = AWTestLibrary::randomStringList(20);
|
||||
QString function
|
||||
= QString("$%1<%2>{{%3}}").arg(name).arg(args.join(',')).arg(code);
|
||||
QString function = QString("$%1<%2>{{%3}}").arg(name).arg(args.join(',')).arg(code);
|
||||
|
||||
QString pattern = AWTestLibrary::randomString() + function
|
||||
+ AWTestLibrary::randomString();
|
||||
QString pattern = AWTestLibrary::randomString() + function + AWTestLibrary::randomString();
|
||||
|
||||
QList<AWPatternFunctions::AWFunction> found
|
||||
= AWPatternFunctions::findFunctionCalls(name, pattern);
|
||||
@ -69,10 +65,8 @@ void TestAWPatternFunctions::test_findKeys()
|
||||
|
||||
auto keys = AWTestLibrary::randomSelect(allKeys);
|
||||
auto bars = AWTestLibrary::randomSelect(allKeys);
|
||||
std::for_each(bars.begin(), bars.end(),
|
||||
[](QString &bar) { bar.prepend("bar"); });
|
||||
QString pattern
|
||||
= QString("$%1 $%2").arg(keys.join(" $")).arg(bars.join(" $"));
|
||||
std::for_each(bars.begin(), bars.end(), [](QString &bar) { bar.prepend("bar"); });
|
||||
QString pattern = QString("$%1 $%2").arg(keys.join(" $")).arg(bars.join(" $"));
|
||||
|
||||
allKeys.append(bars);
|
||||
allKeys.sort();
|
||||
@ -80,11 +74,9 @@ void TestAWPatternFunctions::test_findKeys()
|
||||
keys.sort();
|
||||
bars.sort();
|
||||
|
||||
QStringList foundKeys
|
||||
= AWPatternFunctions::findKeys(pattern, allKeys, false);
|
||||
QStringList foundKeys = AWPatternFunctions::findKeys(pattern, allKeys, false);
|
||||
foundKeys.sort();
|
||||
QStringList foundBars
|
||||
= AWPatternFunctions::findKeys(pattern, allKeys, true);
|
||||
QStringList foundBars = AWPatternFunctions::findKeys(pattern, allKeys, true);
|
||||
foundBars.sort();
|
||||
|
||||
QCOMPARE(foundKeys, keys);
|
||||
@ -95,8 +87,7 @@ void TestAWPatternFunctions::test_findKeys()
|
||||
void TestAWPatternFunctions::test_findLambdas()
|
||||
{
|
||||
QStringList lambdas = AWTestLibrary::randomStringList(20);
|
||||
QString pattern = AWTestLibrary::randomString()
|
||||
+ QString("${{%1}}").arg(lambdas.join("}}${{"))
|
||||
QString pattern = AWTestLibrary::randomString() + QString("${{%1}}").arg(lambdas.join("}}${{"))
|
||||
+ AWTestLibrary::randomString();
|
||||
|
||||
QCOMPARE(AWPatternFunctions::findLambdas(pattern), lambdas);
|
||||
@ -108,13 +99,11 @@ void TestAWPatternFunctions::test_expandTemplates()
|
||||
int firstValue = AWTestLibrary::randomInt();
|
||||
int secondValue = AWTestLibrary::randomInt();
|
||||
int result = firstValue + secondValue;
|
||||
QString code
|
||||
= QString("$template{{%1+%2}}").arg(firstValue).arg(secondValue);
|
||||
QString code = QString("$template{{%1+%2}}").arg(firstValue).arg(secondValue);
|
||||
QString prefix = AWTestLibrary::randomString();
|
||||
QString pattern = prefix + code;
|
||||
|
||||
QCOMPARE(AWPatternFunctions::expandTemplates(pattern),
|
||||
QString("%1%2").arg(prefix).arg(result));
|
||||
QCOMPARE(AWPatternFunctions::expandTemplates(pattern), QString("%1%2").arg(prefix).arg(result));
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user