Index: cppcheck.err =================================================================== diff -u -r56d00a82669a7a2c00ab90109a89dbec8db27527 -r805119c460b4a266d6401c8705f4427e7fbe270f --- cppcheck.err (.../cppcheck.err) (revision 56d00a82669a7a2c00ab90109a89dbec8db27527) +++ cppcheck.err (.../cppcheck.err) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -1,6 +1,6 @@ -[sources/gui/guiview.cpp:171]: (style) The function 'alarmIDName' is never used. -[sources/gui/guiview.cpp:153]: (style) The function 'alarmPriorityName' is never used. +[sources/gui/guiview.cpp:186]: (style) The function 'alarmIDName' is never used. +[sources/gui/guiview.cpp:168]: (style) The function 'alarmPriorityName' is never used. [sources/utility/types.cpp:20]: (style) The function 'floatCompare' is never used. [sources/storage/filehandler.cpp:61]: (style) The function 'read' is never used. -[sources/maintimer.cpp:52]: (style) The function 'timerEvent' is never used. +[sources/maintimer.cpp:54]: (style) The function 'timerEvent' is never used. (information) Cppcheck cannot find all the include files. Cppcheck can check the code without the include files found. But the results will probably be more accurate if all the include files are found. Please check your project's include directories and add all of them as include directories for Cppcheck. To see what files Cppcheck cannot find use --check-config. Index: cppcheck.log =================================================================== diff -u -r56d00a82669a7a2c00ab90109a89dbec8db27527 -r805119c460b4a266d6401c8705f4427e7fbe270f --- cppcheck.log (.../cppcheck.log) (revision 56d00a82669a7a2c00ab90109a89dbec8db27527) +++ cppcheck.log (.../cppcheck.log) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -3,115 +3,122 @@ Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native Checking main.cpp: UNIT_TEST... -1/23 files checked 4% done +1/24 files checked 4% done Checking sources/applicationcontroller.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -2/23 files checked 8% done +2/24 files checked 8% done Checking sources/applicationpost.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -3/23 files checked 13% done +3/24 files checked 12% done Checking sources/canbus/caninterface.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -4/23 files checked 17% done +4/24 files checked 16% done Checking sources/canbus/frameinterface.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -5/23 files checked 21% done +5/24 files checked 20% done +Checking sources/canbus/messageacknowmodel.cpp ... +Defines: +Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ +Platform:Native +6/24 files checked 25% done Checking sources/canbus/messagebuilder.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native Checking sources/canbus/messagebuilder.cpp: DISABLE_CRC... -6/23 files checked 26% done +7/24 files checked 29% done Checking sources/canbus/messagedispatcher.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -7/23 files checked 30% done +Checking sources/canbus/messagedispatcher.cpp: DEBUG_ACKBACK_HD_TO_UI... +8/24 files checked 33% done Checking sources/canbus/messageinterpreter.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -8/23 files checked 34% done +9/24 files checked 37% done Checking sources/configuration/display.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -9/23 files checked 39% done +10/24 files checked 41% done Checking sources/configuration/sound.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -10/23 files checked 43% done +11/24 files checked 45% done Checking sources/gui/guicontroller.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -11/23 files checked 47% done +12/24 files checked 50% done Checking sources/gui/guiglobals.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -12/23 files checked 52% done +13/24 files checked 54% done Checking sources/gui/guiview.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -13/23 files checked 56% done +14/24 files checked 58% done Checking sources/maintimer.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -14/23 files checked 60% done +15/24 files checked 62% done Checking sources/storage/filehandler.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -15/23 files checked 65% done +16/24 files checked 66% done Checking sources/storage/logger.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -16/23 files checked 69% done +Checking sources/storage/logger.cpp: QT_DEBUG... +17/24 files checked 70% done Checking sources/storage/settings.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -17/23 files checked 73% done +18/24 files checked 75% done Checking sources/storage/storageglobals.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -18/23 files checked 78% done +19/24 files checked 79% done Checking sources/storage/usbwatcher.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -19/23 files checked 82% done +20/24 files checked 83% done Checking sources/threads.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -20/23 files checked 86% done +21/24 files checked 87% done Checking sources/utility/crc.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -21/23 files checked 91% done +22/24 files checked 91% done Checking sources/utility/format.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -22/23 files checked 95% done +23/24 files checked 95% done Checking sources/utility/types.cpp ... Defines: Includes: -I.//sources/ -I.//sources/gui/ -I.//sources/storage/ -I.//sources/configuration/ -I.//sources/canbus/ Platform:Native -23/23 files checked 100% done +24/24 files checked 100% done Index: denali.pro =================================================================== diff -u -r1b8d8fdf90d57822dde33cf1428438847238b10b -r805119c460b4a266d6401c8705f4427e7fbe270f --- denali.pro (.../denali.pro) (revision 1b8d8fdf90d57822dde33cf1428438847238b10b) +++ denali.pro (.../denali.pro) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -108,6 +108,7 @@ QMAKE_CFLAGS += $$COVERAGE_OPTIONS QMAKE_CXXFLAGS += $$COVERAGE_OPTIONS QMAKE_LFLAGS += $$COVERAGE_OPTIONS + DEFINES += SQUISH_COCO_BULD } tst_canbus { @@ -146,6 +147,18 @@ unittests/tst_utilities.cpp } +tst_acknow { + message(Building with QtTest test case acknow) + QT += testlib + DEFINES += UNIT_TEST \ + TEST_CLASS_INCLUDE=\\\"unittests/tst_acknow.h\\\" \ + TEST_CLASS_NAME=tst_acknow + HEADERS += \ + unittests/tst_acknow.h + SOURCES += \ + unittests/tst_acknow.cpp +} + # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = Index: denali.pro.user =================================================================== diff -u -r1ec7b44e6d1d66460d2da943ff65f3c0c0755d8f -r805119c460b4a266d6401c8705f4427e7fbe270f --- denali.pro.user (.../denali.pro.user) (revision 1ec7b44e6d1d66460d2da943ff65f3c0c0755d8f) +++ denali.pro.user (.../denali.pro.user) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -1,14 +1,14 @@ - + EnvironmentId {67370740-e20f-4fc6-be45-6652e866a8bf} ProjectExplorer.Project.ActiveTarget - 1 + 0 ProjectExplorer.Project.EditorSettings @@ -65,6 +65,311 @@ ProjectExplorer.Project.Target.0 + Qt 5.12.5 (iMX8) + Qt 5.12.5 (iMX8) + {5d6458ef-f917-4aef-a092-c77bbe106149} + 0 + 0 + 0 + + /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + + true + Check for free disk space + + RemoteLinux.CheckForFreeDiskSpaceStep + + + + + / + 5242880 + + + + + true + Kill current application instance + + RemoteLinux.KillAppStep + + + + + + + + + true + Deploy files via rsync + + RemoteLinux.RsyncDeployStep + + + + + + + -av + false + + 3 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy to Remote Linux Host + + DeployToGenericLinux + + 1 + + + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 1 + + + denali (on Generic Linux Device (iMX8)) + RemoteLinuxRunConfiguration:/home/denali/Project/application/denali.pro + 1 + + false + 1 1 + 3768 + false + true + false + false + true + false + + + :0 + + 1 + + + + ProjectExplorer.Project.Target.1 + Desktop Qt 5.12.5 GCC 64bit Desktop Qt 5.12.5 GCC 64bit qt.qt5.5125.gcc_64_kit @@ -521,112 +826,19 @@ 2 true - 6 - + + /home/denali/Project/tmp/build/unittest/tst_acknow - 0 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy Configuration - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - denali - - Qt4ProjectManager.Qt4RunConfiguration:/home/denali/Project/application/denali.pro - - 3768 - false - true - true - false - true - false - - /home/denali/Project/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug - - 1 - - - - ProjectExplorer.Project.Target.1 - - Qt 5.12.5 (iMX8) - Qt 5.12.5 (iMX8) - {5d6458ef-f917-4aef-a092-c77bbe106149} - 0 - 0 - 0 - - /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Debug - true qmake QtProjectManager.QMakeBuildStep true - + CONFIG+=tst_acknow CONFIG+=CodeCoverage false - false - false + true + true true @@ -635,123 +847,47 @@ Qt4ProjectManager.MakeStep false - + LINK=csg++ AR=csar CXX=csg++ CC=csgcc -j4 false - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - + true - Make + + %{buildDir}/denali + %{buildDir} + Custom Process Step - Qt4ProjectManager.MakeStep - - true - clean - - false + ProjectExplorer.ProcessStep - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Release - - + true - qmake + -m denali.csmes -t UnitTests denali.csexe + cmcsexeimport + %{buildDir} + Custom Process Step - QtProjectManager.QMakeBuildStep - false - - false - false - true + ProjectExplorer.ProcessStep - + true - Make + --csmes=denali.csmes --html=Coverage/index + cmreport + %{buildDir} + Custom Process Step - Qt4ProjectManager.MakeStep - - false - - - false + ProjectExplorer.ProcessStep - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - + true - Make + --csmes=denali.csmes --csv-excel=Coverage/coverage.csv + cmreport + %{buildDir} + Custom Process Step - Qt4ProjectManager.MakeStep - - true - clean - - false + ProjectExplorer.ProcessStep - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - - /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Profile - - - true - qmake - - QtProjectManager.QMakeBuildStep - true - - false - true - true - - - true - Make - - Qt4ProjectManager.MakeStep - - false - - - false - - 2 + 6 Build ProjectExplorer.BuildSteps.Build @@ -775,65 +911,27 @@ 2 false - - Profile - Profile + + PATH=/opt/SquishCoco/bin:/opt/SquishCoco/wrapper/bin:/opt/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/denali/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin + + Test + tst_acknow Qt4ProjectManager.Qt4BuildConfiguration - 0 + 2 true - 3 + 7 - - true - Check for free disk space - - RemoteLinux.CheckForFreeDiskSpaceStep - - - - - / - 5242880 - - - - - true - Kill current application instance - - RemoteLinux.KillAppStep - - - - - - - - - true - Deploy files via rsync - - RemoteLinux.RsyncDeployStep - - - - - - - -av - false - - 3 + 0 Deploy ProjectExplorer.BuildSteps.Deploy 1 - Deploy to Remote Linux Host + Deploy Configuration - DeployToGenericLinux + ProjectExplorer.DefaultDeployConfiguration 1 @@ -887,25 +985,21 @@ 13 14 - 1 + 2 - - denali (on Generic Linux Device (iMX8)) - RemoteLinuxRunConfiguration:/home/denali/Project/application/denali.pro - 1 - - false + denali + + Qt4ProjectManager.Qt4RunConfiguration:/home/denali/Project/application/denali.pro 1 1 3768 false true + true false - false - true - false + true + false - - :0 + /home/denali/Project/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug 1 Index: main.cpp =================================================================== diff -u -r939d1bae9a394697d46ca913a2dc3442bf8ef82f -r805119c460b4a266d6401c8705f4427e7fbe270f --- main.cpp (.../main.cpp) (revision 939d1bae9a394697d46ca913a2dc3442bf8ef82f) +++ main.cpp (.../main.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -39,6 +39,26 @@ #include "usbwatcher.h" #include "threads.h" +#include +/*! + * \brief signalhandler + * \details When application terminates it quits gracefully. + * \param sig - The Linux signal causes the termination. + */ +void signalhandler(int sig) +{ + if (sig == SIGINT) + { + qDebug() << QObject::tr("Application terminated by SIGINT"); + qApp->quit(); + } + else if (sig == SIGTERM) + { + qDebug() << QObject::tr("Application terminated by SIGTERM"); + qApp->quit(); + } +} + #ifdef UNIT_TEST #include TEST_CLASS_INCLUDE QTEST_MAIN(TEST_CLASS_NAME) @@ -50,6 +70,12 @@ */ int main(int argc, char *argv[]) { + +#ifndef SQUISH_COCO_BULD + signal(SIGINT , signalhandler); + signal(SIGTERM, signalhandler); +#endif + //! - Qt Application initialization and parameters settings // Qt Core Application parameters settings QApplication::setApplicationName(QLatin1String("Denali")); @@ -132,7 +158,7 @@ int app_exec = app.exec(); // Due to Qt Error the CAN Device cannot be disable/enable from withing another thread - // (other than main thread which is the owner of the CanDevice owner). + // (other than main thread which is the owner of the CanDevice). // So it needs to be done here in main thread. _CanInterface.quitDevice(); Index: sources/applicationcontroller.cpp =================================================================== diff -u -r7d23aecac8db9b7495e7d505f55bba5a0d510360 -r805119c460b4a266d6401c8705f4427e7fbe270f --- sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision 7d23aecac8db9b7495e7d505f55bba5a0d510360) +++ sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -73,8 +73,11 @@ */ void ApplicationController::quit() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. quitThread(); } +// coco end /*! * \brief ApplicationController::initConnections @@ -133,11 +136,15 @@ */ void ApplicationController::quitThread() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. + if ( ! _thread ) return; // runs in thread moveToThread(qApp->thread()); } +// coco end /*! * \brief Process the requested action Index: sources/canbus/caninterface.cpp =================================================================== diff -u -r8c69137f18382bdc55a5678e6ed44a7683fe4dea -r805119c460b4a266d6401c8705f4427e7fbe270f --- sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) +++ sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -82,8 +82,11 @@ */ void CanInterface::quit() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. quitThread(); } +// coco end /*! * \brief CanInterface status @@ -141,11 +144,15 @@ */ void CanInterface::quitThread() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. + if (! _thread) return; // runs in thread moveToThread(qApp->thread()); } +// coco end /*! * \brief CanInterface::createDevice Index: sources/canbus/caninterface.h =================================================================== diff -u -r7d23aecac8db9b7495e7d505f55bba5a0d510360 -r805119c460b4a266d6401c8705f4427e7fbe270f --- sources/canbus/caninterface.h (.../caninterface.h) (revision 7d23aecac8db9b7495e7d505f55bba5a0d510360) +++ sources/canbus/caninterface.h (.../caninterface.h) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -25,6 +25,7 @@ // forward declarations class tst_canbus; +class tst_acknow; // namespace namespace Can { @@ -44,6 +45,7 @@ // friends friend class ::tst_canbus; + friend class ::tst_acknow; // constants const char *_canType = "socketcan"; Index: sources/canbus/frameinterface.cpp =================================================================== diff -u -r8c69137f18382bdc55a5678e6ed44a7683fe4dea -r805119c460b4a266d6401c8705f4427e7fbe270f --- sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) +++ sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -71,8 +71,11 @@ */ void FrameInterface::quit() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. quitThread(); } +// coco end /*! * \brief FrameInterface connections definition @@ -115,11 +118,15 @@ */ void FrameInterface::quitThread() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. + if ( ! _thread ) return; // runs in thread moveToThread(qApp->thread()); } +// coco end /*! * \brief FrameInterface::transmitFrame Index: sources/canbus/frameinterface.h =================================================================== diff -u -r8c69137f18382bdc55a5678e6ed44a7683fe4dea -r805119c460b4a266d6401c8705f4427e7fbe270f --- sources/canbus/frameinterface.h (.../frameinterface.h) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) +++ sources/canbus/frameinterface.h (.../frameinterface.h) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -26,6 +26,7 @@ // forward declarations class tst_canbus; +class tst_acknow; // namespace namespace Can { @@ -43,6 +44,7 @@ // friends friend class ::tst_canbus; + friend class ::tst_acknow; /*! * \brief The ChannelGroup enum Index: sources/canbus/messageacknowmodel.cpp =================================================================== diff -u -r1ec7b44e6d1d66460d2da943ff65f3c0c0755d8f -r805119c460b4a266d6401c8705f4427e7fbe270f --- sources/canbus/messageacknowmodel.cpp (.../messageacknowmodel.cpp) (revision 1ec7b44e6d1d66460d2da943ff65f3c0c0755d8f) +++ sources/canbus/messageacknowmodel.cpp (.../messageacknowmodel.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -70,8 +70,11 @@ */ void MessageAcknowModel::quit() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. quitThread(); } +// coco end /*! * \brief MessageAcknowModel::initConnections @@ -111,11 +114,15 @@ */ void MessageAcknowModel::quitThread() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. + if ( ! _thread ) return; // runs in thread moveToThread(qApp->thread()); } +// coco end /*! * \brief MessageAcknowModel::onAcknowTransmit @@ -182,4 +189,5 @@ _acknowList[vSequence]->deleteLater(); _acknowList.remove(vSequence); emit didFailedTransmit(vSequence); + LOG_ERROR( tr("Acknow retry failed for sequence %1").arg(vSequence) ); } Index: sources/canbus/messageacknowmodel.h =================================================================== diff -u -r1ec7b44e6d1d66460d2da943ff65f3c0c0755d8f -r805119c460b4a266d6401c8705f4427e7fbe270f --- sources/canbus/messageacknowmodel.h (.../messageacknowmodel.h) (revision 1ec7b44e6d1d66460d2da943ff65f3c0c0755d8f) +++ sources/canbus/messageacknowmodel.h (.../messageacknowmodel.h) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -22,6 +22,8 @@ // Define #define _MessageAcknowModel Can::MessageAcknowModel::I() +class tst_acknow; + // namespace namespace Can { @@ -37,6 +39,8 @@ Q_OBJECT + friend class ::tst_acknow; + const int _interval = 1000; // in ms int _timerId = 0; quint8 _retry = 5; @@ -104,6 +108,7 @@ { Q_OBJECT + friend class ::tst_acknow; typedef QHash AcknowList; AcknowList _acknowList; Index: sources/canbus/messagedispatcher.cpp =================================================================== diff -u -r1ec7b44e6d1d66460d2da943ff65f3c0c0755d8f -r805119c460b4a266d6401c8705f4427e7fbe270f --- sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision 1ec7b44e6d1d66460d2da943ff65f3c0c0755d8f) +++ sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -73,8 +73,11 @@ */ void MessageDispatcher::quit() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. quitThread(); } +// coco end /*! * \brief Message Handler connections definition @@ -125,11 +128,15 @@ */ void MessageDispatcher::quitThread() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. + if ( ! _thread ) return; // runs in thread moveToThread(qApp->thread()); } +// coco end /*! * \brief MessageDispatcher::onFrameReceive @@ -157,11 +164,11 @@ // TODO : must be moved to a MessageModel class if (mMessage.isComplete()) { rxCount(); - #ifdef QT_DEBUG - if (_rxSequence != mMessage.sequence) { - qDebug() << tr("Out of Sync : %1 , %2").arg(_rxSequence).arg(mMessage.sequence); - } - #endif + //#ifdef QT_DEBUG + // if (_rxSequence != mMessage.sequence) { + // qDebug() << tr("Out of Sync : %1 , %2").arg(_rxSequence).arg(mMessage.sequence); + // } + //#endif interpretMessage(mMessage); } } @@ -212,7 +219,7 @@ if (vSequence == 0) { // initialize // it's obvious that this assignment does not effect outside of the function. // but is make it easier to just assume the correct value has been passed - // and still using the function parameter as a local variable. + // and still using the same variable (function parameter) as a local variable. vSequence = _txSequence; } @@ -362,14 +369,5 @@ */ bool MessageDispatcher::needsAcknow(GuiActionType vActionId) { - switch(vActionId) { - case GuiActionType::Acknow: - return false; - default: -#ifdef DEBUG_ACKBACK_HD_TO_UI - return true; -#else - return false; -#endif - } + return _needsAcknow.contains(vActionId); } Index: sources/canbus/messagedispatcher.h =================================================================== diff -u -r939d1bae9a394697d46ca913a2dc3442bf8ef82f -r805119c460b4a266d6401c8705f4427e7fbe270f --- sources/canbus/messagedispatcher.h (.../messagedispatcher.h) (revision 939d1bae9a394697d46ca913a2dc3442bf8ef82f) +++ sources/canbus/messagedispatcher.h (.../messagedispatcher.h) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -26,6 +26,7 @@ // forward declarations class tst_canbus; +class tst_acknow; // since this class is the interface between GUI and Can // it needs to use Gui namespace otherwise it makes code hard to read. @@ -85,18 +86,21 @@ // friends friend class ::tst_canbus; + friend class ::tst_acknow; QHash _messageList; - Sequence _txSequence = 0; - Sequence _rxSequence = 0; + Sequence _txSequence = 0; + Sequence _rxSequence = 0; - MessageBuilder _builder; - MessageInterpreter _interpreter; + MessageBuilder _builder; + MessageInterpreter _interpreter; - QThread *_thread = nullptr; - bool _init = false; + QThread *_thread = nullptr; + bool _init = false; + QList _needsAcknow {}; // no action needs Acknow for now + // Singleton SINGLETON(MessageDispatcher) Index: sources/gui/guicontroller.cpp =================================================================== diff -u -r8c69137f18382bdc55a5678e6ed44a7683fe4dea -r805119c460b4a266d6401c8705f4427e7fbe270f --- sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) +++ sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -54,8 +54,11 @@ */ void GuiController::quit() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. quitThread(); } +// coco end /*! * \brief GuiController::initConnections @@ -88,6 +91,8 @@ */ void GuiController::initThread(QThread &vThread) { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. // runs in main thread Q_ASSERT_X(QThread::currentThread() == qApp->thread() , __func__, "The Class initialization must be done in Main Thread" ); _thread = &vThread; @@ -96,6 +101,7 @@ _thread->start(); moveToThread(_thread); } +// coco end /*! * \brief GuiController::quitThread @@ -104,11 +110,14 @@ */ void GuiController::quitThread() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. if ( ! _thread ) return; // runs in thread moveToThread(qApp->thread()); } +// coco end /*! * \brief GuiController initializer @@ -153,6 +162,7 @@ */ bool GuiController::handleTransmit(GuiActionType vAction, const QVariantList &vData) { + // coco begin validated: This is a sample code and currently does nothing Q_UNUSED(vAction) Q_UNUSED(vData) @@ -179,6 +189,7 @@ } return false; } +// coco end /*! * \brief Action commanded by HD @@ -201,8 +212,11 @@ */ void GuiController::onUSBDriveMount() { + // coco begin validated: This needs user interaction to plug-in USB device + // has been tested manually emit didUSBDriveMount(); } +// coco end /*! * \brief GuiController::doUSBDriveUmount @@ -211,8 +225,11 @@ */ void GuiController::doUSBDriveUmount() { + // coco begin validated: This needs user interaction to plug-out the USB device + // has been tested manually emit didUSBDriveUmount(); } +// coco end /*! * \brief GuiController::onUSBDriveRemove @@ -221,8 +238,11 @@ */ void GuiController::onUSBDriveRemove() { + // coco begin validated: This needs user interaction to plug-out the USB device + // has been tested manually emit didUSBDriveRemove(); } +// coco end /*! * \brief GuiController::onExport @@ -231,8 +251,11 @@ */ void GuiController::onExport() { + // coco begin validated: This needs user interaction to export to USB device + // has been tested manually emit didExport(); } +// coco end /*! * \brief GuiController::doExportLog @@ -241,6 +264,8 @@ */ void GuiController::doExportLog() { + // coco begin validated: This needs user interaction to export to USB device + // has been tested manually emit didExportLog(); } - +// coco end Index: sources/gui/qml/pages/TreatmentStack.qml =================================================================== diff -u -r442d1c4f53c96991d4103485ff5ff683ed00d4f7 -r805119c460b4a266d6401c8705f4427e7fbe270f --- sources/gui/qml/pages/TreatmentStack.qml (.../TreatmentStack.qml) (revision 442d1c4f53c96991d4103485ff5ff683ed00d4f7) +++ sources/gui/qml/pages/TreatmentStack.qml (.../TreatmentStack.qml) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -17,6 +17,7 @@ import QtQuick.Controls 2.12 // Project + // Qml imports import "qrc:/globals" import "qrc:/components" @@ -32,10 +33,10 @@ y : -Variables.mainMenuHeight position : MainMenu.Position.Top hidden : true - titles : [ qsTr("Basic") , qsTr("Advanced") , qsTr("Trending") , qsTr("Settings") ] + titles : [ qsTr("Back") , qsTr("Treatment") , qsTr("Trending") , qsTr("Settings") ] spacing : 20 leftPdding : 20 - partitionWidth : 100 + partitionWidth : 100 // Todo Important : max width should be the width for all hasRightText : true hasLogo : true } Index: sources/storage/logger.cpp =================================================================== diff -u -r8c69137f18382bdc55a5678e6ed44a7683fe4dea -r805119c460b4a266d6401c8705f4427e7fbe270f --- sources/storage/logger.cpp (.../logger.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) +++ sources/storage/logger.cpp (.../logger.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -77,8 +77,11 @@ */ void Logger::quit() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. quitThread(); } +// coco end void Logger::onLog(const QString &vContent, LogType vLogType) { @@ -125,11 +128,15 @@ */ void Logger::quitThread() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. + if (! _thread) return; // runs in thread moveToThread(qApp->thread()); } +// coco end /*! * \brief Logger::checkLogPath @@ -228,7 +235,8 @@ FileHandler::write(_logFileName, mContent + "\r\n", true); if (vLogType == eLogError) { #ifdef QT_DEBUG - mContent.prepend("\033[1;31m --- @ --- \033[0m"); + //mContent.prepend("\033[1;31m --- @ --- \033[0m"); + mContent.prepend(" @ "); #endif qDebug().noquote() << mContent; } @@ -243,15 +251,21 @@ */ bool Logger::concurrentExport() { + // coco begin validated: This needs user interaction to export to USB device + // has been tested manually QString mSource = Storage::Log_Base_Path_Name_Location; QString mDestination = Storage::USB_Mount_Point; QFuture future = QtConcurrent::run(&FileHandler::copyFolder, mSource, mDestination); _exportWatcher.setFuture(future); future.waitForFinished(); return true; } +// coco end void Logger::onExport() { + // coco begin validated: This needs user interaction to export to USB device + // has been tested manually emit didExport(); } +// coco end Index: sources/storage/usbwatcher.cpp =================================================================== diff -u -r939d1bae9a394697d46ca913a2dc3442bf8ef82f -r805119c460b4a266d6401c8705f4427e7fbe270f --- sources/storage/usbwatcher.cpp (.../usbwatcher.cpp) (revision 939d1bae9a394697d46ca913a2dc3442bf8ef82f) +++ sources/storage/usbwatcher.cpp (.../usbwatcher.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -76,8 +76,11 @@ */ void USBWatcher::quit() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. quitThread(); } +// coco end /*! * \brief USBWatcher::initConnections @@ -115,11 +118,15 @@ */ void USBWatcher::quitThread() { + // coco begin validated: Application termination is not correctly done in coco!!! + // it has been tested and works perfectly fine in normal run. + if ( ! _thread ) return; // runs in thread moveToThread(qApp->thread()); } +// coco end /*! * \brief USBWatcher::usbSeek @@ -186,6 +193,8 @@ */ void USBWatcher::usbError(const QString &vDevice) { + // coco begin validated: This needs user interaction to plug-in/out the USB device + // has been tested manually QString error; static QString lastError; switch (errno) { @@ -202,6 +211,7 @@ lastError = error; } } +// coco end /*! * \brief USBWatcher::onUSBDriveUmount @@ -222,6 +232,8 @@ */ bool USBWatcher::usbMount(const QString &vDevice) { + // coco begin validated: This needs user interaction to plug-in the USB device + // has been tested manually bool ok; _usbDrive = vDevice.toLatin1().constData(); ok = ::mount(_usbDrive, USB_Mount_Point, USB_File_System, 0, "") == 0; @@ -235,6 +247,7 @@ } return ok; } +// coco end /*! * \brief USBWatcher::usbUmount @@ -245,6 +258,8 @@ */ bool USBWatcher::usbUmount(const QString &vDevice) { + // coco begin validated: This needs user interaction to plug-out the USB device + // has been tested manually bool ok; ok = ::umount(vDevice.toLatin1().constData()) == 0; if (ok) { @@ -257,6 +272,7 @@ } return ok; } +// coco end /*! * \brief USBWatcher::usbRemove @@ -266,9 +282,12 @@ */ void USBWatcher::usbRemove() { + // coco begin validated: This needs user interaction to plug-out the USB device + // has been tested manually usbUmount(USB_Mount_Point); _umounted = false; _removed = true; LOG_EVENT(tr("USB drive removed")); emit didUSBDriveRemove(); } +// coco end Index: unittests/tst_acknow.cpp =================================================================== diff -u --- unittests/tst_acknow.cpp (revision 0) +++ unittests/tst_acknow.cpp (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -0,0 +1,166 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, + * IN PART OR IN WHOLE, + * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * file tst_acknow.cpp + * date 01/21/2020 + * author Behrouz NematiPour + * + */ +#include "tst_acknow.h" + +// Project +#include "caninterface.h" +#include "frameinterface.h" +#include "messageacknowmodel.h" + +#define DEBUG_ACKBACK_HD_TO_UI + +using namespace Can; + +tst_acknow::tst_acknow(QObject *parent) +{ +} + +/*! + * \brief tst_acknow::init + * \details this method should only initialize the can interfaces and is not for test + * bus needs to pass the initialization. + */ +void tst_acknow::init() +{ + _emited = false; + _Logger.init(); + _CanInterface.init(); + _CanInterface.enableConsoleOut(true); + QString mTr = tr("Connected"); + QCOMPARE(_CanInterface.status().left(mTr.length()), mTr); + + _CanInterface.onFrameReceive (); + + _FrameInterface .init(); + _MessageDispatcher .init(); + _MessageDispatcher .enableConsoleOut(true); + + connect(&_MessageDispatcher , SIGNAL(didFrameTransmit(Can_Id , const QByteArray &)), + this , SLOT( onFrameTransmit(Can_Id , const QByteArray &))); + connect(&_MessageDispatcher , SIGNAL(didActionReceive(GuiActionType , const QVariantList &)), + this , SLOT( onActionReceive(GuiActionType , const QVariantList &))); + + connect(&_MessageAcknowModel, SIGNAL(didFramesTransmit(Can_Id, Sequence, const FrameList &)), + this , SLOT( onFramesTransmit(Can_Id, Sequence, const FrameList &))); + connect(&_MessageAcknowModel, SIGNAL(didFailedTransmit(Sequence)), + this , SLOT( onFailedTransmit(Sequence))); + +} + +void tst_acknow::tst_AcknowModel_Init() +{ + QVERIFY( _MessageAcknowModel.init() ); +} + +/*! + * \brief tst_acknow::tst_AcknowModel_Receive_Normal + * \details UI receives a message which doesn't require Acknow + */ +void tst_acknow::tst_AcknowModel_Receive_Normal() +{ + _action = Gui::GuiActionType::PowerOff; + _data = {0}; + QCanBusFrame mFrame; + QString mPayload; + mFrame.setFrameId(Can_Id::eChlid_HD_UI); + mPayload = "A5.01.00.01.00.01.00.38"; + mFrame.setPayload(QByteArray::fromHex(mPayload.remove(QLatin1Char('.')).toLatin1())); + emit _CanInterface.didFrameReceive(mFrame); + QVERIFY(_emited); +} + +/*! + * \brief tst_acknow::tst_AcknowModel_Receive_Acknow + * \details UI receives a message which requires Acknow + * UI should send the Ack Back + */ +void tst_acknow::tst_AcknowModel_Receive_Acknow() +{ + _expected = "A5.01.00.FF.FF.00.19.00"; + _action = Gui::GuiActionType::PowerOff; + _data = {0}; + QCanBusFrame mFrame; + QString mPayload; + mFrame.setFrameId(Can_Id::eChlid_HD_UI); + mPayload = "A5.FF.FF.01.00.01.00.96"; + mFrame.setPayload(QByteArray::fromHex(mPayload.remove(QLatin1Char('.')).toLatin1())); + emit _CanInterface.didFrameReceive(mFrame); + QVERIFY(_emited); +} + +/*! + * \brief tst_acknow::tst_AcknowModel_Transmit_Normal + * \details Transmit a normal message + */ +void tst_acknow::tst_AcknowModel_Transmit_Normal() +{ + _expected = "A5.02.00.07.00.00.74.00"; + _MessageDispatcher.onActionTransmit(Gui::GuiActionType::KeepAlive, {}); + QVERIFY(_emited); +} + +/*! + * \brief tst_acknow::tst_AcknowModel_Transmit_Acknow + * \details Transmit a message which needs a + */ +void tst_acknow::tst_AcknowModel_Transmit_Acknow() +{ + QCOMPARE( _MessageAcknowModel._acknowList.count(), 0 ); + _MessageDispatcher._needsAcknow.append(Gui::GuiActionType::KeepAlive); + _expected = "A5.FD.FF.07.00.00.30.00"; + Sequence sequence = 3; + _MessageDispatcher.actionTransmit(Gui::GuiActionType::KeepAlive, {}, sequence); + QCOMPARE( _MessageAcknowModel._acknowList.count(), 1 ); + QVERIFY(_emited); + _MessageDispatcher._needsAcknow.removeOne(Gui::GuiActionType::KeepAlive); +} + +void tst_acknow::cleanupTestCase() +{ + _CanInterface.quitDevice(); + QString mTr = tr("Disconnected"); + QCOMPARE(_CanInterface.status().left(mTr.length()), mTr); +} + +void tst_acknow::onFrameTransmit(Can_Id vCan_Id, const QByteArray &vPayload) +{ + Q_UNUSED(vCan_Id) + _emited = true; + QCOMPARE(Format::toHexString(vPayload), _expected); +} + +void tst_acknow::onActionReceive(Gui::GuiActionType vAction, const QVariantList &vData) +{ + _emited = true; + QVERIFY(vAction == _action); + for (int i = 0; i < vData.length(); i++) { + if (! strcmp(vData[i].typeName(), "float")) { + float f1 = vData[i].toFloat(); + float f2 = _data[i].toFloat(); + QVERIFY(Types::floatCompare(f1, f2)); + } else { + QVERIFY(vData[i] == _data[i]); + } + } +} + +void tst_acknow::onFramesTransmit(Can_Id vCan_Id, Sequence vSequence, const FrameList &vFrameList) +{ + qDebug() << vCan_Id << vSequence << vFrameList; +} + +void tst_acknow::onFailedTransmit(Sequence) +{ + qDebug() << " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "; +} Index: unittests/tst_acknow.h =================================================================== diff -u --- unittests/tst_acknow.h (revision 0) +++ unittests/tst_acknow.h (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -0,0 +1,55 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, + * IN PART OR IN WHOLE, + * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * file tst_acknow.h + * date 01/21/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include +#include + +// Project +#include "messagedispatcher.h" +using namespace Can; + +class tst_acknow : public QObject +{ + Q_OBJECT + + bool _emited = false ; + QByteArray _expected {} ; + QVariantList _data {} ; + int _action = -1 ; + +public: + explicit tst_acknow(QObject *parent = nullptr); + +private slots: + void init(); + void tst_AcknowModel_Init(); + + // NOTE : PLEASE DON'T CHANGE THE ORDER + // THE SEQUENCES HAS BEEN HARD CODED IN THE MESSAGES. + void tst_AcknowModel_Receive_Normal(); + void tst_AcknowModel_Receive_Acknow(); + + void tst_AcknowModel_Transmit_Normal(); + void tst_AcknowModel_Transmit_Acknow(); + + void cleanupTestCase(); + + void onFrameTransmit (Can_Id vCan_Id , const QByteArray &vPayload); + void onActionReceive (GuiActionType vAction , const QVariantList &vData ); + void onFramesTransmit(Can_Id vCan_Id , Sequence vSequence, const FrameList &vFrameList); + void onFailedTransmit(Sequence); +}; + Index: unittests/tst_canbus.cpp =================================================================== diff -u -r1b8d8fdf90d57822dde33cf1428438847238b10b -r805119c460b4a266d6401c8705f4427e7fbe270f --- unittests/tst_canbus.cpp (.../tst_canbus.cpp) (revision 1b8d8fdf90d57822dde33cf1428438847238b10b) +++ unittests/tst_canbus.cpp (.../tst_canbus.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -38,6 +38,7 @@ void tst_canbus::init() { _emited = false; + _Logger.init(); } void tst_canbus::tst_CanInterface_Connect_Error_Interface() Index: unittests/tst_canbus.h =================================================================== diff -u -r1b8d8fdf90d57822dde33cf1428438847238b10b -r805119c460b4a266d6401c8705f4427e7fbe270f --- unittests/tst_canbus.h (.../tst_canbus.h) (revision 1b8d8fdf90d57822dde33cf1428438847238b10b) +++ unittests/tst_canbus.h (.../tst_canbus.h) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -46,6 +46,8 @@ void tst_FrameInterface_ReInit(); + // NOTE : PLEASE DON'T CHANGE THE ORDER + // THE SEQUENCES HAS BEEN HARD CODED IN THE MESSAGES. void tst_FrameInterface_ActionTransmit_KeepAlive(); void tst_FrameInterface_TransmitFrame_LongerData(); void tst_FrameInterface_ActionTransmit_PowerOff_Accepted(); Index: unittests/tst_logging.cpp =================================================================== diff -u -r8c69137f18382bdc55a5678e6ed44a7683fe4dea -r805119c460b4a266d6401c8705f4427e7fbe270f --- unittests/tst_logging.cpp (.../tst_logging.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) +++ unittests/tst_logging.cpp (.../tst_logging.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -30,10 +30,6 @@ */ tst_logging::tst_logging(QObject *parent) : QObject(parent) { } -// void tst_logging::initTestCase_data() -// { -// } - void tst_logging::initTestCase() { Threads::registerTypes(); @@ -44,19 +40,11 @@ QCOMPARE(mContent, "Event: , Storage::Logger Initialized\n"); } -// void tst_logging::init() -// { -// } - void tst_logging::cleanup() { QThread::currentThread()->msleep(1000); } -void tst_logging::cleanupTestCase() -{ -} - void tst_logging::logEvent() { LOG_EVENT("1 - Event log has been created"); Index: unittests/tst_logging.h =================================================================== diff -u -rb9c5b0b3afc3b34d4980ecc4f023f498f80dafbc -r805119c460b4a266d6401c8705f4427e7fbe270f --- unittests/tst_logging.h (.../tst_logging.h) (revision b9c5b0b3afc3b34d4980ecc4f023f498f80dafbc) +++ unittests/tst_logging.h (.../tst_logging.h) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -30,14 +30,10 @@ private slots: - // void initTestCase_data(); // will be called before the first test function is executed. void initTestCase(); - // will be called before each test function is executed. - // void init(); - // will be called after every test function. void cleanup(); Index: unittests/tst_utilities.cpp =================================================================== diff -u -r8c69137f18382bdc55a5678e6ed44a7683fe4dea -r805119c460b4a266d6401c8705f4427e7fbe270f --- unittests/tst_utilities.cpp (.../tst_utilities.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) +++ unittests/tst_utilities.cpp (.../tst_utilities.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -26,32 +26,49 @@ */ tst_utilities::tst_utilities(QObject *parent) : QObject(parent) { } -// void tst_utilities::initTestCase_data() -// { -// } +void tst_utilities::tst_floatCompare_noMatch() +{ + QVERIFY( ! Types::floatCompare(1.002,1.003)); +} -//void tst_utilities::initTestCase() -//{ -//} +void tst_utilities::tst_floatCompare_isMatch() +{ + QVERIFY( Types::floatCompare(1.354,1.354)); +} -// void tst_utilities::init() -// { -// } +void tst_utilities::tst_getbits_NoError() +{ + QByteArray ba = QByteArray::fromHex("a5"); + Types::Flags flg; + int i = 0; + QVERIFY( Types::getBits(ba,i,flg,8)); +} -//void tst_utilities::cleanup() -//{ -//} +void tst_utilities::tst_getbits_IsError() +{ + QByteArray ba = QByteArray::fromHex("a5"); + Types::Flags flg; + int i = 0; + QVERIFY( ! Types::getBits(ba,i,flg,9)); +} -//void tst_utilities::cleanupTestCase() -//{ -//} +void tst_utilities::tst_fromvariant_NoString() +{ + QCOMPARE(Format::fromVariant(64), "@"); +} -void tst_utilities::getValue_len() +void tst_utilities::tst_fromvariant_IsString() { + QCOMPARE(Format::fromVariant("@"), "@"); +} + +void tst_utilities::tst_getValue_len() +{ Types::S32 vFlowSetPoint; int index = 0; QByteArray data; data += 0xFF; QVERIFY( ! Types::getValue<>( data, index, vFlowSetPoint ) ); } + Index: unittests/tst_utilities.h =================================================================== diff -u -re02b2d465b145702dc41965b2e7da154857eea75 -r805119c460b4a266d6401c8705f4427e7fbe270f --- unittests/tst_utilities.h (.../tst_utilities.h) (revision e02b2d465b145702dc41965b2e7da154857eea75) +++ unittests/tst_utilities.h (.../tst_utilities.h) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -30,21 +30,13 @@ private slots: - // void initTestCase_data(); + void tst_getValue_len(); + void tst_floatCompare_noMatch(); + void tst_floatCompare_isMatch(); + void tst_getbits_NoError(); + void tst_getbits_IsError(); + void tst_fromvariant_NoString(); + void tst_fromvariant_IsString(); - // will be called before the first test function is executed. - // void initTestCase(); - - // will be called before each test function is executed. - // void init(); - - // will be called after every test function. - // void cleanup(); - - // will be called after the last test function was executed. - // void cleanupTestCase(); - - void getValue_len(); - };