/*! * * 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" ); }