2020-09-27 12:40:11 +03:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018-2020 QuasarApp.
|
|
|
|
* Distributed under the lgplv3 software license, see the accompanying
|
|
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
|
|
* of this license document, but changing it is not allowed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2020-09-15 21:16:35 +03:00
|
|
|
#include <QtTest>
|
|
|
|
|
2020-09-15 22:33:48 +03:00
|
|
|
#if HEART_BUILD_LVL >= 0
|
2020-09-15 21:16:35 +03:00
|
|
|
#include "abstractnodetest.h"
|
|
|
|
#endif
|
2020-09-15 22:33:48 +03:00
|
|
|
#if HEART_BUILD_LVL >= 1
|
2020-09-15 21:16:35 +03:00
|
|
|
#include <basenodetest.h>
|
|
|
|
#endif
|
2020-09-15 22:33:48 +03:00
|
|
|
#if HEART_BUILD_LVL >= 2
|
2020-10-24 21:40:29 +03:00
|
|
|
#include <networknodetest.h>
|
2020-09-15 21:16:35 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
class testProtockol : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
QList<Test*> _tests;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
testProtockol();
|
|
|
|
|
|
|
|
~testProtockol();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void initTestCase();
|
|
|
|
void unitTests();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
testProtockol::testProtockol() {
|
|
|
|
|
2020-09-15 22:33:48 +03:00
|
|
|
#if HEART_BUILD_LVL >= 0
|
2020-09-15 21:16:35 +03:00
|
|
|
_tests.push_back(new AbstractNodeTest);
|
|
|
|
#endif
|
2020-09-15 22:33:48 +03:00
|
|
|
#if HEART_BUILD_LVL >= 1
|
2020-09-15 21:16:35 +03:00
|
|
|
_tests.push_back(new BaseNodeTest);
|
|
|
|
#endif
|
2020-09-15 22:33:48 +03:00
|
|
|
#if HEART_BUILD_LVL >= 2
|
2020-09-15 21:16:35 +03:00
|
|
|
_tests.push_back(new NetworkNodeTest);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
testProtockol::~testProtockol() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void testProtockol::initTestCase() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void testProtockol::unitTests() {
|
|
|
|
int argc =0;
|
|
|
|
char * argv[] = {nullptr};
|
|
|
|
|
|
|
|
QCoreApplication app(argc, argv);
|
|
|
|
QCoreApplication::setApplicationName("TestQNP");
|
|
|
|
QCoreApplication::setOrganizationName("QuasarApp");
|
|
|
|
|
|
|
|
auto path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
|
|
|
|
|
|
|
QDir(path).removeRecursively();
|
|
|
|
|
|
|
|
QTimer::singleShot(0, [&app, this]() {
|
|
|
|
|
2021-01-08 16:04:38 +03:00
|
|
|
for (auto test : qAsConst(_tests) ) {
|
2020-09-15 21:16:35 +03:00
|
|
|
test->test();
|
|
|
|
delete test;
|
|
|
|
}
|
|
|
|
|
|
|
|
app.exit(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
app.exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
QTEST_APPLESS_MAIN(testProtockol)
|
|
|
|
|
|
|
|
#include "tst_testprotockol.moc"
|