add tests for battery and gpuload sources

+ some tests refactoring
This commit is contained in:
2016-06-09 12:45:21 +03:00
parent bc2071a493
commit 78b7a87c29
16 changed files with 269 additions and 44 deletions

View File

@ -53,9 +53,6 @@ void TestExtQuotes::test_run()
// init spy
QSignalSpy spy(extQuotes, SIGNAL(dataReceived(const QVariantHash &)));
QVariantHash firstValue = extQuotes->run();
QCOMPARE(firstValue[extQuotes->tag(QString("ask"))].toDouble(), 0.0);
QCOMPARE(firstValue[extQuotes->tag(QString("bid"))].toDouble(), 0.0);
QCOMPARE(firstValue[extQuotes->tag(QString("price"))].toDouble(), 0.0);
// check values
QVERIFY(spy.wait(5000));
@ -67,6 +64,9 @@ void TestExtQuotes::test_run()
cache[QString("price")]
= arguments.at(0).toHash()[extQuotes->tag(QString("price"))];
QCOMPARE(firstValue[extQuotes->tag(QString("ask"))].toDouble(), 0.0);
QCOMPARE(firstValue[extQuotes->tag(QString("bid"))].toDouble(), 0.0);
QCOMPARE(firstValue[extQuotes->tag(QString("price"))].toDouble(), 0.0);
for (auto type : types) {
qDebug() << "Test type" << type;
QVERIFY((cache[type].toDouble() > price.first)