Heart/HeartTests/tst_testprotockol.cpp

87 lines
1.7 KiB
C++
Raw Normal View History

2020-09-27 12:40:11 +03:00
/*
2022-12-31 11:25:59 +03:00
* Copyright (C) 2018-2023 QuasarApp.
2020-09-27 12:40:11 +03:00
* 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>
#include "abstractnodetest.h"
2021-10-12 00:47:39 +03:00
#include <shedullertest.h>
#include <bigdatatest.h>
2022-02-10 20:06:39 +03:00
#include <ecdsaauthtest.h>
2021-10-11 10:40:22 +03:00
#include <upgradedatabasetest.h>
2020-09-15 21:16:35 +03:00
#define TestCase(name, testClass) \
void name() { \
initTest(new testClass()); \
}
2020-09-15 21:16:35 +03:00
class testProtockol : public QObject
{
Q_OBJECT
public:
testProtockol();
~testProtockol();
private slots:
// BEGIN TESTS CASES
TestCase(abstractNodeTest, AbstractNodeTest)
2021-10-02 22:12:39 +03:00
TestCase(bigDataTest, BigDataTest);
2021-10-12 00:47:39 +03:00
TestCase(shedullerTest, ShedullerTest);
2022-02-22 17:02:14 +03:00
#ifdef USE_HEART_SSL
2022-02-10 20:06:39 +03:00
TestCase(ecdsaAuthTest, ECDSAAuthTest);
2020-09-15 21:16:35 +03:00
#endif
2022-02-22 17:02:14 +03:00
2021-10-11 10:40:22 +03:00
TestCase(upgradeDataBaseTest, UpgradeDataBaseTest)
2020-09-15 21:16:35 +03:00
// END TEST CASES
2020-09-15 21:16:35 +03:00
private:
void initTest(Test* test);
2020-09-15 21:16:35 +03:00
QCoreApplication *_app = nullptr;
};
testProtockol::testProtockol() {
QH::init();
2020-09-15 21:16:35 +03:00
// init xample unit test
2020-09-15 21:16:35 +03:00
int argc =0;
char * argv[] = {nullptr};
_app = new QCoreApplication(argc, argv);
QCoreApplication::setApplicationName("testHeart");
2020-09-15 21:16:35 +03:00
QCoreApplication::setOrganizationName("QuasarApp");
auto path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
QDir(path).removeRecursively();
}
2020-09-15 21:16:35 +03:00
testProtockol::~testProtockol() {
_app->exit(0);
delete _app;
}
2020-09-15 21:16:35 +03:00
void testProtockol::initTest(Test *test) {
QTimer::singleShot(0, this, [this, test]() {
test->test();
delete test;
_app->exit(0);
2020-09-15 21:16:35 +03:00
});
_app->exec();
2020-09-15 21:16:35 +03:00
}
QTEST_APPLESS_MAIN(testProtockol)
#include "tst_testprotockol.moc"