Index: unittests/tst_messaging.cpp =================================================================== diff -u -r0d3114203575d6725576f8bdc8299ad772d55fd5 -r911882aaf10ee02ef646013914a2ddd6225224ca --- unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision 0d3114203575d6725576f8bdc8299ad772d55fd5) +++ unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision 911882aaf10ee02ef646013914a2ddd6225224ca) @@ -22,6 +22,7 @@ #include "MessageBuilder.h" #include "MPowerOff.h" #include "MessageDispatcher.h" +#include "AlarmGenerator.h" tst_messaging::tst_messaging(QObject *parent) : QObject(parent) { } @@ -716,3 +717,19 @@ Can::Sequence seq = 1; dMsg.actionTransmit(Gui::GuiActionType::ID_KeepAlive, data, seq); } + +/*! + * \brief tst_messaging::tst_AlarmGenerator_setBits_OutOfRange + * \details Tests the longer list of the bits sent to AlarmGenerator::setBits method. + */ +void tst_messaging::tst_AlarmGenerator_setBits_OutOfRange() +{ + quint8 len = sizeof(AlarmGenerator::TAlarms) * 8; + AlarmGenerator ag; + AlarmGenerator::TBits bits {0, 15, len}; // 16 is out of range + QBitArray ba_actual = ag.setBits(bits); + QBitArray ba_expected(len,false); + ba_expected.setBit(0); + ba_expected.setBit(15); + QCOMPARE(ba_actual, ba_expected); +}