Heart/HeartTests/tst_testprotockol.cpp

84 lines
1.7 KiB
C++
Raw Permalink Normal View History

2020-09-27 12:40:11 +03:00
/*
2024-12-30 22:44:47 +01:00
* Copyright (C) 2018-2025 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>
2021-10-11 10:40:22 +03:00
#include <upgradedatabasetest.h>
2023-05-27 21:40:43 +02:00
#include <multiversiontest.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
2021-10-11 10:40:22 +03:00
TestCase(upgradeDataBaseTest, UpgradeDataBaseTest)
2023-05-27 21:40:43 +02:00
TestCase(multiVersionTest, MultiVersionTest)
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() {
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"