Index: unittests/tst_canbus.cpp =================================================================== diff -u -r12e7b6dda53cf8db7707c7fa55dcf6137e7d6997 -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 --- unittests/tst_canbus.cpp (.../tst_canbus.cpp) (revision 12e7b6dda53cf8db7707c7fa55dcf6137e7d6997) +++ unittests/tst_canbus.cpp (.../tst_canbus.cpp) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) @@ -1,15 +1,15 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2019-2024 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_canbus.cpp - * \author (last) Behrouz NematiPour - * \date (last) 30-Jul-2020 - * \author (original) Behrouz NematiPour - * \date (original) 19-Dec-2019 + * \file tst_canbus.cpp + * \author (last) Behrouz NematiPour + * \date (last) 10-Aug-2021 + * \author (original) Behrouz NematiPour + * \date (original) 19-Dec-2019 * */ #include "tst_canbus.h" @@ -93,7 +93,7 @@ { _expected = QByteArray("123456789"); _FrameInterface.transmitFrame(Can_Id::eChlid_HD_UI, _expected); - QVERIFY( ! _emited ); //there is no signal call - Code Coverage only : Error : "Payload can't be larger than 8 bytes" + QVERIFY( ! _emited ); //there is no signal call - Code Coverage only : Error : "Payload cannot be larger than 8 bytes" } void tst_canbus::tst_FrameInterface_ActionTransmit_PowerOff_Accepted() @@ -276,30 +276,6 @@ QVERIFY( ! _emited ); // Should not emit due to - ERROR : "Incorrect data for Message ID (HD) '0x0500'" } -void tst_canbus::tst_FrameInterface_FrameReceived_LongFrame_AlarmStatus() -{ - _action = Gui::GuiActionType::ID_AlarmStatus; - _data = { 2, 10, 60, 30, - false,true ,false,false, // 0100 - true ,false,false,false, // 1000 - true ,true ,false,false, // 1100 - false,false,false,false, // 0000 - }; - QCanBusFrame mFrame; - mFrame.setFrameId(Can_Id::eChlid_HD_Alarm); - QStringList mPayloadList { - "a5.0b.00.02.00.12.02.00" , - "00.00.0a.00.00.00.3c.00" , - "00.00.1e.00.00.00.12.03" , - "20.00.00.00.00.00.00.00" , - }; - for ( QString payload : mPayloadList ) { - mFrame.setPayload(QByteArray::fromHex(payload.remove(QLatin1Char('.')).toLatin1())); - emit _CanInterface.didFrameReceive(mFrame); - } - QVERIFY(_emited); -} - void tst_canbus::tst_FrameInterface_FrameReceived_LongFrame_AlarmStatus_LessData() { _action = Gui::GuiActionType::ID_AlarmStatus; @@ -317,6 +293,7 @@ }; for ( QString payload : mPayloadList ) { mFrame.setPayload(QByteArray::fromHex(payload.remove(QLatin1Char('.')).toLatin1())); + qDebug() << " ~ @ ~ : " << mFrame.payload(); emit _CanInterface.didFrameReceive(mFrame); } QVERIFY( ! _emited ); // Should not emit due to - ERROR : "Incorrect data for Message ID (HD) '0x0200'" @@ -328,7 +305,7 @@ frame.init(); QVERIFY(frame._txFrameList.isEmpty()); frame.removeHead(); - // if the code doesn't work and calls the removeFirst of and empty list it will assert. + // if the code does not work and calls the removeFirst of and empty list it will assert. QVERIFY(true); } @@ -354,13 +331,14 @@ { _emited = true; QVERIFY(vAction == _action); + qDebug() << " ~ @ ~ : " << vData; 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]); + QCOMPARE(vData, _data); } } }