4
1
mirror of https://github.com/QuasarApp/Heart.git synced 2025-05-06 22:49:41 +00:00
Heart/HeartTests/tst_testprotockol.cpp
2022-12-31 11:25:59 +03:00

87 lines
1.7 KiB
C++

/*
* Copyright (C) 2018-2023 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.
*/
#include <QtTest>
#include "abstractnodetest.h"
#include <shedullertest.h>
#include <bigdatatest.h>
#include <ecdsaauthtest.h>
#include <upgradedatabasetest.h>
#define TestCase(name, testClass) \
void name() { \
initTest(new testClass()); \
}
class testProtockol : public QObject
{
Q_OBJECT
public:
testProtockol();
~testProtockol();
private slots:
// BEGIN TESTS CASES
TestCase(abstractNodeTest, AbstractNodeTest)
TestCase(bigDataTest, BigDataTest);
TestCase(shedullerTest, ShedullerTest);
#ifdef USE_HEART_SSL
TestCase(ecdsaAuthTest, ECDSAAuthTest);
#endif
TestCase(upgradeDataBaseTest, UpgradeDataBaseTest)
// END TEST CASES
private:
void initTest(Test* test);
QCoreApplication *_app = nullptr;
};
testProtockol::testProtockol() {
QH::init();
// init xample unit test
int argc =0;
char * argv[] = {nullptr};
_app = new QCoreApplication(argc, argv);
QCoreApplication::setApplicationName("testHeart");
QCoreApplication::setOrganizationName("QuasarApp");
auto path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
QDir(path).removeRecursively();
}
testProtockol::~testProtockol() {
_app->exit(0);
delete _app;
}
void testProtockol::initTest(Test *test) {
QTimer::singleShot(0, this, [this, test]() {
test->test();
delete test;
_app->exit(0);
});
_app->exec();
}
QTEST_APPLESS_MAIN(testProtockol)
#include "tst_testprotockol.moc"