Index: denali.pro.user =================================================================== diff -u -rec77306c5375f80f46e76940361c5e96064a0690 -r7d3062c841b788ced31d939dec990afe0de1442d --- denali.pro.user (.../denali.pro.user) (revision ec77306c5375f80f46e76940361c5e96064a0690) +++ denali.pro.user (.../denali.pro.user) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -1,6 +1,6 @@ - + EnvironmentId @@ -1031,7 +1031,7 @@ Qt4ProjectManager.Qt4RunConfiguration:/home/denali/Project/application/denali.pro /home/denali/Project/application/denali.pro - -0 -u + false false @@ -1052,7 +1052,7 @@ Qt 5.12.5 (iMX8) Qt 5.12.5 (iMX8) {5d6458ef-f917-4aef-a092-c77bbe106149} - 0 + 1 0 0 @@ -1115,7 +1115,7 @@ true QtProjectManager.QMakeBuildStep - true + false true @@ -1314,7 +1314,7 @@ 1 - denali (on Generic Linux Device (iMX8)) + denali (on Generic Linux Device) RemoteLinuxRunConfiguration:/home/denali/Project/application/denali.pro /home/denali/Project/application/denali.pro 1 Index: sources/canbus/frameinterface.cpp =================================================================== diff -u -rb798668f16ad0967ab97e96f5f9a2cdd821e899f -r7d3062c841b788ced31d939dec990afe0de1442d --- sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision b798668f16ad0967ab97e96f5f9a2cdd821e899f) +++ sources/canbus/frameinterface.cpp (.../frameinterface.cpp) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -255,8 +255,8 @@ void FrameInterface::onFrameWritten(qint64 /*vCount*/) { _transmitted = true; - removeHead(); - // Test : qDebug() << _timestamp << "Sent #" << _txFrameList.count() << vCount; + removeHead(); + // Test : qDebug() << _timestamp << "Sent #" << _txFrameList.count() << vCount; } /*! Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r26b6c684ac4baae160e844494bffa855a1a82b51 -r7d3062c841b788ced31d939dec990afe0de1442d --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 26b6c684ac4baae160e844494bffa855a1a82b51) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -779,13 +779,13 @@ if ( ! isPayloadLenValid(vMessage, Gui::GuiActionType::CanBUSFaultCount) ) return ok; QVariantList mData; - if (vMessage.data.count()) { - int index = 0; - Types::U32 mCanBUSFaultCount; - ok = GetValue(vMessage.data, index, mCanBUSFaultCount); - if (ok) { - vData += mCanBUSFaultCount.value; - } + int index = 0; + Types::U32 mCanBUSFaultCount; + ok = GetValue(vMessage.data, index, mCanBUSFaultCount); + // coco begin validated : developer safety if for any reason length of CanBUSFaultCount set to 0 + if (ok) { + // coco end + vData += mCanBUSFaultCount.value; } return ok; } Index: sources/gui/qml/pages/SettingsHome.qml =================================================================== diff -u -rec77306c5375f80f46e76940361c5e96064a0690 -r7d3062c841b788ced31d939dec990afe0de1442d --- sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision ec77306c5375f80f46e76940361c5e96064a0690) +++ sources/gui/qml/pages/SettingsHome.qml (.../SettingsHome.qml) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -229,7 +229,7 @@ Text { id: _LoadCellReading_Title text: qsTr(" LoadCl ") - width: _LoadCellReadingColumn.width + width: _LoadCellReadingsColumn.width horizontalAlignment: Text.AlignRight color: Colors.textMain font.pixelSize: Fonts.fontPixelTitle @@ -261,7 +261,7 @@ Text { id: _TemperatureSensors_Title text: qsTr(" Temp ") - width: _LoadCellReadingColumn.width + width: _TemperatureSensorsColumn.width horizontalAlignment: Text.AlignRight color: Colors.textMain font.pixelSize: Fonts.fontPixelTitle Index: sources/model/mloadcellreadings.h =================================================================== diff -u -re591b135f821c1b1e13c2db8429dc63648c2452c -r7d3062c841b788ced31d939dec990afe0de1442d --- sources/model/mloadcellreadings.h (.../mloadcellreadings.h) (revision e591b135f821c1b1e13c2db8429dc63648c2452c) +++ sources/model/mloadcellreadings.h (.../mloadcellreadings.h) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -19,9 +19,16 @@ // Project #include "types.h" +// forward declarations +class tst_models; + namespace Model { class MLoadCellReadings { + + // friends + friend class ::tst_models; + public: QString stringPrefix = "Load Cell Readings"; struct Data { Index: sources/model/mtemperaturesensors.h =================================================================== diff -u -reece7acacf84e8cc34b830f6b5ab3f112823a905 -r7d3062c841b788ced31d939dec990afe0de1442d --- sources/model/mtemperaturesensors.h (.../mtemperaturesensors.h) (revision eece7acacf84e8cc34b830f6b5ab3f112823a905) +++ sources/model/mtemperaturesensors.h (.../mtemperaturesensors.h) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -19,9 +19,16 @@ // Project #include "types.h" +// forward declarations +class tst_models; + namespace Model { class MTemperatureSensors { + + // friends + friend class ::tst_models; + public: QString stringPrefix = "Temperature Sensors"; struct Data { Index: sources/model/mtreatmentadjustultrafiltrationstateresponse.h =================================================================== diff -u -r5734e6289c18ec3cfe4749de8e3a6043f98dbcff -r7d3062c841b788ced31d939dec990afe0de1442d --- sources/model/mtreatmentadjustultrafiltrationstateresponse.h (.../mtreatmentadjustultrafiltrationstateresponse.h) (revision 5734e6289c18ec3cfe4749de8e3a6043f98dbcff) +++ sources/model/mtreatmentadjustultrafiltrationstateresponse.h (.../mtreatmentadjustultrafiltrationstateresponse.h) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -37,7 +37,7 @@ private: struct { - Types::U08 mAccepted ; // this is a responce to AcknowGeneral which has a data of 1 byte for the accpted/rejected. + Types::U08 mAccepted ; // IMPORTANT : This is a responce to AcknowGeneric which has a data of 1 byte for the accpted/rejected. } _data; public: Index: sources/view/vtreatmentadjustmentultrafiltrationstate.cpp =================================================================== diff -u -r5734e6289c18ec3cfe4749de8e3a6043f98dbcff -r7d3062c841b788ced31d939dec990afe0de1442d --- sources/view/vtreatmentadjustmentultrafiltrationstate.cpp (.../vtreatmentadjustmentultrafiltrationstate.cpp) (revision 5734e6289c18ec3cfe4749de8e3a6043f98dbcff) +++ sources/view/vtreatmentadjustmentultrafiltrationstate.cpp (.../vtreatmentadjustmentultrafiltrationstate.cpp) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -58,9 +58,14 @@ { // if there is a reason (passed) it will be used QString mText = VTreatmentAdjustmentResponseBase::text(); + // coco begin validated : Manually tested. + // Although currently there is no reson passed in the corespounding message. + // But kept this code which seems reasonable to have a reason later. if (! mText.isEmpty()) return mText; + // coco end // otherwise a general message will be created/passed. if (! adjustment_Accepted()) { + qDebug() << "VTreatmentAdjustmentUltrafiltrationState::text()" << true; switch (_data.requestedState) { case AdjustUltrafiltrationStateRequestData::eRunning: mText = tr("Unable to Resume Ultrafiltration or already running"); @@ -69,10 +74,9 @@ case AdjustUltrafiltrationStateRequestData::ePaused: mText = tr("Unable to Pause Ultrafiltration or already paused"); break; - - default: - break; } + } else { + qDebug() << "VTreatmentAdjustmentUltrafiltrationState::text()" << false; } return mText; } Index: unittests/tst_canbus.cpp =================================================================== diff -u -rb798668f16ad0967ab97e96f5f9a2cdd821e899f -r7d3062c841b788ced31d939dec990afe0de1442d --- unittests/tst_canbus.cpp (.../tst_canbus.cpp) (revision b798668f16ad0967ab97e96f5f9a2cdd821e899f) +++ unittests/tst_canbus.cpp (.../tst_canbus.cpp) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -321,6 +321,16 @@ QVERIFY( ! _emited ); // Should not emit due to - ERROR : "Incorrect data for Message ID (HD) '0x0200'" } +void tst_canbus::tst_FrameInterface_FrameReceived_removeHead_EmptyList() +{ + FrameInterface frame; + frame.init(); + QVERIFY(frame._txFrameList.isEmpty()); + frame.removeHead(); + // if the code doesn't work and calls the removeFist of and empty list it will assert. + QVERIFY(true); +} + void tst_canbus::cleanup() { } Index: unittests/tst_canbus.h =================================================================== diff -u -rb798668f16ad0967ab97e96f5f9a2cdd821e899f -r7d3062c841b788ced31d939dec990afe0de1442d --- unittests/tst_canbus.h (.../tst_canbus.h) (revision b798668f16ad0967ab97e96f5f9a2cdd821e899f) +++ unittests/tst_canbus.h (.../tst_canbus.h) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -71,6 +71,8 @@ void tst_FrameInterface_FrameReceived_LongFrame_AlarmStatus(); void tst_FrameInterface_FrameReceived_LongFrame_AlarmStatus_LessData(); + void tst_FrameInterface_FrameReceived_removeHead_EmptyList(); + void cleanup(); void cleanupTestCase(); Index: unittests/tst_messaging.cpp =================================================================== diff -u -ra9dcbee03acab972b43f696b2f3dbdf99f1eeb97 -r7d3062c841b788ced31d939dec990afe0de1442d --- unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision a9dcbee03acab972b43f696b2f3dbdf99f1eeb97) +++ unittests/tst_messaging.cpp (.../tst_messaging.cpp) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -52,6 +52,19 @@ } /*! + * \brief tst_messaging::tst_MessageInterpreter_isPayloadLenValid + * \details Tests MessageInterpreter isPayloadLenValid method + */ +void tst_messaging::tst_MessageInterpreter_isPayloadLenValid_undefined() +{ + Can::MessageInterpreter iMsg; + Can::Message msg; + msg.actionId = static_cast(-1); + msg.data = {}; + QVERIFY( ! iMsg.isPayloadLenValid(msg, msg.actionId)); +} + +/*! * \brief tst_messaging::tst_MessageInterpreter_getPowerOffData_isType * \details Tests MessageInterpreter getPowerOffData method Message Type checking */ @@ -443,7 +456,7 @@ { Can::MessageInterpreter iMsg; Can::Message msg; - msg.actionId = Gui::GuiActionType::AcknowGeneric; + msg.actionId = Gui::GuiActionType::AdjustUltrafiltrationStateReq; msg.data = {}; QVariantList list; QVERIFY( ! iMsg.adjustUltrafiltrationStateData(msg, list)); @@ -630,6 +643,18 @@ QVERIFY(payload.isEmpty()); } +void tst_messaging::tst_MessageInterpreter_interpretMessage_DG_Unhandled() +{ + Can::MessageInterpreter iMsg; + QByteArray payload; + Can::Message msg; + msg.actionId = static_cast(-1); + msg.data = {}; + QVariantList list; + QVERIFY( ! iMsg.interpretMessage_DG(msg, list)); + QVERIFY(list.isEmpty()); +} + /*! * \brief tst_messaging::tst_MessageInterpreter_interpretMessage_AdjustBloodDialysateReq * \details Tests MessageInterpreter interpretMessage to handle AdjustBloodDialysateReq message type Index: unittests/tst_messaging.h =================================================================== diff -u -ra9dcbee03acab972b43f696b2f3dbdf99f1eeb97 -r7d3062c841b788ced31d939dec990afe0de1442d --- unittests/tst_messaging.h (.../tst_messaging.h) (revision a9dcbee03acab972b43f696b2f3dbdf99f1eeb97) +++ unittests/tst_messaging.h (.../tst_messaging.h) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -27,6 +27,7 @@ private slots: void tst_MessageInterpreter_isType(); void tst_MessageInterpreter_isPayloadLenValid(); + void tst_MessageInterpreter_isPayloadLenValid_undefined(); void tst_MessageInterpreter_getPowerOffData_isType(); void tst_MessageInterpreter_getPowerOffData_payloadLen(); @@ -93,9 +94,11 @@ void tst_MessageInterpreter_interpretMessage_canbusFaultCountData(); - void tst_MessageInterpreter_interpretMessage_String(); + void tst_MessageInterpreter_interpretMessage_DG_Unhandled(); + + void tst_MessageBuilder_addActionId(); void tst_MessageBuilder_addData_shorterLen(); void tst_MessageBuilder_addData_LongerThanMax(); Index: unittests/tst_models.cpp =================================================================== diff -u -ra9dcbee03acab972b43f696b2f3dbdf99f1eeb97 -r7d3062c841b788ced31d939dec990afe0de1442d --- unittests/tst_models.cpp (.../tst_models.cpp) (revision a9dcbee03acab972b43f696b2f3dbdf99f1eeb97) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -19,6 +19,11 @@ #include "mtreatmentadjustblooddialysateresponse.h" #include "mtreatmentadjustdurationresponse.h" #include "mtreatmentranges.h" +#include "mloadcellreadings.h" +#include "mtemperaturesensors.h" +#include "mtreatmentadjustultrafiltrationstateresponse.h" +#include "mtreatmentadjustultrafiltrationeditresponse.h" +#include "mtreatmentadjustultrafiltrationconfirmresponse.h" // #define CONSOLEOUT @@ -62,9 +67,9 @@ int startIndex = 0; int index = errorIndex - 1; - -#ifdef CONSOLEOUT bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT qDebug() << index << errorIndex << startIndex << ok << data ; #endif @@ -120,9 +125,9 @@ int startIndex = 0; int index = errorIndex - 1; - -#ifdef CONSOLEOUT bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT qDebug() << index << errorIndex << startIndex << ok << data ; #endif @@ -173,9 +178,10 @@ int startIndex = 0; int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) #ifdef CONSOLEOUT - bool ok = mData.fromByteArray(data, &startIndex); qDebug() << index << errorIndex << startIndex << ok << data ; #endif @@ -190,3 +196,304 @@ break; } } + +void tst_models::tst_MLoadCellReadings_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("mReservoir1Prim")<< 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mReservoir1Prim")<< 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mReservoir1Prim")<< 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mReservoir1Prim")<< 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mReservoir1Bkup")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mReservoir1Bkup")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mReservoir1Bkup")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mReservoir1Bkup")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mReservoir2Prim")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mReservoir2Prim")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mReservoir2Prim")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mReservoir2Prim")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mReservoir2Bkup")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mReservoir2Bkup")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mReservoir2Bkup")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mReservoir2Bkup")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); +} + +void tst_models::tst_MLoadCellReadings () +{ + Model::MLoadCellReadings mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) + +#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.mReservoir1Prim ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReservoir1Bkup ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mReservoir2Prim ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mReservoir2Bkup ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +void tst_models::tst_MTemperatureSensors_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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F")); + QTest::newRow("mInletPrimaryHeater ")<< 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mInletPrimaryHeater ")<< 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mInletPrimaryHeater ")<< 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mInletPrimaryHeater ")<< 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mOutletPrimaryHeater ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mOutletPrimaryHeater ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mOutletPrimaryHeater ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mOutletPrimaryHeater ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mConductivitySensor1 ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mConductivitySensor1 ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mConductivitySensor1 ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mConductivitySensor1 ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mConductivitySensor2 ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mConductivitySensor2 ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mConductivitySensor2 ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mConductivitySensor2 ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mOutletRedundancy ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mOutletRedundancy ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mOutletRedundancy ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mOutletRedundancy ")<< 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("mInletDialysate ")<< 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("mInletDialysate ")<< 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("mInletDialysate ")<< 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("mInletDialysate ")<< 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")); + QTest::newRow("mPrimaryHeaterThermoCouple")<< 7 << 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("mPrimaryHeaterThermoCouple")<< 7 << 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" "18")); + QTest::newRow("mPrimaryHeaterThermoCouple")<< 7 << 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" "18" "19")); + QTest::newRow("mPrimaryHeaterThermoCouple")<< 7 << 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" "18" "19" "1A")); + QTest::newRow("mTrimmerHeaterThermoCouple")<< 8 << 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" "18" "19" "1A" "1B")); + QTest::newRow("mTrimmerHeaterThermoCouple")<< 8 << 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" "18" "19" "1A" "1B" "1C")); + QTest::newRow("mTrimmerHeaterThermoCouple")<< 8 << 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" "18" "19" "1A" "1B" "1C" "1D")); + QTest::newRow("mTrimmerHeaterThermoCouple")<< 8 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E")); + QTest::newRow("mPrimaryHeaterColdJunction")<< 9 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F")); + QTest::newRow("mPrimaryHeaterColdJunction")<< 9 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20")); + QTest::newRow("mPrimaryHeaterColdJunction")<< 9 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21")); + QTest::newRow("mPrimaryHeaterColdJunction")<< 9 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22")); + QTest::newRow("mTrimmerHeaterColdJunction")<< 10 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23")); + QTest::newRow("mTrimmerHeaterColdJunction")<< 10 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24")); + QTest::newRow("mTrimmerHeaterColdJunction")<< 10 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25")); + QTest::newRow("mTrimmerHeaterColdJunction")<< 10 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26")); + QTest::newRow("mPrimaryHeaterInternal ")<< 11 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27")); + QTest::newRow("mPrimaryHeaterInternal ")<< 11 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28")); + QTest::newRow("mPrimaryHeaterInternal ")<< 11 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29")); + QTest::newRow("mPrimaryHeaterInternal ")<< 11 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A")); + QTest::newRow("mTrimmerHeaterInternal ")<< 12 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B")); + QTest::newRow("mTrimmerHeaterInternal ")<< 12 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" )); + QTest::newRow("mTrimmerHeaterInternal ")<< 12 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D")); + QTest::newRow("mTrimmerHeaterInternal ")<< 12 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E")); +} + +void tst_models::tst_MTemperatureSensors () +{ + Model::MTemperatureSensors mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) + +#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.mInletPrimaryHeater ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mOutletPrimaryHeater ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mConductivitySensor1 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mConductivitySensor2 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mOutletRedundancy ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mInletDialysate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mPrimaryHeaterThermoCouple ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mTrimmerHeaterThermoCouple ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mPrimaryHeaterColdJunction ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mTrimmerHeaterColdJunction ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 11: { index = index * sizeof mData._data.mPrimaryHeaterInternal ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 12: { index = index * sizeof mData._data.mTrimmerHeaterInternal ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +void tst_models::tst_MAdjustUltrafiltrationStateResponse_data () +{ + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg compelete ")<< 0 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray()); +} + +void tst_models::tst_MAdjustUltrafiltrationStateResponse () +{ + Model::MAdjustUltrafiltrationStateResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#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; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +void tst_models::tst_MAdjustUltrafiltrationEditResponse_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" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F")); + 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("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mDurationDiff ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mDurationDiff ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mDurationDiff ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mDurationDiff ")<< 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("mRate ")<< 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("mRate ")<< 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("mRate ")<< 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("mRate ")<< 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")); + QTest::newRow("mRateDiff ")<< 7 << 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("mRateDiff ")<< 7 << 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" "18")); + QTest::newRow("mRateDiff ")<< 7 << 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" "18" "19")); + QTest::newRow("mRateDiff ")<< 7 << 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" "18" "19" "1A")); + QTest::newRow("mRateOld ")<< 8 << 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" "18" "19" "1A" "1B")); + QTest::newRow("mRateOld ")<< 8 << 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" "18" "19" "1A" "1B" "1C")); + QTest::newRow("mRateOld ")<< 8 << 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" "18" "19" "1A" "1B" "1C" "1D")); + QTest::newRow("mRateOld ")<< 8 << 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" "18" "19" "1A" "1B" "1C" "1D" "1E")); +} + +void tst_models::tst_MAdjustUltrafiltrationEditResponse () +{ + Model::MAdjustUltrafiltrationEditResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) + +#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.mVolume ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mDuration ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mDurationDiff ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mRateDiff ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mRateOld ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +void tst_models::tst_MAdjustUltrafiltrationConfirmResponse_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")); + 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("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mRate ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mRate ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mRate ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mRate ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12")); +} + +void tst_models::tst_MAdjustUltrafiltrationConfirmResponse () +{ + Model::MAdjustUltrafiltrationConfirmResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) + +#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.mVolume ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mDuration ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} Index: unittests/tst_models.h =================================================================== diff -u -ra9dcbee03acab972b43f696b2f3dbdf99f1eeb97 -r7d3062c841b788ced31d939dec990afe0de1442d --- unittests/tst_models.h (.../tst_models.h) (revision a9dcbee03acab972b43f696b2f3dbdf99f1eeb97) +++ unittests/tst_models.h (.../tst_models.h) (revision 7d3062c841b788ced31d939dec990afe0de1442d) @@ -36,5 +36,21 @@ void tst_MTreatmentRanges_data (); void tst_MTreatmentRanges (); + + void tst_MLoadCellReadings_data (); + void tst_MLoadCellReadings (); + + void tst_MTemperatureSensors_data (); + void tst_MTemperatureSensors (); + + void tst_MAdjustUltrafiltrationStateResponse_data (); + void tst_MAdjustUltrafiltrationStateResponse (); + + void tst_MAdjustUltrafiltrationEditResponse_data (); + void tst_MAdjustUltrafiltrationEditResponse (); + + void tst_MAdjustUltrafiltrationConfirmResponse_data (); + void tst_MAdjustUltrafiltrationConfirmResponse (); + };