Replace yahoo finance to stooq (#131)

Old code is dropped to separated provider
This commit is contained in:
2017-12-15 02:01:34 +03:00
parent eb911551eb
commit e5a9e99438
134 changed files with 1213 additions and 1597 deletions

View File

@ -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));
}