Index: denali.pro =================================================================== diff -u -r909090c5bae8b2fcc9aed6c2b55078b4f3d26fdd -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- denali.pro (.../denali.pro) (revision 909090c5bae8b2fcc9aed6c2b55078b4f3d26fdd) +++ denali.pro (.../denali.pro) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -128,10 +128,12 @@ denali.qrc DEFINES += \ - VER_MAJOR="0" \ - VER_MINOR="4" \ - VER_REVIS="\\\"${buildNumber}\\\"" \ - VER_DEVEL=\\\"$$system( date "+%m%d%H%M" )\\\" + VER_MAJOR="\\\"${majorVersion}\\\"" \ + VER_MINOR="\\\"${minorVersion}\\\"" \ + VER_REVIS="\\\"${buildNumber}\\\"" \ + VER_MAJOR_DEV=\\\"0\\\" \ + VER_MINOR_DEV=\\\"9\\\" \ + VER_REVIS_DEV=\\\"$$system( date "+%m%d%H%M" )\\\" \ VER_APPLY=\\\"$$system( touch -m main.cpp)\\\" CodeCoverage { @@ -198,6 +200,60 @@ unittests/tst_acknow.cpp } +tst_models { + message(Building with QtTest test case models) + QT += testlib + DEFINES += UNIT_TEST \ + TEST_CLASS_INCLUDE=\\\"unittests/tst_models.h\\\" \ + TEST_CLASS_NAME=tst_models + HEADERS += \ + unittests/tst_models.h + SOURCES += \ + unittests/tst_models.cpp +} + +tst_views { + message(Building with QtTest test case views) + QT += testlib + DEFINES += UNIT_TEST \ + TEST_CLASS_INCLUDE=\\\"unittests/tst_views.h\\\" \ + TEST_CLASS_NAME=tst_views + HEADERS += \ + unittests/tst_views.h + SOURCES += \ + unittests/tst_views.cpp +} + +tst_initializations { + message(Building with QtTest test case initializations) + QT += testlib + DEFINES += UNIT_TEST \ + TEST_CLASS_INCLUDE=\\\"unittests/tst_initializations.h\\\" \ + TEST_CLASS_NAME=tst_initializations + HEADERS += unittests/tst_initializations.h + SOURCES += unittests/tst_initializations.cpp +} + +tst_threads { + message(Building with QtTest test case threads) + QT += testlib + DEFINES += UNIT_TEST \ + TEST_CLASS_INCLUDE=\\\"unittests/tst_threads.h\\\" \ + TEST_CLASS_NAME=tst_threads + HEADERS += unittests/tst_threads.h + SOURCES += unittests/tst_threads.cpp +} + +tst_messaging { + message(Building with QtTest test case messaging) + QT += testlib + DEFINES += UNIT_TEST \ + TEST_CLASS_INCLUDE=\\\"unittests/tst_messaging.h\\\" \ + TEST_CLASS_NAME=tst_messaging + HEADERS += unittests/tst_messaging.h + SOURCES += unittests/tst_messaging.cpp +} + # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = Index: denali.pro.user =================================================================== diff -u -r1b060ccba8bfccf34d6a7a5ddd6d94eb6d149829 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- denali.pro.user (.../denali.pro.user) (revision 1b060ccba8bfccf34d6a7a5ddd6d94eb6d149829) +++ denali.pro.user (.../denali.pro.user) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -1,6 +1,6 @@ - + EnvironmentId @@ -65,30 +65,26 @@ ProjectExplorer.Project.Target.0 - Qt 5.12.5 (iMX8) - Qt 5.12.5 (iMX8) - {5d6458ef-f917-4aef-a092-c77bbe106149} + Desktop Qt 5.12.5 GCC 64bit + Desktop Qt 5.12.5 GCC 64bit + qt.qt5.5125.gcc_64_kit 0 0 0 - /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Debug + true + 2 + /home/denali/Project/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug + /home/denali/Project/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug true - qmake - QtProjectManager.QMakeBuildStep - true false - false - false true - Make - Qt4ProjectManager.MakeStep false @@ -98,14 +94,12 @@ 2 Build - + Build ProjectExplorer.BuildSteps.Build true - Make - Qt4ProjectManager.MakeStep true @@ -115,36 +109,32 @@ 1 Clean - + Clean ProjectExplorer.BuildSteps.Clean 2 false - Debug Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 - /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Release + true + 2 + /home/denali/Project/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Release + /home/denali/Project/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Release true - qmake - QtProjectManager.QMakeBuildStep - false - false - false - true + true true - Make - Qt4ProjectManager.MakeStep false @@ -154,14 +144,12 @@ 2 Build - + Build ProjectExplorer.BuildSteps.Build true - Make - Qt4ProjectManager.MakeStep true @@ -171,53 +159,75 @@ 1 Clean - + Clean ProjectExplorer.BuildSteps.Clean 2 false - Release Release Qt4ProjectManager.Qt4BuildConfiguration 0 - true + 2 + 2 - - /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Profile + + true + 2 + /home/denali/Project/tmp/build/unittest/tst_threads + /home/denali/Project/tmp/build/unittest/tst_threads true - qmake - QtProjectManager.QMakeBuildStep - true - + CONFIG+=tst_threads CONFIG+=CodeCoverage false - true - true true - Make - Qt4ProjectManager.MakeStep false - + LINK=csg++ AR=csar CXX=csg++ CC=csgcc -j4 false - 2 + + true + + %{buildDir}/denali + %{buildDir} + ProjectExplorer.ProcessStep + + + true + -m denali.csmes -t UnitTests denali.csexe + cmcsexeimport + %{buildDir} + ProjectExplorer.ProcessStep + + + true + --csmes=denali.csmes --html=Coverage/index + cmreport + %{buildDir} + ProjectExplorer.ProcessStep + + + true + --csmes=denali.csmes --csv-excel=Coverage/coverage.csv + cmreport + %{buildDir} + ProjectExplorer.ProcessStep + + 6 Build - + Build ProjectExplorer.BuildSteps.Build true - Make - Qt4ProjectManager.MakeStep true @@ -227,173 +237,114 @@ 1 Clean - + Clean ProjectExplorer.BuildSteps.Clean 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 + + tst_threads Qt4ProjectManager.Qt4BuildConfiguration - 0 - true + 2 + 2 + 2 - 3 - + + true + 2 + /home/denali/Project/tmp/build/unittest/tst_messaging + /home/denali/Project/tmp/build/unittest/tst_messaging true - Check for free disk space - - RemoteLinux.CheckForFreeDiskSpaceStep - - - - - / - 5242880 - - + QtProjectManager.QMakeBuildStep + CONFIG+=tst_messaging CONFIG+=CodeCoverage + false true - Kill current application instance - - RemoteLinux.KillAppStep - - - - - - + Qt4ProjectManager.MakeStep + + false + LINK=csg++ AR=csar CXX=csg++ CC=csgcc -j4 + + false true - Deploy files via rsync - - RemoteLinux.RsyncDeployStep - - - - - - - -av - false + + %{buildDir}/denali + %{buildDir} + ProjectExplorer.ProcessStep - 3 - Deploy - - ProjectExplorer.BuildSteps.Deploy + + true + -m denali.csmes -t UnitTests denali.csexe + cmcsexeimport + %{buildDir} + ProjectExplorer.ProcessStep + + + true + --csmes=denali.csmes --html=Coverage/index + cmreport + %{buildDir} + ProjectExplorer.ProcessStep + + + true + --csmes=denali.csmes --csv-excel=Coverage/coverage.csv + cmreport + %{buildDir} + ProjectExplorer.ProcessStep + + 6 + Build + Build + ProjectExplorer.BuildSteps.Build - 1 - Deploy to Remote Linux Host - - DeployToGenericLinux - - 1 - - - dwarf - - cpu-cycles + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + 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 - - 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 - - 3768 - false - true - false - false - true - false - - - :0 + tst_messaging + Qt4ProjectManager.Qt4BuildConfiguration + 2 + 2 + 2 - 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 - 0 - 0 - 0 - - /home/denali/Project/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug + + true + 2 + /home/denali/Project/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Profile + /home/denali/Project/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Profile true - qmake - QtProjectManager.QMakeBuildStep - true - false - false - false + true true - Make - Qt4ProjectManager.MakeStep false @@ -403,14 +354,12 @@ 2 Build - + Build ProjectExplorer.BuildSteps.Build true - Make - Qt4ProjectManager.MakeStep true @@ -420,53 +369,75 @@ 1 Clean - + Clean ProjectExplorer.BuildSteps.Clean 2 false - Debug - Debug + Profile Qt4ProjectManager.Qt4BuildConfiguration - 2 - true + 0 + 2 + 2 - - /home/denali/Project/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Release + + true + 2 + /home/denali/Project/tmp/build/unittest/tst_canbus + /home/denali/Project/tmp/build/unittest/tst_canbus true - qmake - QtProjectManager.QMakeBuildStep - false - + CONFIG+=tst_canbus CONFIG+=CodeCoverage false - false - true true - Make - Qt4ProjectManager.MakeStep false - + LINK=csg++ AR=csar CXX=csg++ CC=csgcc -j4 false - 2 + + true + + %{buildDir}/denali + %{buildDir} + ProjectExplorer.ProcessStep + + + true + -m denali.csmes -t UnitTests denali.csexe + cmcsexeimport + %{buildDir} + ProjectExplorer.ProcessStep + + + true + --csmes=denali.csmes --html=Coverage/index + cmreport + %{buildDir} + ProjectExplorer.ProcessStep + + + true + --csmes=denali.csmes --csv-excel=Coverage/coverage.csv + cmreport + %{buildDir} + ProjectExplorer.ProcessStep + + 6 Build - + Build ProjectExplorer.BuildSteps.Build true - Make - Qt4ProjectManager.MakeStep true @@ -476,53 +447,77 @@ 1 Clean - + Clean ProjectExplorer.BuildSteps.Clean 2 false - - Release - Release + + 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 + + tst_canbus Qt4ProjectManager.Qt4BuildConfiguration - 0 - true + 2 + 2 + 2 - - /home/denali/Project/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Profile + + true + 2 + /home/denali/Project/tmp/build/unittest/tst_logging + /home/denali/Project/tmp/build/unittest/tst_logging true - qmake - QtProjectManager.QMakeBuildStep - true - + CONFIG+=tst_logging CONFIG+=CodeCoverage false - true - true true - Make - Qt4ProjectManager.MakeStep false - + LINK=csg++ AR=csar CXX=csg++ CC=csgcc -j4 false - 2 + + true + + %{buildDir}/denali + %{buildDir} + ProjectExplorer.ProcessStep + + + true + -m denali.csmes -t UnitTests denali.csexe + cmcsexeimport + %{buildDir} + ProjectExplorer.ProcessStep + + + true + --csmes=denali.csmes --html=Coverage/index + cmreport + %{buildDir} + ProjectExplorer.ProcessStep + + + true + --csmes=denali.csmes --csv-excel=Coverage/coverage.csv + cmreport + %{buildDir} + ProjectExplorer.ProcessStep + + 6 Build - + Build ProjectExplorer.BuildSteps.Build true - Make - Qt4ProjectManager.MakeStep true @@ -532,36 +527,34 @@ 1 Clean - + Clean ProjectExplorer.BuildSteps.Clean 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 + + tst_logging Qt4ProjectManager.Qt4BuildConfiguration - 0 - true + 2 + 2 + 2 - - /home/denali/Project/tmp/build/unittest/tst_canbus + + true + 2 + /home/denali/Project/tmp/build/unittest/tst_utilities + /home/denali/Project/tmp/build/unittest/tst_utilities true - qmake - QtProjectManager.QMakeBuildStep - true - CONFIG+=tst_canbus CONFIG+=CodeCoverage - false - true - true + CONFIG+=tst_utilities CONFIG+=CodeCoverage + true true - Make - Qt4ProjectManager.MakeStep false @@ -574,47 +567,37 @@ %{buildDir}/denali %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep 6 Build - + Build ProjectExplorer.BuildSteps.Build true - Make - Qt4ProjectManager.MakeStep true @@ -624,38 +607,114 @@ 1 Clean - + Clean ProjectExplorer.BuildSteps.Clean 2 false 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_canbus + tst_utilities Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 - - /home/denali/Project/tmp/build/unittest/tst_logging + + true + 2 + /home/denali/Project/tmp/build/unittest/tst_acknow + /home/denali/Project/tmp/build/unittest/tst_acknow true - qmake - QtProjectManager.QMakeBuildStep - true - CONFIG+=tst_logging CONFIG+=CodeCoverage + CONFIG+=tst_acknow CONFIG+=CodeCoverage + true + + + true + Qt4ProjectManager.MakeStep + + false + LINK=csg++ AR=csar CXX=csg++ CC=csgcc -j4 + + false + + + true + + %{buildDir}/denali + %{buildDir} + ProjectExplorer.ProcessStep + + + true + -m denali.csmes -t UnitTests denali.csexe + cmcsexeimport + %{buildDir} + ProjectExplorer.ProcessStep + + + true + --csmes=denali.csmes --html=Coverage/index + cmreport + %{buildDir} + ProjectExplorer.ProcessStep + + + true + --csmes=denali.csmes --csv-excel=Coverage/coverage.csv + cmreport + %{buildDir} + ProjectExplorer.ProcessStep + + 6 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + 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 + + tst_acknow + Qt4ProjectManager.Qt4BuildConfiguration + 2 + 2 + 2 + + + true + 2 + /home/denali/Project/tmp/build/unittest/tst_models + /home/denali/Project/tmp/build/unittest/tst_models + + + true + QtProjectManager.QMakeBuildStep + CONFIG+=tst_models CONFIG+=CodeCoverage false - true - true true - Make - Qt4ProjectManager.MakeStep false @@ -668,47 +727,37 @@ %{buildDir}/denali %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep 6 Build - + Build ProjectExplorer.BuildSteps.Build true - Make - Qt4ProjectManager.MakeStep true @@ -718,38 +767,34 @@ 1 Clean - + Clean ProjectExplorer.BuildSteps.Clean 2 false 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_logging + tst_models Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 - - /home/denali/Project/tmp/build/unittest/tst_utilities + + true + 2 + /home/denali/Project/tmp/build/unittest/tst_initializations + /home/denali/Project/tmp/build/unittest/tst_initializations true - qmake - QtProjectManager.QMakeBuildStep - true - CONFIG+=tst_utilities CONFIG+=CodeCoverage + CONFIG+=tst_initializations CONFIG+=CodeCoverage false - true - true true - Make - Qt4ProjectManager.MakeStep false @@ -762,47 +807,37 @@ %{buildDir}/denali %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep 6 Build - + Build ProjectExplorer.BuildSteps.Build true - Make - Qt4ProjectManager.MakeStep true @@ -812,38 +847,34 @@ 1 Clean - + Clean ProjectExplorer.BuildSteps.Clean 2 false 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_utilities + tst_initializations Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 - - /home/denali/Project/tmp/build/unittest/tst_acknow + + true + 2 + /home/denali/Project/tmp/build/unittest/tst_views + /home/denali/Project/tmp/build/unittest/tst_views true - qmake - QtProjectManager.QMakeBuildStep - true - CONFIG+=tst_acknow CONFIG+=CodeCoverage + CONFIG+=tst_views CONFIG+=CodeCoverage false - true - true true - Make - Qt4ProjectManager.MakeStep false @@ -856,47 +887,37 @@ %{buildDir}/denali %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true -m denali.csmes -t UnitTests denali.csexe cmcsexeimport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --html=Coverage/index cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep true --csmes=denali.csmes --csv-excel=Coverage/coverage.csv cmreport %{buildDir} - Custom Process Step - ProjectExplorer.ProcessStep 6 Build - + Build ProjectExplorer.BuildSteps.Build true - Make - Qt4ProjectManager.MakeStep true @@ -906,31 +927,31 @@ 1 Clean - + Clean ProjectExplorer.BuildSteps.Clean 2 false 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 + tst_views Qt4ProjectManager.Qt4BuildConfiguration 2 - true + 2 + 2 - 7 + 12 0 Deploy - + Deploy ProjectExplorer.BuildSteps.Deploy 1 - Deploy Configuration - + + false ProjectExplorer.DefaultDeployConfiguration 1 @@ -942,6 +963,14 @@ 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + -F true 4096 @@ -987,19 +1016,309 @@ 2 - denali - Qt4ProjectManager.Qt4RunConfiguration:/home/denali/Project/application/denali.pro + /home/denali/Project/application/denali.pro - 3768 + false + false true true false - true - false + false + true + /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 + + true + 2 + /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Debug + /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Debug + + + true + QtProjectManager.QMakeBuildStep + + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + 2 + 2 + + + true + 2 + /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Release + /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Release + + + true + QtProjectManager.QMakeBuildStep + + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 2 + 2 + + + true + 2 + /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Profile + /home/denali/Project/tmp/build/denali-Qt_5_12_5_iMX8-Profile + + + true + QtProjectManager.QMakeBuildStep + + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 2 + 2 + + 3 + + + + true + RemoteLinux.CheckForFreeDiskSpaceStep + + + + + / + 5242880 + + + + + true + RemoteLinux.KillAppStep + + + + + + + + + true + RemoteLinux.RsyncDeployStep + + + + + + + -av + false + + 3 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + DeployToGenericLinux + + 1 + + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 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 + /home/denali/Project/application/denali.pro + 1 + + false + + false + + false + true + false + false + true + false + + :0 1 Index: main.cpp =================================================================== diff -u -reea63d68fc0fb269f8dec64d99f488bcad117220 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- main.cpp (.../main.cpp) (revision eea63d68fc0fb269f8dec64d99f488bcad117220) +++ main.cpp (.../main.cpp) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -202,13 +202,21 @@ app.thread()->setObjectName("Main Thread"); //! - Setting the application version regarding the Bamboo build number. + QString ver_major = QString("%1").arg(VER_MAJOR); + if (ver_major.isEmpty()) { + ver_major = VER_MAJOR_DEV; + } + QString ver_minor = QString("%1").arg(VER_MINOR); + if (ver_minor.isEmpty()) { + ver_minor = VER_MINOR_DEV; + } QString ver_revis = QString("%1").arg(VER_REVIS); if (ver_revis.isEmpty()) { - ver_revis = VER_DEVEL; + ver_revis = VER_REVIS_DEV; } QCoreApplication::setApplicationVersion(QString("%1.%2.%3") - .arg(VER_MAJOR) - .arg(VER_MINOR) + .arg(ver_major) + .arg(ver_minor) .arg(ver_revis)); //! - Parse the command line arguments @@ -265,21 +273,11 @@ _MainTimer.init(); //! - Initialize the Qml Viewer and starts GUI - startGui(); + int app_exec = -1; + if ( startGui() ) { + app_exec = app.exec(); + } - - qDebug() << "\n _Logger :" << _Logger .thread()->objectName() - << "\n _USBWatcher :" << _USBWatcher .thread()->objectName() - << "\n _CanInterface :" << _CanInterface .thread()->objectName() - << "\n _FrameInterface :" << _FrameInterface .thread()->objectName() - << "\n _MessageAcknowModel :" << _MessageAcknowModel .thread()->objectName() - << "\n _MessageDispatcher :" << _MessageDispatcher .thread()->objectName() - << "\n _ApplicationController :" << _ApplicationController .thread()->objectName() - << "\n _GuiController :" << _GuiController .thread()->objectName() - ; - - 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). // So it needs to be done here in main thread. Index: sources/applicationcontroller.h =================================================================== diff -u -r8f6f7c11390e3ed6d918f1717d8e8b7ae5b7e5c6 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/applicationcontroller.h (.../applicationcontroller.h) (revision 8f6f7c11390e3ed6d918f1717d8e8b7ae5b7e5c6) +++ sources/applicationcontroller.h (.../applicationcontroller.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -25,6 +25,9 @@ // define #define _ApplicationController ApplicationController::I() +// forward diclations +class tst_initializations; + // namespace using namespace Gui; @@ -33,6 +36,9 @@ { Q_OBJECT + // friends + friend class ::tst_initializations; + ApplicationPost *_applicationPost = nullptr; QThread *_thread = nullptr; Index: sources/canbus/caninterface.cpp =================================================================== diff -u -r93d7ff58cd6fd2fea5d00587ee712a637fc941bf -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision 93d7ff58cd6fd2fea5d00587ee712a637fc941bf) +++ sources/canbus/caninterface.cpp (.../caninterface.cpp) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -46,7 +46,9 @@ if ( _init ) return false; _init = true; + // coco begin validated: Manually tested since required to disable and enable the canbus if ( ! initDevice() ) return false; + // coco end if ( ! testDevice() ) return false; initConnections(); @@ -68,7 +70,9 @@ */ bool CanInterface::init(QThread &vThread) { + // coco begin validated: Manually tested since required to disable and enable the canbus if ( ! init() ) return false; + // coco end initThread(vThread); return true; } @@ -103,7 +107,9 @@ */ void CanInterface::initConnections() { + // coco begin validated: Manually tested since required to disable and enable the canbus if (_canDevice) { + // coco end connect(_canDevice, SIGNAL( framesReceived()), this , SLOT (onFrameReceive ())); @@ -161,11 +167,13 @@ { QString mError; _canDevice = QCanBus::instance()->createDevice(_canType, _canInterface, &mError); + // coco begin validated: Manually tested since required to disable and enable the canbus if (!_canDevice) { status(tr("Device Creation"), mError); LOG_ERROR(status()); return false; } + // coco end return true; } @@ -192,8 +200,9 @@ */ void CanInterface::quitDevice() { - if (!_canDevice) - return; + // coco begin validated: Manually tested since required to disable and enable the canbus + if (!_canDevice) return; + // coco end _canDevice->disconnectDevice(); delete _canDevice; _canDevice = nullptr; @@ -231,8 +240,9 @@ */ bool CanInterface::transmit(const QCanBusFrame &vFrame) { - if( !_canDevice ) - return false; + // coco begin validated: Manually tested since required to disable and enable the canbus + if( !_canDevice ) return false; + //coco end return _canDevice->writeFrame(vFrame); } @@ -293,8 +303,11 @@ */ FrameCount CanInterface::erCount() { + // coco begin validated: CANBus error handling has been tested manually. + // since it requires massive can messages sent/received to catch the error Types::safeIncrement(_erFrameCount); return _erFrameCount; + // coco end } /*! @@ -305,6 +318,8 @@ */ QString CanInterface::frameFlags(const QCanBusFrame &vFrame) { + // coco begin validated: CANBus error handling has been tested manually. + // since it requires massive can messages sent/received to catch the error QString result = QLatin1String(" --- "); if (vFrame.hasBitrateSwitch()) @@ -315,6 +330,7 @@ result[3] = QLatin1Char('L'); return result; + // coco end } /*! @@ -324,6 +340,8 @@ */ void CanInterface::onFrameError(QCanBusDevice::CanBusError vError) { + // coco begin validated: CANBus error handling has been tested manually. + // since it requires massive can messages sent/received to catch the error erCount(); switch (vError) { case QCanBusDevice::ReadError: @@ -341,6 +359,7 @@ } emit didFrameError(_canStatus); } +// coco end /*! * \brief CanInterface::onFrameWritten @@ -363,8 +382,9 @@ */ void CanInterface::onFrameReceive () { - if (!_canDevice) - return; + // coco begin validated: Manually tested since required to disable and enable the canbus + if (!_canDevice) return; + // coco end while (_canDevice->framesAvailable()) { const QCanBusFrame frame = _canDevice->readFrame(); rxCount(); Index: sources/canbus/frameinterface.cpp =================================================================== diff -u -r93d7ff58cd6fd2fea5d00587ee712a637fc941bf -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision 93d7ff58cd6fd2fea5d00587ee712a637fc941bf) +++ sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -171,32 +171,38 @@ FrameInterface::ChannelGroup channelGroup = ChannelGroup::eChannel_Unknown; switch (vFrameId) { case eChlid_HD_DG : + // coco begin validated: The HD/DG communication has not been defined and implemented yet. case eChlid_DG_HD : + // coco end channelGroup = ChannelGroup::eChannel_Ignores; break; case eChlid_HD_UI : case eChlid_HD_Alarm : - case eChlid_DG_Alarm : case eChlid_HD_Sync : + // coco begin validated: The UI/DG communication has not been defined and implemented yet. + case eChlid_DG_Alarm : case eChlid_DG_Sync : + // coco end //case eChlid_DG_UI : // has duplicate value as eChlid_DG_Alarm channelGroup = ChannelGroup::eChannel_Listens; break; + // coco begin validated: The UI Alarm and Sync messages has not been defined and implemented yet. case eChlid_UI_Alarm : case eChlid_UI_Sync : //case eChlid_UI_DG : channelGroup = ChannelGroup::eChannel_Outputs; break; - + // coco end default: ok = false; break; } - + // coco begin validated: manually tested if (vOK) *vOK = ok; + // coco end return channelGroup; } @@ -318,9 +324,11 @@ void FrameInterface::appendHead(Can_Id vCan_Id, const QByteArray &vData) { Frame frame = Frame(vCan_Id, vData); + // coco begin validated: has been manually tested by sending over 4000 frames and not received by anyother node. if (_txFrameList.count() >= _txFrameList_Max) { LOG_ERROR(tr("Transmit buffer overflow of %1").arg(_txFrameList_Max)); return; + // coco end } _txFrameList.append(frame); } Index: sources/canbus/frameinterface.h =================================================================== diff -u -rbb8f39a014644c70b832dd2a784f62fa9f6b6106 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/canbus/frameinterface.h (.../frameinterface.h) (revision bb8f39a014644c70b832dd2a784f62fa9f6b6106) +++ sources/canbus/frameinterface.h (.../frameinterface.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -27,6 +27,7 @@ // forward declarations class tst_canbus; class tst_acknow; +class tst_initializations; // namespace namespace Can { @@ -45,6 +46,7 @@ // friends friend class ::tst_canbus; friend class ::tst_acknow; + friend class ::tst_initializations; /*! * \brief The ChannelGroup enum Index: sources/canbus/messagebuilder.cpp =================================================================== diff -u -rd3edfbd78f021082f37c7ee79a5a31a57b2808d4 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/canbus/messagebuilder.cpp (.../messagebuilder.cpp) (revision d3edfbd78f021082f37c7ee79a5a31a57b2808d4) +++ sources/canbus/messagebuilder.cpp (.../messagebuilder.cpp) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -425,6 +425,7 @@ return; } QByteArray view; + // coco begin validated: printPayload and specially vUseColor is for debugging purposes and has been validated manually. if (vUseColor) { QList byteList; byteList = vPayload.toHex('.').split('.'); @@ -449,6 +450,7 @@ view = Format::toHexString(vCan_Id, false, eLenChannelDigits).toLatin1() + " " + vPayload.toHex('.'); fprintf(stderr, "%s\n", view.constData()); } + // coco end } /*! Index: sources/canbus/messagebuilder.h =================================================================== diff -u -r0e87420e50dd94c37eb25f289ef3262e0e45d7f4 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/canbus/messagebuilder.h (.../messagebuilder.h) (revision 0e87420e50dd94c37eb25f289ef3262e0e45d7f4) +++ sources/canbus/messagebuilder.h (.../messagebuilder.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -21,6 +21,9 @@ #include "guiglobals.h" #include "messageglobals.h" +// forward declaration +class tst_messaging; + namespace Can { /*! @@ -49,6 +52,8 @@ { Q_OBJECT + friend class ::tst_messaging; + bool _enableConsoleOut = false; void addSyncByte ( QByteArray &vPayload); Index: sources/canbus/messagedispatcher.cpp =================================================================== diff -u -r93d7ff58cd6fd2fea5d00587ee712a637fc941bf -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision 93d7ff58cd6fd2fea5d00587ee712a637fc941bf) +++ sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -345,13 +345,15 @@ */ Sequence MessageDispatcher::rxCount() { + // coco begin validated: has been manually validated since it requires so many received messages to reset the seq if ( _rxSequence < SEQUENCE_MAX ) { ++_rxSequence; } else { _rxSequence = 1; } return _rxSequence; } +// coco end /*! * \brief MessageDispatcher::txCount @@ -360,13 +362,15 @@ */ Sequence MessageDispatcher::txCount() { + // coco begin validated: has been manually validated since it requires so many received messages to reset the seq if ( _txSequence < SEQUENCE_MAX ) { ++_txSequence; } else { _txSequence = 1; } return _txSequence; } +// coco end /*! * \brief MessageDispatcher::needsAcknow Index: sources/canbus/messageglobals.h =================================================================== diff -u -r8f6f7c11390e3ed6d918f1717d8e8b7ae5b7e5c6 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/canbus/messageglobals.h (.../messageglobals.h) (revision 8f6f7c11390e3ed6d918f1717d8e8b7ae5b7e5c6) +++ sources/canbus/messageglobals.h (.../messageglobals.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -53,6 +53,9 @@ {Gui::GuiActionType::PressureOcclusion , 5 * 4 }, // 5 parameters each 4bytes // ---- + {Gui::GuiActionType::AlarmStatus , 4 * 4 + 2 }, // 4 parameters each 4bytes + 1 parameter 2bytes + + // ---- {Gui::GuiActionType::AdjustBloodDialysateReq , 2 * 4 }, // 2 parameters each 4bytes {Gui::GuiActionType::AdjustBloodDialysateRsp , 4 * 4 }, // 4 parameters each 4bytes Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -reea63d68fc0fb269f8dec64d99f488bcad117220 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision eea63d68fc0fb269f8dec64d99f488bcad117220) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -272,11 +272,12 @@ */ bool MessageInterpreter::interpretMessage_DG(const Message &vMessage, QVariantList &vData) { + // coco begin validated: No data have been interpreted from DG yet Q_UNUSED(vMessage ); Q_UNUSED(vData ); - // No data have been interpreted from DG yet return false; } +// coco end /*! * \brief MessageInterpreter::getPowerOffData Index: sources/canbus/messageinterpreter.h =================================================================== diff -u -r8f6f7c11390e3ed6d918f1717d8e8b7ae5b7e5c6 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision 8f6f7c11390e3ed6d918f1717d8e8b7ae5b7e5c6) +++ sources/canbus/messageinterpreter.h (.../messageinterpreter.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -20,6 +20,10 @@ #include "messageglobals.h" #include "mmodel.h" +// forward declaration +class tst_messaging; +class tst_logging; + namespace Can { /*! @@ -33,6 +37,10 @@ { Q_OBJECT + // friend + friend class ::tst_messaging; + friend class ::tst_logging; + bool isType(const Message &vMessage, Gui::GuiActionType vType) const; bool isPayloadLenValid(const Message &vMessage, Gui::GuiActionType vType) const; Index: sources/gui/guiglobals.cpp =================================================================== diff -u -rf148379112a69d1c52027f2667e95f3f96d948ad -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision f148379112a69d1c52027f2667e95f3f96d948ad) +++ sources/gui/guiglobals.cpp (.../guiglobals.cpp) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -62,12 +62,15 @@ * \brief startGui * \details the GUI initializer/starter function */ - void startGui() { + bool startGui() { _viewer = new QQuickView; registerTypes(); registerQmlTypes(); QObject::connect(_viewer, &QQuickView::statusChanged, qApp, [=](QQuickView::Status vStatus) { + // coco begin validated: this portion of the code is handling application initialization + // and if not initialized correctly will terminate the applicaiton . + // So it had been manually tested. bool ok = vStatus == QQuickView::Ready; if (ok) { _viewer->show(); @@ -78,8 +81,10 @@ } QCoreApplication::exit(-1); } + // coco end + }, Qt::QueuedConnection ); - }); _viewer->setSource(QStringLiteral("qrc:/main.qml")); + return true; } } Index: sources/gui/guiglobals.h =================================================================== diff -u -r8f6f7c11390e3ed6d918f1717d8e8b7ae5b7e5c6 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/gui/guiglobals.h (.../guiglobals.h) (revision 8f6f7c11390e3ed6d918f1717d8e8b7ae5b7e5c6) +++ sources/gui/guiglobals.h (.../guiglobals.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -163,5 +163,5 @@ void registerTypes(); void registerQmlTypes(); - void startGui(); + bool startGui(); } Index: sources/model/mtreatmentadjustblooddialysateresponse.cpp =================================================================== diff -u -rf148379112a69d1c52027f2667e95f3f96d948ad -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/model/mtreatmentadjustblooddialysateresponse.cpp (.../mtreatmentadjustblooddialysateresponse.cpp) (revision f148379112a69d1c52027f2667e95f3f96d948ad) +++ sources/model/mtreatmentadjustblooddialysateresponse.cpp (.../mtreatmentadjustblooddialysateresponse.cpp) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -30,17 +30,17 @@ vData += _data.mDialydateReate .value; } -bool MAdjustBloodDialysateResponse::fromByteArray(const QByteArray &vByteArray) { +bool MAdjustBloodDialysateResponse::fromByteArray(const QByteArray &vByteArray, int *vIndex) { int index = 0; // message data start position - if (Types::getValue<>(vByteArray, index, _data.mAccepted )) - if (Types::getValue<>(vByteArray, index, _data.mReason )) - if (Types::getValue<>(vByteArray, index, _data.mBloodRate )) - if (Types::getValue<>(vByteArray, index, _data.mDialydateReate )) + if (GetValue(vByteArray, index, _data.mAccepted )) + if (GetValue(vByteArray, index, _data.mReason )) + if (GetValue(vByteArray, index, _data.mBloodRate )) + if (GetValue(vByteArray, index, _data.mDialydateReate )) return true ; - else return false; - else return false; - else return false; - else return false; + else { if(vIndex) *vIndex = index; return false; } + else { if(vIndex) *vIndex = index; return false; } + else { if(vIndex) *vIndex = index; return false; } + else { if(vIndex) *vIndex = index; return false; } } AdjustBloodDialysateResponseData MAdjustBloodDialysateResponse::data() const { Index: sources/model/mtreatmentadjustblooddialysateresponse.h =================================================================== diff -u -r31b9ae63410e7ca23f0f849e38368880e4c402b4 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/model/mtreatmentadjustblooddialysateresponse.h (.../mtreatmentadjustblooddialysateresponse.h) (revision 31b9ae63410e7ca23f0f849e38368880e4c402b4) +++ sources/model/mtreatmentadjustblooddialysateresponse.h (.../mtreatmentadjustblooddialysateresponse.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -19,9 +19,16 @@ // Project #include "types.h" +// forward declarations +class tst_models; + namespace Model { class MAdjustBloodDialysateResponse { + + // friends + friend class ::tst_models; + public: QString stringPrefix = "Adjust Blood/Dialisate"; struct Data { @@ -44,7 +51,7 @@ QString toString ( ) const ; void toVariantList ( QVariantList &vData ) const ; - bool fromByteArray (const QByteArray &vByteArray ); + bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr); Data data() const; }; Index: sources/model/mtreatmentranges.cpp =================================================================== diff -u -r8f6f7c11390e3ed6d918f1717d8e8b7ae5b7e5c6 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/model/mtreatmentranges.cpp (.../mtreatmentranges.cpp) (revision 8f6f7c11390e3ed6d918f1717d8e8b7ae5b7e5c6) +++ sources/model/mtreatmentranges.cpp (.../mtreatmentranges.cpp) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -34,22 +34,21 @@ vData += _data.mDialysate_Flow_Max .value; } -bool MTreatmentRanges::fromByteArray(const QByteArray &vByteArray) { +bool MTreatmentRanges::fromByteArray(const QByteArray &vByteArray, int *vIndex) { int index = 0; // message data start position - if (Types::getValue<>(vByteArray, index, _data.mDuration_Min )) - if (Types::getValue<>(vByteArray, index, _data.mDuration_Max )) - if (Types::getValue<>(vByteArray, index, _data.mUltrafiltration_Volume_Min )) - if (Types::getValue<>(vByteArray, index, _data.mUltrafiltration_Volume_Max )) - if (Types::getValue<>(vByteArray, index, _data.mDialysate_Flow_Min )) - if (Types::getValue<>(vByteArray, index, _data.mDialysate_Flow_Max )) + if (GetValue(vByteArray, index, _data.mDuration_Min )) + if (GetValue(vByteArray, index, _data.mDuration_Max )) + if (GetValue(vByteArray, index, _data.mUltrafiltration_Volume_Min )) + if (GetValue(vByteArray, index, _data.mUltrafiltration_Volume_Max )) + if (GetValue(vByteArray, index, _data.mDialysate_Flow_Min )) + if (GetValue(vByteArray, index, _data.mDialysate_Flow_Max )) return true ; - else return false; - else return false; - else return false; - else return false; - else return false; - else return false; - + else { if(vIndex) *vIndex = index; return false; } + else { if(vIndex) *vIndex = index; return false; } + else { if(vIndex) *vIndex = index; return false; } + else { if(vIndex) *vIndex = index; return false; } + else { if(vIndex) *vIndex = index; return false; } + else { if(vIndex) *vIndex = index; return false; } } MTreatmentRanges::Data MTreatmentRanges::data() const { Index: sources/model/mtreatmentranges.h =================================================================== diff -u -r31b9ae63410e7ca23f0f849e38368880e4c402b4 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/model/mtreatmentranges.h (.../mtreatmentranges.h) (revision 31b9ae63410e7ca23f0f849e38368880e4c402b4) +++ sources/model/mtreatmentranges.h (.../mtreatmentranges.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -19,9 +19,17 @@ // Project #include "types.h" +// forward declarations +class tst_models; + + namespace Model { class MTreatmentRanges { + + // friends + friend class ::tst_models; + public: QString stringPrefix = "Treatment Ranges"; struct Data { @@ -48,7 +56,7 @@ QString toString ( ) const ; void toVariantList ( QVariantList &vData ) const ; - bool fromByteArray (const QByteArray &vByteArray ); + bool fromByteArray (const QByteArray &vByteArray , int *vIndex = nullptr); Data data() const; }; Index: sources/storage/usbwatcher.cpp =================================================================== diff -u -r93d7ff58cd6fd2fea5d00587ee712a637fc941bf -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/storage/usbwatcher.cpp (.../usbwatcher.cpp) (revision 93d7ff58cd6fd2fea5d00587ee712a637fc941bf) +++ sources/storage/usbwatcher.cpp (.../usbwatcher.cpp) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -138,6 +138,7 @@ */ bool USBWatcher::usbSeek(QString &vDevice) { + // coco begin validated: Needed User Interaction so tested manually QString device = ""; for (char a = 'a'; a <= 'z'; a++) { device = QString("/dev/sd%1%2").arg(a).arg('1'); @@ -148,6 +149,7 @@ } vDevice = device; return false; + // coco end } /*! @@ -169,6 +171,7 @@ */ void USBWatcher::usbcheck() { + // coco begin validated: Needed User Interaction so tested manually QString device = ""; if (usbSeek(device)) { if (! _umounted ) { @@ -181,6 +184,7 @@ usbRemove(); } } + // coco end } /*! Index: sources/storage/usbwatcher.h =================================================================== diff -u -r939d1bae9a394697d46ca913a2dc3442bf8ef82f -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/storage/usbwatcher.h (.../usbwatcher.h) (revision 939d1bae9a394697d46ca913a2dc3442bf8ef82f) +++ sources/storage/usbwatcher.h (.../usbwatcher.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -23,6 +23,9 @@ // Define #define _USBWatcher Storage::USBWatcher::I() +// forward diclations +class tst_initializations; + namespace Storage { /*! @@ -35,6 +38,9 @@ { Q_OBJECT + // friends + friend class ::tst_initializations; + bool _mounted = false; bool _umounted = false; bool _removed = false; Index: sources/utility/types.cpp =================================================================== diff -u -rfeb3423b373dc2a2c4267ef9fcb4d924d738423d -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/utility/types.cpp (.../types.cpp) (revision feb3423b373dc2a2c4267ef9fcb4d924d738423d) +++ sources/utility/types.cpp (.../types.cpp) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -24,9 +24,9 @@ return qAbs(f1 - f2) <= epsilon * qMax(qAbs(f1), qAbs(f2)); } -bool Types::getBits(const QByteArray &vData, int &vIndex, QBitArray &vFlags, int vLen) { +bool Types::getBits(const QByteArray &vData, int &vStartIndex, QBitArray &vFlags, int vLen) { vFlags.clear(); - QByteArray data = vData.mid(vIndex, vLen); + QByteArray data = vData.mid(vStartIndex, vLen); if (data.length() * 8 < vLen ) return false; vFlags = QBitArray::fromBits(data, vLen); Index: sources/utility/types.h =================================================================== diff -u -rae97f70129df818530bcb70c934c42fa28eb6034 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/utility/types.h (.../types.h) (revision ae97f70129df818530bcb70c934c42fa28eb6034) +++ sources/utility/types.h (.../types.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -25,6 +25,9 @@ #include "format.h" #include "logger.h" +// defines +#define GetValue(vData, vIndex, vValue) Types::getValue<>(vData, vIndex, vValue, QT_STRINGIFY(vValue)) + class Types { public: @@ -105,8 +108,8 @@ static bool floatCompare(float f1, float f2); template < typename T > - static bool getValue(const QByteArray &vData, int &vIndex, T &vValue); - static bool getBits (const QByteArray &vData, int &vIndex, QBitArray &vFlags, int vLen); + static bool getValue(const QByteArray &vData, int &vStartIndex, T &vValue, QString vValueName = ""); + static bool getBits (const QByteArray &vData, int &vStartIndex, QBitArray &vFlags, int vLen); template < typename T > static bool setValue(const T &vValue, QByteArray &vData); @@ -126,23 +129,25 @@ } }; + template < typename T > -bool Types::getValue(const QByteArray &vData, int &vIndex, T &vValue) { - int end = vIndex + sizeof(T); +bool Types::getValue(const QByteArray &vData, int &vStartIndex, T &vValue, QString vValueName) { + int end = vStartIndex + sizeof(T); if (vData.length() < end) { - LOG_ERROR(QString("Not enough data from position %1 to the length of %2 to get data of type '%3' in buffer %4") - .arg(vIndex) + LOG_ERROR(QString("Not enough data from position %1 to the length of %2 to get data of type '%3' in buffer %4%5") + .arg(vStartIndex) .arg(sizeof(T)) .arg(typeid(T).name()) .arg(Format::toHexString(vData)) + .arg(vValueName.isEmpty() ? "" : QString("for value %1").arg(vValueName)) ); return false; } int i = 0; - while (vIndex < end) { - vValue.bytes[i] = vData[vIndex]; + while (vStartIndex < end) { + vValue.bytes[i] = vData[vStartIndex]; i++; - vIndex++; + vStartIndex++; } return true; } Index: sources/view/vtreatmentadjustmentsresponse.h =================================================================== diff -u -r11909fd034451197eeb590176e4a8c52657cdab8 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- sources/view/vtreatmentadjustmentsresponse.h (.../vtreatmentadjustmentsresponse.h) (revision 11909fd034451197eeb590176e4a8c52657cdab8) +++ sources/view/vtreatmentadjustmentsresponse.h (.../vtreatmentadjustmentsresponse.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -21,14 +21,21 @@ #include "vview.h" #include "guiglobals.h" +// forward diclations +class tst_views; + // namespace using namespace Gui; namespace View { class VTreatmentAdjustmentsResponse : public QObject { + Q_OBJECT + // friends + friend class ::tst_views; + PROPERTY( bool , adjustment_Accepted , 0, false) // coco begin validated: The Reason property as quint32 is not used directly in GUI // it will be used as QString text. Index: unittests/tst_canbus.cpp =================================================================== diff -u -r805119c460b4a266d6401c8705f4427e7fbe270f -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- unittests/tst_canbus.cpp (.../tst_canbus.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) +++ unittests/tst_canbus.cpp (.../tst_canbus.cpp) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -130,6 +130,14 @@ QVERIFY(_emited); } +void tst_canbus::tst_FrameInterface_ActionTransmit_ShortPayload() +{ + _expected = "A5.06.00.01.00.00.00.00"; + QVariantList mData {}; + _MessageDispatcher.onActionTransmit(Gui::GuiActionType::PowerOff, mData); + QVERIFY(! _emited); // not emitted due to short payload len +} + void tst_canbus::tst_FrameInterface_ActionTransmit_Unknown() { _expected = ""; Index: unittests/tst_canbus.h =================================================================== diff -u -r805119c460b4a266d6401c8705f4427e7fbe270f -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- unittests/tst_canbus.h (.../tst_canbus.h) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) +++ unittests/tst_canbus.h (.../tst_canbus.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -54,7 +54,9 @@ void tst_FrameInterface_ActionTransmit_PowerOff_Rejected(); void tst_FrameInterface_ActionTransmit_PowerOff(); void tst_FrameInterface_ActionTransmit_Raw(); + void tst_FrameInterface_ActionTransmit_ShortPayload(); void tst_FrameInterface_ActionTransmit_Unknown (); + void tst_FrameInterface_FrameReceived_PowerOff(); void tst_FrameInterface_FrameReceived_PowerOff_Timeout(); void tst_FrameInterface_FrameReceived_Channel_NotListen(); Index: unittests/tst_initializations.cpp =================================================================== diff -u --- unittests/tst_initializations.cpp (revision 0) +++ unittests/tst_initializations.cpp (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -0,0 +1,42 @@ +/*! + * + * 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_initializations.cpp + * date 4/17/2020 + * author Behrouz NematiPour + * + */ +#include "tst_initializations.h" + +// Qt + +// Project +#include "applicationcontroller.h" +#include "guicontroller.h" +#include "usbwatcher.h" +#include "caninterface.h" +#include "frameinterface.h" +#include "messagedispatcher.h" +#include "messageacknowmodel.h" + +tst_initializations::tst_initializations(QObject *parent) : QObject(parent) { } + +void tst_initializations::tst_ApplicationController_init() +{ + QCOMPARE( _ApplicationController.init(), ! _ApplicationController.init()); +} + +void tst_initializations::tst_USBWatcher_init() +{ + QCOMPARE( _USBWatcher.init(), ! _USBWatcher.init()); +} + +void tst_initializations::tst_FrameInterface_init() +{ + QCOMPARE( _FrameInterface.init(), ! _FrameInterface.init()); +} Index: unittests/tst_initializations.h =================================================================== diff -u --- unittests/tst_initializations.h (revision 0) +++ unittests/tst_initializations.h (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -0,0 +1,35 @@ +/*! + * + * 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_initializations.h + * date 4/17/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include +#include + +// Project + + +class tst_initializations : public QObject +{ + Q_OBJECT + +public: + explicit tst_initializations(QObject *parent = nullptr); + +private slots: + void tst_ApplicationController_init(); + void tst_USBWatcher_init(); + void tst_FrameInterface_init(); +}; + Index: unittests/tst_logging.cpp =================================================================== diff -u -rae97f70129df818530bcb70c934c42fa28eb6034 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- unittests/tst_logging.cpp (.../tst_logging.cpp) (revision ae97f70129df818530bcb70c934c42fa28eb6034) +++ unittests/tst_logging.cpp (.../tst_logging.cpp) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -19,6 +19,7 @@ // Project #include "filehandler.h" #include "logger.h" +#include "messageinterpreter.h" using namespace Storage; @@ -34,8 +35,7 @@ { Threads::registerTypes(); _Logger._timeFormat = ""; - _Logger.init(); - _Logger.init(); + QCOMPARE( _Logger.init(), ! _Logger.init() ); QString mContent; FileHandler::read(_Logger._logFileName, mContent); QCOMPARE(mContent, "Event: , Storage::Logger Initialized\n"); @@ -46,23 +46,27 @@ QThread::currentThread()->msleep(1000); } +void tst_logging::init() +{ + QString mContent; + FileHandler::write(_Logger._logFileName, mContent, false); + QCOMPARE(mContent, ""); +} + void tst_logging::logEvent() { LOG_EVENT("1 - Event log has been created"); QString mContent; FileHandler::read(_Logger._logFileName, mContent); - QCOMPARE(mContent, "Event: , Storage::Logger Initialized\n" - "Event: , 1 - Event log has been created\n"); + QCOMPARE(mContent, "Event: , 1 - Event log has been created\n"); } void tst_logging::logDatum() { LOG_DATUM("3 - Datum log has been created"); QString mContent; FileHandler::read(_Logger._logFileName, mContent); - QCOMPARE(mContent, "Event: , Storage::Logger Initialized\n" - "Event: , 1 - Event log has been created\n" - "Datum: , 3 - Datum log has been created\n"); + QCOMPARE(mContent, "Datum: , 3 - Datum log has been created\n"); } void tst_logging::logError() @@ -78,11 +82,38 @@ emit Storage::Logger::I().didLog("4 - Datum log has been created", Storage::Logger::LogType::eLogType_Count); QString mContent; FileHandler::read(_Logger._logFileName, mContent); - QCOMPARE(mContent, "Error: , 2 - Error log has been created\n" - "Error: , Incorrect type of logging\n" + QCOMPARE(mContent, "Error: , Incorrect type of logging\n" "Error: , 4 - Datum log has been created\n"); } +void tst_logging::logError_gDisableHunhandledReport_False() +{ + gDisableHunhandledReport = false; + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::AlarmTriggered; + msg.data = {}; + iMsg.printUnhandled(msg); + QString mContent; + FileHandler::read(_Logger._logFileName, mContent); + QStringList lines = mContent.split("\n"); + QVERIFY(lines.count()); + QCOMPARE(lines.first(), "Error: , Unhandled Message ID (HD)"); +} + +void tst_logging::logError_gDisableHunhandledReport_True() +{ + gDisableHunhandledReport = true; + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::AlarmTriggered; + msg.data = {}; + iMsg.printUnhandled(msg); + QString mContent; + FileHandler::read(_Logger._logFileName, mContent); + QCOMPARE(mContent, ""); +} + void tst_logging::setLogPath_F() { _Logger._dir = "/"; @@ -96,3 +127,9 @@ bool b = _Logger.setLogPath(); QCOMPARE(b , true); } + +void tst_logging::readUnknown() +{ + QString mContent; + QVERIFY(! FileHandler::read("TheFileWhichDoesntExist.UnknownExtension", mContent)); +} Index: unittests/tst_logging.h =================================================================== diff -u -rae97f70129df818530bcb70c934c42fa28eb6034 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- unittests/tst_logging.h (.../tst_logging.h) (revision ae97f70129df818530bcb70c934c42fa28eb6034) +++ unittests/tst_logging.h (.../tst_logging.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -37,12 +37,19 @@ // will be called after every test function. void cleanup(); + void init(); + void logEvent(); void logError(); void logDatum(); void logUnknown(); + void logError_gDisableHunhandledReport_False(); + void logError_gDisableHunhandledReport_True(); + void setLogPath_F(); void setLogPath_T(); + + void readUnknown(); }; Index: unittests/tst_messaging.cpp =================================================================== diff -u --- unittests/tst_messaging.cpp (revision 0) +++ unittests/tst_messaging.cpp (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -0,0 +1,411 @@ +/*! + * + * 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_messaging.cpp + * date 4/20/2020 + * author Behrouz NematiPour + * + */ +#include "tst_messaging.h" + +// Qt + +// Project +#include "main.h" +#include "messageinterpreter.h" +#include "messagebuilder.h" +#include "mpoweroff.h" + +tst_messaging::tst_messaging(QObject *parent) : QObject(parent) { } + +void tst_messaging::tst_MessageInterpreter_isType() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::AdjustBloodDialysateReq; + msg.data = {}; + QVERIFY( iMsg.isType(msg, Gui::GuiActionType::AdjustBloodDialysateReq)); + QVERIFY(! iMsg.isType(msg, Gui::GuiActionType::BloodFlow)); +} + +void tst_messaging::tst_MessageInterpreter_isPayloadLenValid() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::AdjustBloodDialysateReq; + msg.data = {}; + QVERIFY( ! iMsg.isPayloadLenValid(msg, Gui::GuiActionType::AdjustBloodDialysateReq)); +} + +void tst_messaging::tst_MessageInterpreter_getPowerOffData_isType() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::Unknown; + msg.data = {}; + Model::MPowerOff data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getPowerOffData(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_getPowerOffData_payloadLen() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::PowerOff; + msg.data = {}; + Model::MPowerOff data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getPowerOffData(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_powerOffData() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::PowerOff; + msg.data = {}; + QVariantList data; + QVERIFY( ! iMsg.powerOffData(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_getBloodFlowData_isType() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::Unknown; + msg.data = {}; + Model::MBloodFlow data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getBloodFlowData(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_getBloodFlowData_payloadLen() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::BloodFlow; + msg.data = {}; + Model::MBloodFlow data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getBloodFlowData(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_bloodFlowData() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::BloodFlow; + msg.data = {}; + QVariantList data; + QVERIFY( ! iMsg.bloodFlowData(msg, data)); + QVERIFY( data.isEmpty()); +} + +void tst_messaging::tst_MessageInterpreter_getDialysateInletFlowData_isType() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::Unknown; + msg.data = {}; + Model::MDialysateFlow data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getDialysateInletFlowData(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_getDialysateInletFlowData_payloadLen() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::DialysateInletFlow; + msg.data = {}; + Model::MDialysateFlow data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getDialysateInletFlowData(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_dialysateInletFlowData() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::DialysateInletFlow; + msg.data = {}; + QVariantList data; + QVERIFY( ! iMsg.dialysateInletFlowData(msg, data)); + QVERIFY( data.isEmpty()); +} + +void tst_messaging::tst_MessageInterpreter_getDialysateOutletFlowData_isType() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::Unknown; + msg.data = {}; + Model::MOutletFlow data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getDialysateOutletFlowData(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_getDialysateOutletFlowData_payloadLen() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::DialysateOutletFlow; + msg.data = {}; + Model::MOutletFlow data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getDialysateOutletFlowData(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_dialysateOutletFlowData() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::DialysateOutletFlow; + msg.data = {}; + QVariantList data; + QVERIFY( ! iMsg.dialysateOutletFlowData(msg, data)); + QVERIFY( data.isEmpty()); +} + +void tst_messaging::tst_MessageInterpreter_getTreatmentTime_isType() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::Unknown; + msg.data = {}; + Model::MTreatmentTime data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getTreatmentTime(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_getTreatmentTime_payloadLen() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::TreatmentTime; + msg.data = {}; + Model::MTreatmentTime data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getTreatmentTime(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_treatmentTime() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::TreatmentTime; + msg.data = {}; + QVariantList data; + QVERIFY( ! iMsg.treatmentTime(msg, data)); + QVERIFY( data.isEmpty()); +} + +void tst_messaging::tst_MessageInterpreter_getAlarmStatus_isType() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::Unknown; + msg.data = {}; + Model::MAlarmStatus data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getAlarmStatus(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_getAlarmStatus_payloadLen() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::AlarmStatus; + msg.data = {}; + Model::MAlarmStatus data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getAlarmStatus(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_alarmStatus() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::AlarmStatus; + msg.data = {}; + QVariantList data; + QVERIFY( ! iMsg.alarmStatus(msg, data)); + QVERIFY( data.isEmpty()); +} + +void tst_messaging::tst_MessageInterpreter_getPressureOcclusionData_isType() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::Unknown; + msg.data = {}; + Model::MPressureOcclusion data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getPressureOcclusionData(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_getPressureOcclusionData_payloadLen() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::PressureOcclusion; + msg.data = {}; + Model::MPressureOcclusion data; + data.fromByteArray(msg.data); + QVERIFY( ! iMsg.getPressureOcclusionData(msg, data)); +} + +void tst_messaging::tst_MessageInterpreter_pressureOcclusionData() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::PressureOcclusion; + msg.data = {}; + QVariantList data; + QVERIFY( ! iMsg.pressureOcclusionData(msg, data)); + QVERIFY( data.isEmpty()); +} + +void tst_messaging::tst_MessageInterpreter_adjustBloodDialysateData_isType() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::Unknown; + msg.data = {}; + QVariantList list; + QVERIFY( ! iMsg.adjustBloodDialysateData(msg, list)); +} + +void tst_messaging::tst_MessageInterpreter_adjustBloodDialysateData_payloadLen() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::AdjustBloodDialysateRsp; + msg.data = {}; + QVariantList list; + QVERIFY( ! iMsg.adjustBloodDialysateData(msg, list)); +} + +void tst_messaging::tst_MessageInterpreter_treatmentRangesData_isType() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::Unknown; + msg.data = {}; + QVariantList list; + QVERIFY( ! iMsg.treatmentRangesData(msg, list)); +} + +void tst_messaging::tst_MessageInterpreter_treatmentRangesData_payloadLen() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = Gui::GuiActionType::TreatmentRanges; + msg.data = {}; + QVariantList list; + QVERIFY( ! iMsg.treatmentRangesData(msg, list)); +} + +void tst_messaging::tst_MessageInterpreter_interpretMessage_String() +{ + Can::MessageInterpreter iMsg; + QByteArray payload; + QVERIFY(iMsg.interpretMessage(Gui::GuiActionType::String, {}, payload)); + QVERIFY(payload.isEmpty()); +} + +void tst_messaging::tst_MessageInterpreter_interpretMessage_AdjustBloodDialysateReq() +{ + Can::MessageInterpreter iMsg; + QByteArray payload; + QVERIFY(iMsg.interpretMessage(Gui::GuiActionType::AdjustBloodDialysateReq, {}, payload)); + QVERIFY(payload.isEmpty()); +} + +void tst_messaging::tst_MessageBuilder_addActionId() +{ + Can::MessageBuilder bMsg; + QByteArray payload; + QVERIFY( ! bMsg.addActionId(payload, Gui::GuiActionType::Unknown)); + QVERIFY( payload.isEmpty()); +} + +void tst_messaging::tst_MessageBuilder_addData_shorterLen() +{ + Can::MessageBuilder bMsg; + QByteArray payload; + QVERIFY( ! bMsg.addData(payload, Gui::GuiActionType::PowerOff, {})); + QVERIFY( payload.isEmpty()); +} + +void tst_messaging::tst_MessageBuilder_addData_LongerThanMax() +{ + Can::MessageBuilder bMsg; + QByteArray payload; + QByteArray data; + for (int i = 0; i<= Can::eLenMaxData + 1; i++ ) { + data += i; + } + QVERIFY(bMsg.addData(payload, Gui::GuiActionType::String, data)); + QVERIFY( ! payload.isEmpty()); +} + +void tst_messaging::tst_MessageBuilder_checkCRC() +{ + Can::MessageBuilder bMsg; + QByteArray data; + quint8 vExpected, vActual; + QVERIFY( ! bMsg.checkCRC(data, vExpected, vActual)); +} + +void tst_messaging::tst_MessageBuilder_getHeader() +{ + Can::MessageBuilder bMsg; + QByteArray payload; + QVERIFY(bMsg.getHeader(payload).isEmpty()); +} + +void tst_messaging::tst_MessageBuilder_buildFrames_addActionId() +{ + Can::MessageBuilder bMsg; + QByteArray data; + Can::FrameList framelist; + Can::Sequence seq = 1; + QVERIFY( ! bMsg.buildFrames(Gui::GuiActionType::Unknown, data, framelist, seq)); +} + +void tst_messaging::tst_MessageBuilder_buildFrames_addData() +{ + Can::MessageBuilder bMsg; + QByteArray data; + Can::FrameList framelist; + Can::Sequence seq = 1; + QVERIFY( ! bMsg.buildFrames(Gui::GuiActionType::PowerOff, data, framelist, seq)); +} + +void tst_messaging::tst_MessageBuilder_buildFrames_eLenCanFrame() +{ + Can::MessageBuilder bMsg; + QByteArray data; + data += 0x01; + data += 0x02; + data += 0x03; + data += 0x04; + data += 0x05; + data += 0x06; + data += 0x07; + data += 0x08; + data += 0x09; + + qDebug() << data.length(); + Can::FrameList framelist; + Can::Sequence seq = 1; + QVERIFY( bMsg.buildFrames(Gui::GuiActionType::String, data, framelist, seq)); +} + Index: unittests/tst_messaging.h =================================================================== diff -u --- unittests/tst_messaging.h (revision 0) +++ unittests/tst_messaging.h (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -0,0 +1,79 @@ +/*! + * + * 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_messaging.h + * date 4/20/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include +#include + +class tst_messaging : public QObject +{ + Q_OBJECT + + +public: + explicit tst_messaging(QObject *parent = nullptr); + +private slots: + void tst_MessageInterpreter_isType(); + void tst_MessageInterpreter_isPayloadLenValid(); + + void tst_MessageInterpreter_getPowerOffData_isType(); + void tst_MessageInterpreter_getPowerOffData_payloadLen(); + void tst_MessageInterpreter_powerOffData(); + + void tst_MessageInterpreter_getBloodFlowData_isType(); + void tst_MessageInterpreter_getBloodFlowData_payloadLen(); + void tst_MessageInterpreter_bloodFlowData(); + + void tst_MessageInterpreter_getDialysateInletFlowData_isType(); + void tst_MessageInterpreter_getDialysateInletFlowData_payloadLen(); + void tst_MessageInterpreter_dialysateInletFlowData(); + + void tst_MessageInterpreter_getDialysateOutletFlowData_isType(); + void tst_MessageInterpreter_getDialysateOutletFlowData_payloadLen(); + void tst_MessageInterpreter_dialysateOutletFlowData(); + + void tst_MessageInterpreter_getTreatmentTime_isType(); + void tst_MessageInterpreter_getTreatmentTime_payloadLen(); + void tst_MessageInterpreter_treatmentTime(); + + void tst_MessageInterpreter_getAlarmStatus_isType(); + void tst_MessageInterpreter_getAlarmStatus_payloadLen(); + void tst_MessageInterpreter_alarmStatus(); + + void tst_MessageInterpreter_getPressureOcclusionData_isType(); + void tst_MessageInterpreter_getPressureOcclusionData_payloadLen(); + void tst_MessageInterpreter_pressureOcclusionData(); + + void tst_MessageInterpreter_adjustBloodDialysateData_isType(); + void tst_MessageInterpreter_adjustBloodDialysateData_payloadLen(); + + void tst_MessageInterpreter_treatmentRangesData_isType(); + void tst_MessageInterpreter_treatmentRangesData_payloadLen(); + + void tst_MessageInterpreter_interpretMessage_String(); + void tst_MessageInterpreter_interpretMessage_AdjustBloodDialysateReq(); + + void tst_MessageBuilder_addActionId(); + void tst_MessageBuilder_addData_shorterLen(); + void tst_MessageBuilder_addData_LongerThanMax(); + void tst_MessageBuilder_checkCRC(); + void tst_MessageBuilder_getHeader(); + void tst_MessageBuilder_buildFrames_addActionId(); + void tst_MessageBuilder_buildFrames_addData(); + void tst_MessageBuilder_buildFrames_eLenCanFrame(); +}; + + Index: unittests/tst_models.cpp =================================================================== diff -u --- unittests/tst_models.cpp (revision 0) +++ unittests/tst_models.cpp (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -0,0 +1,142 @@ +/*! + * + * 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_models.cpp + * date 04/16/2020 + * author Behrouz NematiPour + * + */ +#include "tst_models.h" + +// Qt + +// Project +#include "mtreatmentadjustblooddialysateresponse.h" +#include "mtreatmentranges.h" + +// #define CONSOLEOUT + +/*! + * \brief tst_models::tst_models + * \details Constructor + * \param parent - QObject parent owner object. + * Qt handles the children destruction by their parent objects life-cycle. + */ +tst_models::tst_models(QObject *parent) : QObject(parent) {} + +void tst_models::tst_MAdjustBloodDialysateResponse_data () +{ + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg compelete ")<< 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mBloodRate ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mBloodRate ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mBloodRate ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mBloodRate ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mDialydateReate")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mDialydateReate")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mDialydateReate")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mDialydateReate")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); +} + +void tst_models::tst_MAdjustBloodDialysateResponse () +{ + Model::MAdjustBloodDialysateResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + +#ifdef CONSOLEOUT + qDebug() << index << errorIndex << startIndex << ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mBloodRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mDialydateReate; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +void tst_models::tst_MTreatmentRanges_data() +{ + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg compelete ")<< 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17")); + QTest::newRow("mDuration_Min ")<< 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mDuration_Min ")<< 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mDuration_Min ")<< 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mDuration_Min ")<< 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mDuration_Max ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mDuration_Max ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mDuration_Max ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mDuration_Max ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mUltrafiltration_Volume_Min")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mUltrafiltration_Volume_Min")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mUltrafiltration_Volume_Min")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mUltrafiltration_Volume_Min")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mUltrafiltration_Volume_Max")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mUltrafiltration_Volume_Max")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mUltrafiltration_Volume_Max")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mUltrafiltration_Volume_Max")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mDialysate_Flow_Min ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mDialysate_Flow_Min ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mDialysate_Flow_Min ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mDialysate_Flow_Min ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12")); + QTest::newRow("mDialysate_Flow_Max ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13")); + QTest::newRow("mDialysate_Flow_Max ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14")); + QTest::newRow("mDialysate_Flow_Max ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15")); + QTest::newRow("mDialysate_Flow_Max ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16")); +} + +void tst_models::tst_MTreatmentRanges() +{ + Model::MTreatmentRanges mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + +#ifdef CONSOLEOUT + qDebug() << index << errorIndex << startIndex << ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mDuration_Min ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mDuration_Max ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mUltrafiltration_Volume_Min; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mUltrafiltration_Volume_Max; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mDialysate_Flow_Min ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mDialysate_Flow_Max ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + + Index: unittests/tst_models.h =================================================================== diff -u --- unittests/tst_models.h (revision 0) +++ unittests/tst_models.h (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -0,0 +1,38 @@ +/*! + * + * 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_models.h + * date 04/16/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include +#include + +// Project + +class tst_models : public QObject +{ + Q_OBJECT + +public: + explicit tst_models(QObject *parent = nullptr); + +private slots: + + void tst_MAdjustBloodDialysateResponse_data (); + void tst_MAdjustBloodDialysateResponse (); + + void tst_MTreatmentRanges_data (); + void tst_MTreatmentRanges (); + +}; + Index: unittests/tst_threads.cpp =================================================================== diff -u --- unittests/tst_threads.cpp (revision 0) +++ unittests/tst_threads.cpp (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -0,0 +1,58 @@ +/*! + * + * 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_threads.cpp + * date 4/19/2020 + * author Behrouz NematiPour + * + */ +#include "tst_threads.h" + +// Qt + +// Project +#include "threads.h" +#include "applicationcontroller.h" +#include "guicontroller.h" +#include "usbwatcher.h" +#include "caninterface.h" +#include "frameinterface.h" +#include "messagedispatcher.h" +#include "messageacknowmodel.h" + +tst_threads::tst_threads(QObject *parent) : QObject(parent) { } + +void tst_threads::initTestCase() +{ + Threads::registerTypes(); +} + +void tst_threads::tst_Thread_init() +{ + QCOMPARE( _Logger .init(Threads::_Logger_Thread ), ! _Logger .init(Threads::_Logger_Thread )); + QCOMPARE( _USBWatcher .init(Threads::_USBWatcher_Thread ), ! _USBWatcher .init(Threads::_USBWatcher_Thread )); + QCOMPARE( _CanInterface .init(Threads::_CanFrame_Thread ), ! _CanInterface .init(Threads::_CanFrame_Thread )); + QCOMPARE( _FrameInterface .init(Threads::_CanFrame_Thread ), ! _FrameInterface .init(Threads::_CanFrame_Thread )); + QCOMPARE( _MessageAcknowModel .init(Threads::_CanAcknow_Thread ), ! _MessageAcknowModel .init(Threads::_CanAcknow_Thread )); + QCOMPARE( _MessageDispatcher .init(Threads::_CanMessage_Thread ), ! _MessageDispatcher .init(Threads::_CanMessage_Thread )); + QCOMPARE( _ApplicationController .init(Threads::_Application_Thread ), ! _ApplicationController .init(Threads::_Application_Thread )); + QCOMPARE( _GuiController .init(Threads::_Application_Thread ), ! _GuiController .init(Threads::_Application_Thread )); +} + +void tst_threads::tst_Thread_names() +{ + QCOMPARE( _Logger .thread()->objectName(), "Storage::Logger_Thread" ); + QCOMPARE( _USBWatcher .thread()->objectName(), "Storage::USBWatcher_Thread" ); + QCOMPARE( _CanInterface .thread()->objectName(), "Can::FrameInterface_Thread" ); + QCOMPARE( _FrameInterface .thread()->objectName(), "Can::FrameInterface_Thread" ); + QCOMPARE( _MessageAcknowModel .thread()->objectName(), "Can::MessageAcknowModel_Thread" ); + QCOMPARE( _MessageDispatcher .thread()->objectName(), "Can::MessageDispatcher_Thread" ); + QCOMPARE( _ApplicationController .thread()->objectName(), "Gui::GuiController_Thread" ); + QCOMPARE( _GuiController .thread()->objectName(), "Gui::GuiController_Thread" ); +} + Index: unittests/tst_threads.h =================================================================== diff -u --- unittests/tst_threads.h (revision 0) +++ unittests/tst_threads.h (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -0,0 +1,38 @@ +/*! + * + * 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_threads.h + * date 4/19/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include +#include + +// Project + + +class tst_threads : public QObject +{ + Q_OBJECT + +public: + explicit tst_threads(QObject *parent = nullptr); + +private slots: + + void initTestCase(); + + void tst_Thread_init(); + void tst_Thread_names(); + +}; + Index: unittests/tst_utilities.h =================================================================== diff -u -rae97f70129df818530bcb70c934c42fa28eb6034 -rd3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d --- unittests/tst_utilities.h (.../tst_utilities.h) (revision ae97f70129df818530bcb70c934c42fa28eb6034) +++ unittests/tst_utilities.h (.../tst_utilities.h) (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -20,11 +20,6 @@ { Q_OBJECT - bool _emited = false ; - QByteArray _expected {} ; - QVariantList _data {} ; - int _action = -1 ; - public: explicit tst_utilities(QObject *parent = nullptr); Index: unittests/tst_views.cpp =================================================================== diff -u --- unittests/tst_views.cpp (revision 0) +++ unittests/tst_views.cpp (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -0,0 +1,35 @@ +/*! + * + * 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_views.cpp + * date 4/19/2020 + * author Behrouz NematiPour + * + */ +#include "tst_views.h" + +// Qt + +// Project +#include "vtreatmentadjustmentsresponse.h" + +tst_views::tst_views(QObject *parent) : QObject(parent) { } + +void tst_views::VTreatmentAdjustmentsResponse_text_NoReason() +{ + View::VTreatmentAdjustmentsResponse v; + v.adjustment_Reason(GuiRequestReasons::REASON_NONE); + QVERIFY(v.text().isEmpty()); +} + +void tst_views::VTreatmentAdjustmentsResponse_text_WAReason() +{ + View::VTreatmentAdjustmentsResponse v; + v.adjustment_Reason(GuiRequestReasons::REASON_INVALID_TREATMENT_STATE); + QVERIFY(! v.text().isEmpty()); +} Index: unittests/tst_views.h =================================================================== diff -u --- unittests/tst_views.h (revision 0) +++ unittests/tst_views.h (revision d3f916066c2d10c10fffa91fd8a7e5ac6dd86c7d) @@ -0,0 +1,32 @@ +/*! + * + * 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_views.h + * date 4/19/2020 + * author Behrouz NematiPour + * + */ +#pragma once + +// Qt +#include +#include + +// Project + +class tst_views : public QObject +{ + Q_OBJECT +public: + explicit tst_views(QObject *parent = nullptr); + +private slots: + void VTreatmentAdjustmentsResponse_text_NoReason(); + void VTreatmentAdjustmentsResponse_text_WAReason(); +}; +