From 9917d0f775783e99764ae70ef47beaf3844f8231 Mon Sep 17 00:00:00 2001 From: sepehrmoghiseh Date: Sat, 3 Sep 2022 17:49:50 +0430 Subject: [PATCH] editing --- appLogReader.pro | 4 +- appLogReaderCore/AppLogReaderApp.cpp | 8 +- appLogReaderCore/AppLogReaderApp.h | 6 +- appLogReaderCore/LinkedList.cpp | 212 +++++++++++++++++ appLogReaderCore/LinkedList.h | 43 +++- appLogReaderCore/MainViewModel.cpp | 4 +- appLogReaderCore/Node.h | 13 +- appLogReaderCore/SortedLinkedList.cpp | 319 +++++++++++++++++++++++++- appLogReaderCore/SortedLinkedList.h | 43 +++- appLogReaderCore/appLogReaderCore.pro | 13 +- appLogReaderQuick/main.cpp | 6 +- appLogReaderTest/LinkedListTest.cpp | 13 +- appLogReaderTest/LinkedListTest.h | 11 +- appLogReaderTest/appLogReaderTest.pro | 21 +- appLogReaderTest/main.cpp | 36 +-- 15 files changed, 688 insertions(+), 64 deletions(-) diff --git a/appLogReader.pro b/appLogReader.pro index 7b31963..75b6a27 100644 --- a/appLogReader.pro +++ b/appLogReader.pro @@ -2,6 +2,8 @@ TEMPLATE = subdirs SUBDIRS += \ appLogReaderQuick \ - appLogReaderCore + appLogReaderCore \ + appLogReaderTest appLogReaderQuick.depends += appLogReaderCore +appLogReaderTest.depends += appLogReaderCore diff --git a/appLogReaderCore/AppLogReaderApp.cpp b/appLogReaderCore/AppLogReaderApp.cpp index 79f3655..8d9c9a8 100644 --- a/appLogReaderCore/AppLogReaderApp.cpp +++ b/appLogReaderCore/AppLogReaderApp.cpp @@ -1,9 +1,9 @@ -#include "appLogReaderApp.h" +#include "AppLogReaderApp.h" #include "MainViewModel.h" #include -appLogReaderApp::appLogReaderApp(QObject *parent) : +AppLogReaderApp::AppLogReaderApp(QObject *parent) : CoreApp(parent) { QCoreApplication::setApplicationName(QStringLiteral("appLogReader")); @@ -11,13 +11,13 @@ appLogReaderApp::appLogReaderApp(QObject *parent) : QCoreApplication::setOrganizationName(QStringLiteral("Example Organization")); } -void appLogReaderApp::performRegistrations() +void AppLogReaderApp::performRegistrations() { //if you are using a qt resource (e.g. "applogreadercore.qrc"), initialize it here Q_INIT_RESOURCE(applogreadercore); } -int appLogReaderApp::startApp(const QStringList &arguments) +int AppLogReaderApp::startApp(const QStringList &arguments) { QCommandLineParser parser; parser.addVersionOption(); diff --git a/appLogReaderCore/AppLogReaderApp.h b/appLogReaderCore/AppLogReaderApp.h index 166e0c0..a160de7 100644 --- a/appLogReaderCore/AppLogReaderApp.h +++ b/appLogReaderCore/AppLogReaderApp.h @@ -3,12 +3,12 @@ #include -class appLogReaderApp : public QtMvvm::CoreApp +class AppLogReaderApp : public QtMvvm::CoreApp { Q_OBJECT public: - explicit appLogReaderApp(QObject *parent = nullptr); + explicit AppLogReaderApp(QObject *parent = nullptr); protected: void performRegistrations() override; @@ -16,6 +16,6 @@ protected: }; #undef coreApp -#define coreApp static_cast(CoreApp::instance()) +#define coreApp static_cast(CoreApp::instance()) #endif // APPLOGREADERAPP_H diff --git a/appLogReaderCore/LinkedList.cpp b/appLogReaderCore/LinkedList.cpp index e69de29..e886f38 100644 --- a/appLogReaderCore/LinkedList.cpp +++ b/appLogReaderCore/LinkedList.cpp @@ -0,0 +1,212 @@ +#include +#include + +#include "LinkedList.h" +#include "Node.h" + +#define SENDER 4 +#define COMMAND 2 +#define RECEIVER 4 +#define TIME 11 +using namespace std; + +/*<============================================================================================================>*/ + +void LinkedList::qListLinked(Node* newNode, int count){ + if(count == 0) + { + newNode->chainLen += 1; + _linkedList.append(newNode); + } + else + { + Node* tmp = _linkedList.last(); + tmp->chainLen += 1; + while(tmp->next != NULL) + { + tmp = tmp->next; + } + tmp->next = newNode; + newNode->pre = tmp; + } +} + +/*<============================================================================================================>*/ + +void LinkedList::pushBack(string sender, string receiver, string command, float time, int count) { + Node* newNode = new Node(); + newNode->sender = sender; + newNode->command = command; + newNode->receiver = receiver; + newNode->time = time; + newNode->chainLen = 0; + newNode->next = NULL; + newNode->pre = NULL; + + qListLinked(newNode, count); +} + +/*<============================================================================================================>*/ + +void LinkedList::qListOmit(string line){ + omitedLines.append(line); +} + +/*<============================================================================================================>*/ + +void LinkedList::addToOmitList(int where){ + omitedLines.insert(where + 1, "chain"); +} + +/*<============================================================================================================>*/ + +void LinkedList::removeOmitLast(){ //remove uncorrect format + omitedLines.removeLast(); +} + +/*<============================================================================================================>*/ + +void LinkedList::addTime(float time){ //addTime to null blocks in chain + Node* head = _linkedList.last(); + while(head->next != NULL) + { + head = head->next; + } + if(head->time == NULL) + { + head->time = time; + } + else + { + while(head->time != NULL) + { + head = head->pre; + } + head->time = time; + } +} + +/*<============================================================================================================>*/ + +void LinkedList::makeLinkedList(){ + string subLine; + string sender; + string command; + string receiver; + string time; + float numFloat; + string lastLine; + int count = 0; + for(int i = 0; i < omitedLines.length(); i++) + { + if(omitedLines[i].find(">>>") != std::string::npos) //line with <<< init + { + subLine = omitedLines[i].substr(omitedLines[i].find(">") + SENDER); + sender = subLine.substr(0, subLine.find("|") - 1); + subLine = omitedLines[i].substr(omitedLines[i].find("|") + COMMAND); + command = subLine.substr(0, subLine.find("=") - 1); + subLine = omitedLines[i].substr(omitedLines[i].find("==>") + RECEIVER); + receiver = subLine.substr(0, subLine.find(",")); + + pushBack(sender, receiver, command, NULL, count); //add the line with null + //time + count++; + } + else if(omitedLines[i].find("<<<") != std::string::npos) + { + subLine = + omitedLines[i].substr(omitedLines[i].find("exec time:") + TIME); + time = subLine.substr(0, subLine.find(",")); + numFloat = std::stof(time); + addTime(numFloat); + } + else if(omitedLines[i].find("chain") != std::string::npos) //add the time to the + //last null time variable + //in the chain + { + count = 0; + } + } +} + +/*<============================================================================================================>*/ + +void LinkedList::chainDetector(){ //a function for finding the chains P.S: chain can + //have one block. + int count = 0; + + for(int i = 0; i < omitedLines.length(); i++) + { + if(omitedLines[i].find(">>>") != std::string::npos) + { + count++; + } + if(omitedLines[i].find("<<<") != std::string::npos) + { + count--; + } + if(omitedLines[i] == "chain") + { + continue; + } + if(count == 0) + { + addToOmitList(i); + } + } + if(omitedLines.last() != "chain") + { + while(omitedLines.last() != "chain") + { + removeOmitLast(); + } + } +} + +/*<============================================================================================================>*/ + +void LinkedList::fileOpen(const QString& path){ //read the file & add them to a Qlist for easy + //access + fstream newFile; + newFile.open(path.toStdString(), ios::in); + if(newFile.is_open()) + { + string line; + string subLine; + string secSubLine; + while(getline(newFile, line)) + { + if(line.find(">>>") != std::string::npos) + { + subLine = line.substr(line.find(">")); + secSubLine = subLine.substr(0, subLine.find(",")); + qListOmit(secSubLine); + } + else if(line.find("<<<") != std::string::npos) + { + subLine = line.substr(line.find("<")); + secSubLine = subLine.substr(0, subLine.find(",")); + qListOmit(secSubLine); + } + } + } + + newFile.close(); +} + +float LinkedList::convertTime(float input) +{ + return input * 1000; +} + +/*<============================================================================================================>*/ + +QList LinkedList::Initiate(const QString& path){ + fileOpen(path); + chainDetector(); + makeLinkedList(); + + return _linkedList; +} + +/*<============================================================================================================>*/ diff --git a/appLogReaderCore/LinkedList.h b/appLogReaderCore/LinkedList.h index b33261f..68b7ec2 100644 --- a/appLogReaderCore/LinkedList.h +++ b/appLogReaderCore/LinkedList.h @@ -1,4 +1,41 @@ -#ifndef LINKEDLIST_H -#define LINKEDLIST_H +#ifndef FILE_H +#define FILE_H +#include +#include +#include +#include +using namespace std; +struct Node; -#endif // LINKEDLIST_H +class LinkedList +{ +private: + QList _linkedList; + QList omitedLines; + + Node* head; + void qListLinked(Node* newNode, int count); + + void pushBack(string sender, string receiver, string command, float time, int count); + + void qListOmit(string line); + + void addToOmitList(int where); + + void removeOmitLast(); + + void addTime(float time); + + void makeLinkedList(); + + void chainDetector(); + + void fileOpen(const QString& path); + +public: + QList Initiate(const QString& path); + + float convertTime(float input); +}; + +#endif //FILE_H diff --git a/appLogReaderCore/MainViewModel.cpp b/appLogReaderCore/MainViewModel.cpp index c02e2d8..f5fa740 100644 --- a/appLogReaderCore/MainViewModel.cpp +++ b/appLogReaderCore/MainViewModel.cpp @@ -1,12 +1,12 @@ #include "MainViewModel.h" - #include MainViewModel::MainViewModel(QObject *parent) : ViewModel(parent), _text(QStringLiteral("hello world")) -{} +{ +} QString MainViewModel::text() const { return _text; diff --git a/appLogReaderCore/Node.h b/appLogReaderCore/Node.h index 3685b95..082ea47 100644 --- a/appLogReaderCore/Node.h +++ b/appLogReaderCore/Node.h @@ -1,4 +1,15 @@ #ifndef NODE_H #define NODE_H +#include +struct Node { + std::string sender; + std::string receiver; + std::string command; + float time; + int chainLen; -#endif // NODE_H + Node* next; + Node* pre; +}; + +#endif //NODE_H diff --git a/appLogReaderCore/SortedLinkedList.cpp b/appLogReaderCore/SortedLinkedList.cpp index ba92521..03506f5 100644 --- a/appLogReaderCore/SortedLinkedList.cpp +++ b/appLogReaderCore/SortedLinkedList.cpp @@ -1,6 +1,321 @@ +#include +#include +#include +#include #include "SortedLinkedList.h" - -SortedLinkedList::SortedLinkedList() +#include "Node.h" +#include +SortedLinkedList::SortedLinkedList(QList linkedList) : + defaultLinkedList(linkedList) { +} + +/*<============================================================================================================>*/ +QList SortedLinkedList::defaultLinkedListGetter(){ + return defaultLinkedList; +} + +/*<============================================================================================================>*/ + +QList SortedLinkedList::timeSortingAsc(float start, float end){ + if(start > 0 && end == FP_INFINITE) + { + for(int i = 0; i < defaultLinkedList.length(); i++) + { + if(defaultLinkedList[i]->time >= start) + { + timeSortedLinkedListAsc.append(defaultLinkedList[i]); + } + } + } + else if(start > 0 && end < FP_INFINITE) + { + for(int i = 0; i < defaultLinkedList.length(); i++) + { + if(defaultLinkedList[i]->time >= start && defaultLinkedList[i]->time <= end) + { + timeSortedLinkedListAsc.append(defaultLinkedList[i]); + } + } + } + else if(start <= 0 && end < FP_INFINITE) + { + for(int i = 0; i < defaultLinkedList.length(); i++) + { + if(defaultLinkedList[i]->time <= end) + { + timeSortedLinkedListAsc.append(defaultLinkedList[i]); + } + } + } + else + { + timeSortedLinkedListAsc = defaultLinkedList; + } + + if(!timeSortedLinkedListAsc.isEmpty()) + { + for(int k = 1; k < timeSortedLinkedListAsc.length(); k++) + { + Node* temp = timeSortedLinkedListAsc[k]; + int j = k - 1; + while(j >= 0 && temp->time <= timeSortedLinkedListAsc[j]->time) + { + timeSortedLinkedListAsc[j + 1] = timeSortedLinkedListAsc[j]; + j = j - 1; + } + timeSortedLinkedListAsc[j + 1] = temp; + } + } + + return timeSortedLinkedListAsc; +} + +/*<============================================================================================================>*/ + +QList SortedLinkedList::timeSortingDes(float start, float end){ + if(start > 0 && end == FP_INFINITE) + { + for(int i = 0; i < defaultLinkedList.length(); i++) + { + if(defaultLinkedList[i]->time >= start) + { + timeSortedLinkedListDes.append(defaultLinkedList[i]); + } + } + } + else if(start > 0 && end < FP_INFINITE) + { + for(int i = 0; i < defaultLinkedList.length(); i++) + { + if(defaultLinkedList[i]->time >= start && defaultLinkedList[i]->time <= end) + { + timeSortedLinkedListDes.append(defaultLinkedList[i]); + } + } + } + else if(start <= 0 && end < FP_INFINITE) + { + for(int i = 0; i < defaultLinkedList.length(); i++) + { + if(defaultLinkedList[i]->time <= end) + { + timeSortedLinkedListDes.append(defaultLinkedList[i]); + } + } + } + else + { + timeSortedLinkedListDes = defaultLinkedList; + } + if(!timeSortedLinkedListDes.isEmpty()) + { + for(int k = 1; k < timeSortedLinkedListDes.length(); k++) + { + Node* temp = timeSortedLinkedListDes[k]; + int j = k - 1; + while(j >= 0 && temp->time >= timeSortedLinkedListDes[j]->time) + { + timeSortedLinkedListDes[j + 1] = timeSortedLinkedListDes[j]; + j = j - 1; + } + timeSortedLinkedListDes[j + 1] = temp; + } + } + + return timeSortedLinkedListDes; +} + +/*<============================================================================================================>*/ +QList SortedLinkedList::timeSorting(int dir, float start, float end){ + switch(dir) + { + case 0: + return timeSortingAsc(start, end); + + case 1: + return timeSortingDes(start, end); + + default: + break; + } +} + +/*<============================================================================================================>*/ + +QList SortedLinkedList::chainLenSortingAsc(float start, float end){ + if(start > 0 && end == FP_INFINITE) + { + for(int i = 0; i < defaultLinkedList.length(); i++) + { + if(defaultLinkedList[i]->chainLen >= start) + { + chainLenSortedLinkedListAsc.append(defaultLinkedList[i]); + } + } + } + else if(start > 0 && end < FP_INFINITE) + { + for(int i = 0; i < defaultLinkedList.length(); i++) + { + if(defaultLinkedList[i]->chainLen >= start && defaultLinkedList[i]->chainLen <= end) + { + chainLenSortedLinkedListAsc.append(defaultLinkedList[i]); + } + } + } + else if(start <= 0 && end < FP_INFINITE) + { + for(int i = 0; i < defaultLinkedList.length(); i++) + { + if(defaultLinkedList[i]->chainLen <= end) + { + chainLenSortedLinkedListAsc.append(defaultLinkedList[i]); + } + } + } + else + { + chainLenSortedLinkedListAsc = defaultLinkedList; + } + if(!chainLenSortedLinkedListAsc.isEmpty()) + { + for(int k = 1; k < chainLenSortedLinkedListAsc.length(); k++) + { + Node* temp = chainLenSortedLinkedListAsc[k]; + int j = k - 1; + while(j >= 0 && temp->chainLen <= chainLenSortedLinkedListAsc[j]->chainLen) + { + chainLenSortedLinkedListAsc[j + 1] = chainLenSortedLinkedListAsc[j]; + j = j - 1; + } + chainLenSortedLinkedListAsc[j + 1] = temp; + } + } + return chainLenSortedLinkedListAsc; } + +/*<============================================================================================================>*/ + +QList SortedLinkedList::chainLenSortingDes(float start, float end){ + if(start > 0 && end == FP_INFINITE) + { + for(int i = 0; i < defaultLinkedList.length(); i++) + { + if(defaultLinkedList[i]->chainLen >= start) + { + chainLenSortedLinkedListDes.append(defaultLinkedList[i]); + } + } + } + else if(start > 0 && end < FP_INFINITE) + { + for(int i = 0; i < defaultLinkedList.length(); i++) + { + if(defaultLinkedList[i]->chainLen >= start && defaultLinkedList[i]->chainLen <= end) + { + chainLenSortedLinkedListDes.append(defaultLinkedList[i]); + } + } + } + else if(start <= 0 && end < FP_INFINITE) + { + for(int i = 0; i < defaultLinkedList.length(); i++) + { + if(defaultLinkedList[i]->chainLen <= end) + { + chainLenSortedLinkedListDes.append(defaultLinkedList[i]); + } + } + } + else + { + chainLenSortedLinkedListDes = defaultLinkedList; + } + if(!chainLenSortedLinkedListDes.isEmpty()) + { + for(int k = 1; k < chainLenSortedLinkedListDes.length(); k++) + { + Node* temp = chainLenSortedLinkedListDes[k]; + int j = k - 1; + while(j >= 0 && temp->chainLen >= chainLenSortedLinkedListDes[j]->chainLen) + { + chainLenSortedLinkedListDes[j + 1] = chainLenSortedLinkedListDes[j]; + j = j - 1; + } + chainLenSortedLinkedListDes[j + 1] = temp; + } + } + + return chainLenSortedLinkedListDes; +} + +/*<============================================================================================================>*/ +QList SortedLinkedList::chainLenSorting(int dir, float start, float end){ + switch(dir) + { + case 0: + return chainLenSortingAsc(start, end); + + case 1: + return chainLenSortingDes(start, end); + + default: + break; + } +} + +/*<============================================================================================================>*/ + +QList SortedLinkedList::senderFilter(string filterWord){ + transform(filterWord.begin(), filterWord.end(), filterWord.begin(), ::toupper); //uppercase + string iterate; + for(int i = 0; i < defaultLinkedList.length(); i++) + { + iterate = defaultLinkedList[i]->sender; + transform(iterate.begin(), iterate.end(), iterate.begin(), ::toupper); //uppercase + if(iterate.find(filterWord) == 0) + { + senderFilterLinkedList.append(defaultLinkedList[i]); + } + } + + return senderFilterLinkedList; +} + +/*<============================================================================================================>*/ +QList SortedLinkedList::receiverFilter(string filterWord){ + transform(filterWord.begin(), filterWord.end(), filterWord.begin(), ::toupper); //uppercase + string iterate; + for(int i = 0; i < defaultLinkedList.length(); i++) + { + iterate = defaultLinkedList[i]->receiver; + transform(iterate.begin(), iterate.end(), iterate.begin(), ::toupper); //uppercase + if(iterate.find(filterWord) == 0) + { + receiverFilterLinkedList.append(defaultLinkedList[i]); + } + } + + return receiverFilterLinkedList; +} + +/*<============================================================================================================>*/ +QList SortedLinkedList::commandFilter(string filterWord){ + transform(filterWord.begin(), filterWord.end(), filterWord.begin(), ::toupper); //uppercase + string iterate; + for(int i = 0; i < defaultLinkedList.length(); i++) + { + iterate = defaultLinkedList[i]->command; + transform(iterate.begin(), iterate.end(), iterate.begin(), ::toupper); //uppercase + if(iterate.find(filterWord) == 0) + { + commandFilterLinkedList.append(defaultLinkedList[i]); + } + } + + return commandFilterLinkedList; +} + +/*<============================================================================================================>*/ diff --git a/appLogReaderCore/SortedLinkedList.h b/appLogReaderCore/SortedLinkedList.h index 07c43bc..b495bcc 100644 --- a/appLogReaderCore/SortedLinkedList.h +++ b/appLogReaderCore/SortedLinkedList.h @@ -1,11 +1,44 @@ -#ifndef SORTEDLINKEDLIST_H -#define SORTEDLINKEDLIST_H - +#ifndef SORTLINKEDLIST_H +#define SORTLINKEDLIST_H +#include +#include +#include +#include +#include "LinkedList.h" class SortedLinkedList { +private: + QList defaultLinkedList; + + QList timeSortedLinkedListAsc; + QList timeSortedLinkedListDes; + + QList chainLenSortedLinkedListAsc; + QList chainLenSortedLinkedListDes; + + QList senderFilterLinkedList; + QList receiverFilterLinkedList; + QList commandFilterLinkedList; + + QList timeSortingAsc(float start = 0, float end = FP_INFINITE); + QList timeSortingDes(float start = 0, float end = FP_INFINITE); + + QList chainLenSortingAsc(float start = 0, float end = FP_INFINITE); + QList chainLenSortingDes(float start = 0, float end = FP_INFINITE); + public: - SortedLinkedList(); + SortedLinkedList(QList linkedList); + + QList timeSorting(int dir = 0, float start = 0, float end = FP_INFINITE); + + QList defaultLinkedListGetter(); + + QList chainLenSorting(int dir = 0, float start = 0, float end = FP_INFINITE); + + QList senderFilter(string filterWord); + QList receiverFilter(string filterWord); + QList commandFilter(string filterWord); }; -#endif // SORTEDLINKEDLIST_H +#endif //SORTLINKEDLIST_H diff --git a/appLogReaderCore/appLogReaderCore.pro b/appLogReaderCore/appLogReaderCore.pro index a2f70d1..9929969 100644 --- a/appLogReaderCore/appLogReaderCore.pro +++ b/appLogReaderCore/appLogReaderCore.pro @@ -9,12 +9,17 @@ TARGET = appLogReaderCore DEFINES += QT_DEPRECATED_WARNINGS HEADERS += \ - appLogReaderApp.h \ - MainViewModel.h + AppLogReaderApp.h \ + LinkedList.h \ + MainViewModel.h \ + Node.h \ + SortedLinkedList.h SOURCES += \ - appLogReaderApp.cpp \ - MainViewModel.cpp + AppLogReaderApp.cpp \ + LinkedList.cpp \ + MainViewModel.cpp \ + SortedLinkedList.cpp RESOURCES += \ applogreadercore.qrc diff --git a/appLogReaderQuick/main.cpp b/appLogReaderQuick/main.cpp index 550f661..d26e812 100644 --- a/appLogReaderQuick/main.cpp +++ b/appLogReaderQuick/main.cpp @@ -1,9 +1,9 @@ #include #include -#include +#include #include - -QTMVVM_REGISTER_CORE_APP(appLogReaderApp) +#include +QTMVVM_REGISTER_CORE_APP(AppLogReaderApp) int main(int argc, char *argv[]) { diff --git a/appLogReaderTest/LinkedListTest.cpp b/appLogReaderTest/LinkedListTest.cpp index 0a89435..209126e 100644 --- a/appLogReaderTest/LinkedListTest.cpp +++ b/appLogReaderTest/LinkedListTest.cpp @@ -1,6 +1,17 @@ #include "LinkedListTest.h" - +#include +#include "SortedLinkedList.h" +#include "Node.h" LinkedListTest::LinkedListTest() { +} + +void LinkedListTest::test() +{ + LinkedList linkList; + auto l = linkList.Initiate("D:/git commands/App-Log-Reader/test.usl"); + SortedLinkedList t(l); + auto result = t.chainLenSorting(1, 2); + QCOMPARE(result.last()->chainLen, 2); } diff --git a/appLogReaderTest/LinkedListTest.h b/appLogReaderTest/LinkedListTest.h index fc9d43c..52d1bc1 100644 --- a/appLogReaderTest/LinkedListTest.h +++ b/appLogReaderTest/LinkedListTest.h @@ -1,11 +1,16 @@ #ifndef LINKEDLISTTEST_H #define LINKEDLISTTEST_H +#include - -class LinkedListTest +class LinkedListTest : public QObject { + Q_OBJECT + public: LinkedListTest(); + +private slots: + void test(); }; -#endif // LINKEDLISTTEST_H +#endif //LINKEDLISTTEST_H diff --git a/appLogReaderTest/appLogReaderTest.pro b/appLogReaderTest/appLogReaderTest.pro index d2d7b7f..3e21d49 100644 --- a/appLogReaderTest/appLogReaderTest.pro +++ b/appLogReaderTest/appLogReaderTest.pro @@ -6,4 +6,23 @@ CONFIG -= app_bundle TEMPLATE = app -SOURCES += tst_test.cpp +# Link with core project +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../appLogReaderCore/release/ -lappLogReaderCore +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../appLogReaderCore/debug/ -lappLogReaderCore +else:unix: LIBS += -L$$OUT_PWD/../appLogReaderCore/ -lappLogReaderCore + +INCLUDEPATH += $$PWD/../appLogReaderCore +DEPENDPATH += $$PWD/../appLogReaderCore + +win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../appLogReaderCore/release/libappLogReaderCore.a +else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../appLogReaderCore/debug/libappLogReaderCore.a +else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../appLogReaderCore/release/appLogReaderCore.lib +else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../appLogReaderCore/debug/appLogReaderCore.lib +else:unix: PRE_TARGETDEPS += $$OUT_PWD/../appLogReaderCore/libappLogReaderCore.a + +SOURCES += \ + LinkedListTest.cpp \ + main.cpp + +HEADERS += \ + LinkedListTest.h diff --git a/appLogReaderTest/main.cpp b/appLogReaderTest/main.cpp index 195722f..4e548bc 100644 --- a/appLogReaderTest/main.cpp +++ b/appLogReaderTest/main.cpp @@ -1,35 +1,9 @@ #include - -// add necessary includes here - -class test : public QObject -{ - Q_OBJECT - -public: - test(); - ~test(); - -private slots: - void test_case1(); - -}; - -test::test() +#include +int main() { + int failedTestsCount = 0; + failedTestsCount += QTest::qExec(new LinkedListTest); + return failedTestsCount; } - -test::~test() -{ - -} - -void test::test_case1() -{ - -} - -QTEST_APPLESS_MAIN(test) - -#include "tst_test.moc"