Index: unittests/tst_models.cpp =================================================================== diff -u -ra9b3b248a786b93bf6dfd8c29946d708d18dde9a -re21b48f8a2c42ab879a807c82970b0fb6d1b37d7 --- unittests/tst_models.cpp (.../tst_models.cpp) (revision a9b3b248a786b93bf6dfd8c29946d708d18dde9a) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision e21b48f8a2c42ab879a807c82970b0fb6d1b37d7) @@ -35,7 +35,8 @@ #include "MHDOperationModeData.h" #include "MTreatmentStatesData.h" #include "MTreatmentOutletFlowData.h" -#include "MTreatmentFlowsData.h" +#include "MPreTreatmentAdjustParametersValidationResponse.h" +#include "MPreTreatmentAdjustInitTreatmentResponse.h" #include "MTreatmentTimeData.h" #include "MTreatmentPressureOcclusionData.h" #include "MTreatmentSalineData.h" @@ -47,16 +48,19 @@ #include "MTreatmentAdjustPressuresLimitsResponse.h" #include "MTreatmentAdjustSalineResponse.h" #include "MTreatmentAdjustHeparinResponse.h" +#include "MUIBloodPressureData.h" #include "MAlarmStatusData.h" #include "MAlarmTriggered.h" #include "MAlarmCleared.h" +#include "MAlarmClearedCondition.h" #include "MPreTreatmentAdjustParametersValidationResponse.h" #include "MPreTreatmentAdjustInitTreatmentResponse.h" #include "MessageInterpreter.h" + using namespace Can; #undef CONSOLEOUT @@ -466,22 +470,18 @@ 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("mArterialLimitLow ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mArterialLimitLow ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("mArterialLimitLow ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("mArterialLimitLow ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); - QTest::newRow("mArterialLimitHigh ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); - QTest::newRow("mArterialLimitHigh ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); - QTest::newRow("mArterialLimitHigh ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); - QTest::newRow("mArterialLimitHigh ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); - QTest::newRow("mVenousLimitLow ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); - QTest::newRow("mVenousLimitLow ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); - QTest::newRow("mVenousLimitLow ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); - QTest::newRow("mVenousLimitLow ")<< 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("mVenousLimitHigh ")<< 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("mVenousLimitHigh ")<< 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("mVenousLimitHigh ")<< 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("mVenousLimitHigh ")<< 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("mArterialPressureLimitWindow ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mArterialPressureLimitWindow ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mArterialPressureLimitWindow ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mArterialPressureLimitWindow ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mVenousPressureLimitWindow ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mVenousPressureLimitWindow ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mVenousPressureLimitWindow ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mVenousPressureLimitWindow ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mVenousPressureLimitAsymtrc ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mVenousPressureLimitAsymtrc ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mVenousPressureLimitAsymtrc ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mVenousPressureLimitAsymtrc ")<< 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_MAdjustPressuresLimitsResponse() @@ -504,10 +504,9 @@ 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.mArterialLimitLow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 4: { index = index * sizeof mData._data.mArterialLimitHigh ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 5: { index = index * sizeof mData._data.mVenousLimitLow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 6: { index = index * sizeof mData._data.mVenousLimitHigh ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mArterialPressureLimitWindow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mVenousPressureLimitWindow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mVenousPressureLimitAsymtrc ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; @@ -520,7 +519,7 @@ void tst_models::tst_DGROPumpData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("msg complete ") << 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("mPressure ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mPressure ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mPressure ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -533,6 +532,19 @@ QTest::newRow("mPWM ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); QTest::newRow("mPWM ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); QTest::newRow("mPWM ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mState ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mState ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mState ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mState ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mTgtFlowRate ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mTgtFlowRate ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mTgtFlowRate ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mTgtFlowRate ") << 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("mFBPWM ") << 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("mFBPWM ") << 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("mFBPWM ") << 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("mFBPWM ") << 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")); + } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGROPumpData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_DGROPumpData() { @@ -550,10 +562,14 @@ #endif switch (errorIndex) { - case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 1: { index = index * sizeof mData._data.mPressure ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 2: { index = index * sizeof mData._data.mFlowRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 3: { index = index * sizeof mData._data.mPWM ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mPressure ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mFlowRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mPWM ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mTgtFlowRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mFBPWM ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: QVERIFY2(false, "Incorrect Test"); break; @@ -566,7 +582,7 @@ void tst_models::tst_DGPressuresData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("msg complete ") << 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("mROInletPSI ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mROInletPSI ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mROInletPSI ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -583,6 +599,11 @@ QTest::newRow("mDrainOutletPSI") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); QTest::newRow("mDrainOutletPSI") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); QTest::newRow("mDrainOutletPSI") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mBarometricPSI ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mBarometricPSI ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mBarometricPSI ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mBarometricPSI ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12")); + } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGPressuresData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_DGPressuresData() { @@ -605,6 +626,8 @@ case 2: { index = index * sizeof mData._data.mROOutletPSI ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 3: { index = index * sizeof mData._data.mDrainInletPSI ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 4: { index = index * sizeof mData._data.mDrainOutletPSI; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mBarometricPSI ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: QVERIFY2(false, "Incorrect Test"); break; @@ -617,15 +640,35 @@ void tst_models::tst_DGDrainPumpData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mRPM ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mRPM ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mRPM ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mRPM ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); - QTest::newRow("mDAC ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("mDAC ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); - QTest::newRow("mDAC ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); - QTest::newRow("mDAC ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("msg complete") << 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")); + QTest::newRow("mRPMI ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mRPMI ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mRPMI ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mRPMI ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mDAC ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mDAC ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mDAC ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mDAC ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mRPMO ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mRPMO ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mRPMO ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mRPMO ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mTargetFLPMO ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mTargetFLPMO ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mTargetFLPMO ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mTargetFLPMO ") << 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("mCurrentA ") << 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("mCurrentA ") << 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("mCurrentA ") << 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("mCurrentA ") << 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("mDirection ") << 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("mDirection ") << 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("mDirection ") << 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("mDirection ") << 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")); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGDrainPumpData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_DGDrainPumpData() { @@ -643,9 +686,15 @@ #endif switch (errorIndex) { - case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 1: { index = index * sizeof mData._data.mRPM ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 2: { index = index * sizeof mData._data.mDAC ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mRPMI ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mDAC ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mRPMO ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mTargetFLPMO ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mCurrentA ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mDirection ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: QVERIFY2(false, "Incorrect Test"); break; @@ -658,11 +707,16 @@ void tst_models::tst_DGOperationMode_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mSubMode ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mSubMode ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mSubMode ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mSubMode ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGOperationMode test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_DGOperationMode() { @@ -682,6 +736,8 @@ switch (errorIndex) { case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 1: { index = index * sizeof mData._data.mOpMode ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mSubMode; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: QVERIFY2(false, "Incorrect Test"); break; @@ -694,7 +750,7 @@ void tst_models::tst_DGReservoirData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("msg complete ") << 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("mActiveReservoir") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mActiveReservoir") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mActiveReservoir") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -707,6 +763,43 @@ QTest::newRow("mDrainToVol ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); QTest::newRow("mDrainToVol ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); QTest::newRow("mDrainToVol ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mTimeReservoirCycleMS ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mTimeReservoirCycleMS ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mTimeReservoirCycleMS ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mTimeReservoirCycleMS ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mTimeReservoirFill2SwitchMS ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mTimeReservoirFill2SwitchMS ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mTimeReservoirFill2SwitchMS ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mTimeReservoirFill2SwitchMS ") << 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("mTimeUFDecayMS ") << 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("mTimeUFDecayMS ") << 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("mTimeUFDecayMS ") << 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("mTimeUFDecayMS ") << 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("mTempUFFill ") << 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("mTempUFFill ") << 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("mTempUFFill ") << 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("mTempUFFill ") << 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("mTempReservoirUseActual ") << 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("mTempReservoirUseActual ") << 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("mTempReservoirUseActual ") << 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("mTempReservoirUseActual ") << 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("mTempReservoirEndFill ") << 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("mTempReservoirEndFill ") << 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("mTempReservoirEndFill ") << 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("mTempReservoirEndFill ") << 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("mTempAvgFill ") << 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("mTempAvgFill ") << 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("mTempAvgFill ") << 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("mTempAvgFill ") << 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("mTempLastFill ") << 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("mTempLastFill ") << 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("mTempLastFill ") << 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("mTempLastFill ") << 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("mTimereservoirFill ") << 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("mTimereservoirFill ") << 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("mTimereservoirFill ") << 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("mTimereservoirFill ") << 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")); + } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGReservoirData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_DGReservoirData() { @@ -724,10 +817,19 @@ #endif switch (errorIndex) { - case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 1: { index = index * sizeof mData._data.mActiveReservoir ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 2: { index = index * sizeof mData._data.mFillToVol ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 3: { index = index * sizeof mData._data.mDrainToVol ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mActiveReservoir ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mFillToVol ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mDrainToVol ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mTimeReservoirCycleMS ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mTimeReservoirFill2SwitchMS ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mTimeUFDecayMS ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mTempUFFill ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mTempReservoirUseActual ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mTempReservoirEndFill ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mTempAvgFill ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 11: { index = index * sizeof mData._data.mTempLastFill ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 12: { index = index * sizeof mData._data.mTimereservoirFill ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; @@ -740,28 +842,62 @@ void tst_models::tst_DGValvesStates_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mStates ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mStates ") << 1 << QByteArray::fromHex(QByteArray("00")); + + int lastFlag = 0; + int errorIndex = 1; + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mStates" , errorIndex++, 1, 16); // adding 16 rows for the two bytes of data for the states flag + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mVRf" , errorIndex++, lastFlag + 1); + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mVRi" , errorIndex++, lastFlag + 1); + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mRes" , errorIndex++, lastFlag + 1); + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mVRo" , errorIndex++, lastFlag + 1); + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mVPo" , errorIndex++, lastFlag + 1); + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mVBf" , errorIndex++, lastFlag + 1); + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mVRc" , errorIndex++, lastFlag + 1); + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mVDr" , errorIndex++, lastFlag + 1); + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mVPi" , errorIndex++, lastFlag + 1); + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mVSP" , errorIndex++, lastFlag + 1); + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mVR1" , errorIndex++, lastFlag + 1); + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mVR2" , errorIndex++, lastFlag + 1); + lastFlag = HelperFunctions_tstModel::generate_bitDataRow("mVPd" , errorIndex++, lastFlag + 1); } + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGValvesStates test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_DGValvesStates() { Model::MDGValvesStates mData; QFETCH(int , errorIndex ); QFETCH(QByteArray, data ); - int startIndex = 0; - int index = errorIndex - 1; + int startIndex = errorIndex+1; + 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.mStates ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + // The mStates param contains 2byte of data or 16 bits of states + case 1: { index = index * sizeof mData._data.mStates/8 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + // All of these are single byte types (u8) + case 2: { index = index * sizeof mData._data.mVRf ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mVRi ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mRes ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mVRo ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mVPo ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mVBf ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mVRc ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mVDr ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mVPi ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 11: { index = index * sizeof mData._data.mVSP ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 12: { index = index * sizeof mData._data.mVR1 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 13: { index = index * sizeof mData._data.mVR2 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + // The test data is set up in bits and we are testing for bytes, when we reach the last case, the + // fromByteArray function returns true even though we have a partial byte filled out, the remainder/"missing" bits are 0 + case 14: { index = index * sizeof mData._data.mVPd ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; @@ -774,7 +910,7 @@ void tst_models::tst_DGHeatersData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("msg complete ") << 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")); QTest::newRow("mMainPrimayHeaterDC ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mMainPrimayHeaterDC ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mMainPrimayHeaterDC ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -787,6 +923,38 @@ QTest::newRow("mTrimmerHeaterDC ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); QTest::newRow("mTrimmerHeaterDC ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); QTest::newRow("mTrimmerHeaterDC ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mPrimaryTargetTemp ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mPrimaryTargetTemp ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mPrimaryTargetTemp ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mPrimaryTargetTemp ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mTrimmerTargetTemp ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mTrimmerTargetTemp ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mTrimmerTargetTemp ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mTrimmerTargetTemp ") << 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("mPrimaryHeaterState ") << 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("mPrimaryHeaterState ") << 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("mPrimaryHeaterState ") << 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("mPrimaryHeaterState ") << 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("mTrimmerHeaterState ") << 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("mTrimmerHeaterState ") << 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("mTrimmerHeaterState ") << 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("mTrimmerHeaterState ") << 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("mPrimaryEfficiency ") << 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("mPrimaryEfficiency ") << 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("mPrimaryEfficiency ") << 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("mPrimaryEfficiency ") << 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("mPrimaryCalcTargetTemp ") << 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("mPrimaryCalcTargetTemp ") << 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("mPrimaryCalcTargetTemp ") << 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("mPrimaryCalcTargetTemp ") << 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("mTrimmerCalcCurrentTemp ") << 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("mTrimmerCalcCurrentTemp ") << 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("mTrimmerCalcCurrentTemp ") << 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("mTrimmerCalcCurrentTemp ") << 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("mTrimmerUseLastDC ") << 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("mTrimmerUseLastDC ") << 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("mTrimmerUseLastDC ") << 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("mTrimmerUseLastDC ") << 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")); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGHeatersData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_DGHeatersData() { @@ -808,6 +976,15 @@ case 1: { index = index * sizeof mData._data.mMainPrimayHeaterDC ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 2: { index = index * sizeof mData._data.mSmallPrimaryHeaterDC ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 3: { index = index * sizeof mData._data.mTrimmerHeaterDC ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mPrimaryTargetTemp ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mTrimmerTargetTemp ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mPrimaryHeaterState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mTrimmerHeaterState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mPrimaryEfficiency ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mPrimaryCalcTargetTemp; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mTrimmerCalcCurrentTemp; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 11: { index = index * sizeof mData._data.mTrimmerUseLastDC ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: QVERIFY2(false, "Incorrect Test"); break; @@ -869,57 +1046,29 @@ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGTemperaturesData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGTemperaturesData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_DGTemperaturesData_data () { - QTest::addColumn("errorIndex"); - QTest::addColumn("data"); - QTest::newRow("msg complete ") << 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")); + HelperFunctions_tstModel::generate_ByteDataSet( { + "mInletPrimaryHeater ", + "mHeatDisinfect ", + "mOutletPrimaryHeater ", + "mConductivitySensor1 ", + "mConductivitySensor2 ", + "mOutletRedundancy ", + "mInletDialysate ", + "mPrimaryHeaterThermoCouple ", + "mTrimmerHeaterThermoCouple ", + "mPrimaryHeaterColdJunction ", + "mTrimmerHeaterColdJunction ", + "mPrimaryHeaterInternal ", + "mTrimmerHeaterInternal ", + "mFpgaBoard ", + "mLoadCellA1B1 ", + "mLoadCellA2B2 ", + "mInternalTHDORTD ", + "mInternalTDIRTD ", + "mInteralTHDRTD ", + "mInternalCondSnsrTemp ", + "mBaroTempSensor " + }); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGTemperaturesData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_DGTemperaturesData() { @@ -939,17 +1088,26 @@ 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; + case 2: { index = index * sizeof mData._data.mHeatDisinfect ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mOutletPrimaryHeater ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mConductivitySensor1 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mConductivitySensor2 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mOutletRedundancy ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mInletDialysate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mPrimaryHeaterThermoCouple; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mTrimmerHeaterThermoCouple; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mPrimaryHeaterColdJunction; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 11: { index = index * sizeof mData._data.mTrimmerHeaterColdJunction; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 12: { index = index * sizeof mData._data.mPrimaryHeaterInternal ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 13: { index = index * sizeof mData._data.mTrimmerHeaterInternal ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 14: { index = index * sizeof mData._data.mFpgaBoard ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 15: { index = index * sizeof mData._data.mLoadCellA1B1 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 16: { index = index * sizeof mData._data.mLoadCellA2B2 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 17: { index = index * sizeof mData._data.mInternalTHDORTD ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 18: { index = index * sizeof mData._data.mInternalTDIRTD ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 19: { index = index * sizeof mData._data.mInteralTHDRTD ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 20: { index = index * sizeof mData._data.mInternalCondSnsrTemp ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 21: { index = index * sizeof mData._data.mBaroTempSensor ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; @@ -962,7 +1120,7 @@ void tst_models::tst_MTreatmentStateData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("msg complete ") << 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")); QTest::newRow("mSubmode ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mSubmode ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mSubmode ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -979,6 +1137,31 @@ QTest::newRow("mHeparinState") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); QTest::newRow("mHeparinState") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); QTest::newRow("mHeparinState") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mRinsebackState ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mRinsebackState ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mRinsebackState ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mRinsebackState ") << 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("mRecirculateState") << 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("mRecirculateState") << 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("mRecirculateState") << 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("mRecirculateState") << 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("mBloodPrimeState ") << 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("mBloodPrimeState ") << 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("mBloodPrimeState ") << 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("mBloodPrimeState ") << 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("mTreatmentEndState ") << 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("mTreatmentEndState ") << 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("mTreatmentEndState ") << 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("mTreatmentEndState ") << 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("mTreatmentStopState ") << 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("mTreatmentStopState ") << 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("mTreatmentStopState ") << 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("mTreatmentStopState ") << 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("mDialysisState ") << 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("mDialysisState ") << 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("mDialysisState ") << 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("mDialysisState ") << 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")); + } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentStateData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MTreatmentStateData() { @@ -1001,6 +1184,13 @@ case 2: { index = index * sizeof mData._data.mUFState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 3: { index = index * sizeof mData._data.mSalineState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 4: { index = index * sizeof mData._data.mHeparinState; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mRinsebackState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mRecirculateState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mBloodPrimeState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mTreatmentEndState; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mTreatmentStopState; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mDialysisState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: QVERIFY2(false, "Incorrect Test"); break; @@ -1013,11 +1203,16 @@ void tst_models::tst_MHDOperationModeData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mSubMode ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mSubMode ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mSubMode ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mSubMode ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDOperationModeData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MHDOperationModeData() { @@ -1037,6 +1232,8 @@ switch (errorIndex) { case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 1: { index = index * sizeof mData._data.mOpMode; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mSubMode; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: QVERIFY2(false, "Incorrect Test"); break; @@ -1049,7 +1246,7 @@ void tst_models::tst_MOutletFlowData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 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")); + QTest::newRow("msg complete ") << 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" "2B" "2C" "2D" "2E" "2F" "30")); QTest::newRow("mRefUFVol ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mRefUFVol ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mRefUFVol ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -1078,6 +1275,27 @@ QTest::newRow("mPWMDtCycle ") << 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("mPWMDtCycle ") << 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("mPWMDtCycle ") << 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("mDopCorrOffset ") << 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("mDopCorrOffset ") << 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("mDopCorrOffset ") << 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("mDopCorrOffset ") << 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("mDopCalcRate ") << 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("mDopCalcRate ") << 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("mDopCalcRate ") << 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("mDopCalcRate ") << 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("mUfCalcRate ") << 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("mUfCalcRate ") << 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("mUfCalcRate ") << 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("mUfCalcRate ") << 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("mRotorHall ") << 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("mRotorHall ") << 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("mRotorHall ") << 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("mRotorHall ") << 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("mCurrentSetUFRate")<< 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" "2B" "2C")); + QTest::newRow("mCurrentSetUFRate")<< 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" "2B" "2C" "2D")); + QTest::newRow("mCurrentSetUFRate")<< 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" "2B" "2C" "2D" "2E")); + QTest::newRow("mCurrentSetUFRate")<< 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" "2B" "2C" "2D" "2E" "2F")); + } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MOutletFlowData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MOutletFlowData() { @@ -1103,6 +1321,11 @@ case 5: { index = index * sizeof mData._data.mMotorCtlSpeed ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 6: { index = index * sizeof mData._data.mMotorCtlCurrent; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 7: { index = index * sizeof mData._data.mPWMDtCycle ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mDopCorrOffset ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mDopCalcRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mUfCalcRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 11: { index = index * sizeof mData._data.mRotorHall ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 12: { index = index * sizeof mData._data.mCurrentSetUFRate; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; @@ -1115,7 +1338,7 @@ void tst_models::tst_MBloodFlowData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 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")); + QTest::newRow("msg complete ") << 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")); QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -1144,6 +1367,15 @@ QTest::newRow("mPWMDutyCycle ") << 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("mPWMDutyCycle ") << 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("mPWMDutyCycle ") << 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("mRotorCount ") << 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("mRotorCount ") << 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("mRotorCount ") << 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("mRotorCount ") << 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("mPresFlow ") << 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("mPresFlow ") << 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("mPresFlow ") << 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("mPresFlow ") << 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")); + } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MBloodFlowData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MBloodFlowData() { @@ -1169,6 +1401,9 @@ case 5: { index = index * sizeof mData._data.mMotorCtlSpeed ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 6: { index = index * sizeof mData._data.mMotorCtlCurrent; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 7: { index = index * sizeof mData._data.mPWMDutyCycle ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mRotorCount ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mPresFlow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: QVERIFY2(false, "Incorrect Test"); break; @@ -1181,7 +1416,7 @@ void tst_models::tst_MDialysateFlowData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 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")); + QTest::newRow("msg complete ") << 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")); QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -1210,6 +1445,15 @@ QTest::newRow("mPWMDutyCycle ") << 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("mPWMDutyCycle ") << 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("mPWMDutyCycle ") << 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("mRotorCount ") << 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("mRotorCount ") << 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("mRotorCount ") << 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("mRotorCount ") << 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("mPresFlow ") << 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("mPresFlow ") << 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("mPresFlow ") << 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("mPresFlow ") << 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")); + } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDialysateFlowData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MDialysateFlowData() { @@ -1235,6 +1479,9 @@ case 5: { index = index * sizeof mData._data.mMotorCtlSpeed ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 6: { index = index * sizeof mData._data.mMotorCtlCurrent; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 7: { index = index * sizeof mData._data.mPWMDutyCycle ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mRotorCount ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mPresFlow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: QVERIFY2(false, "Incorrect Test"); break; @@ -1293,7 +1540,7 @@ void tst_models::tst_MPressureOcclusionData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 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("msg complete ") << 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("mArterialPressure ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mArterialPressure ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mArterialPressure ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -1306,14 +1553,27 @@ QTest::newRow("mBloodPumpOcclusion ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); QTest::newRow("mBloodPumpOcclusion ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); QTest::newRow("mBloodPumpOcclusion ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); - QTest::newRow("mDialysateInletPumpOcclusion ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); - QTest::newRow("mDialysateInletPumpOcclusion ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); - QTest::newRow("mDialysateInletPumpOcclusion ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); - QTest::newRow("mDialysateInletPumpOcclusion ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); - QTest::newRow("mDialysateOutletPumpOcclusion") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); - QTest::newRow("mDialysateOutletPumpOcclusion") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); - QTest::newRow("mDialysateOutletPumpOcclusion") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); - QTest::newRow("mDialysateOutletPumpOcclusion") << 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("mPressureLimitState ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mPressureLimitState ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mPressureLimitState ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mPressureLimitState ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mArterialLimitLow ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mArterialLimitLow ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mArterialLimitLow ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mArterialLimitLow ") << 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("mArterialLimitHigh ") << 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("mArterialLimitHigh ") << 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("mArterialLimitHigh ") << 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("mArterialLimitHigh ") << 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("mVenousLimitLow ") << 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("mVenousLimitLow ") << 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("mVenousLimitLow ") << 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("mVenousLimitLow ") << 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("mVenousLimitHigh") << 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("mVenousLimitHigh") << 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("mVenousLimitHigh") << 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("mVenousLimitHigh") << 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")); + } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPressureOcclusionData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MPressureOcclusionData() { @@ -1335,8 +1595,12 @@ case 1: { index = index * sizeof mData._data.mArterialPressure ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 2: { index = index * sizeof mData._data.mVenousPressure ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 3: { index = index * sizeof mData._data.mBloodPumpOcclusion ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 4: { index = index * sizeof mData._data.mDialysateInletPumpOcclusion ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 5: { index = index * sizeof mData._data.mDialysateOutletPumpOcclusion; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mPressureLimitState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mArterialLimitLow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mArterialLimitHigh ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mVenousLimitLow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mVenousLimitHigh ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: QVERIFY2(false, "Incorrect Test"); break; @@ -1448,18 +1712,33 @@ void tst_models::tst_MAlarmTriggered_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::addColumn("expectedIndex"); + + // The first 20Bytes of the data is for MAbstractDynamic before getting to the alarm triggered data + const QByteArray front20Bytes = QByteArray("00" "00" "00" "01" + "00" "00" "00" "02" + "00" "00" "00" "03" + "00" "00" "00" "04" + "00" "00" "00" "05" + ); + // 20 front bytes + 3 parameters * 4 bytes + 1 byte ending = 20 + 3*4 + 1 bytes + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(HelperFunctions_tstModel::createByteDataArray(20 + 3*4 + 1))<<0; + + for(int i=0; i< 4; i++) + { + QTest::newRow("mPriority ") << 21 << QByteArray::fromHex(QByteArray().append(front20Bytes).append(HelperFunctions_tstModel::createByteDataArray(i ))) << 20; + QTest::newRow("mRank ") << 22 << QByteArray::fromHex(QByteArray().append(front20Bytes).append(HelperFunctions_tstModel::createByteDataArray(i+4))) << 24; + QTest::newRow("mClearTop ") << 23 << QByteArray::fromHex(QByteArray().append(front20Bytes).append(HelperFunctions_tstModel::createByteDataArray(i+8))) << 28; + } } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmTriggered test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +// This will also test the MAbstractDynamic class' void tst_models::tst_MAlarmTriggered() { Model::MAlarmTriggered mData; QFETCH(int , errorIndex ); QFETCH(QByteArray, data ); + QFETCH(int , expectedIndex ); int startIndex = 0; int index = errorIndex - 1; @@ -1470,15 +1749,146 @@ #endif switch (errorIndex) { - case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 1: { index = index * sizeof mData._data.mAlarmID; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 21: { index = index * sizeof mData._xata.mPriority ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 22: { index = index * sizeof mData._xata.mRank ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 23: { index = index * sizeof mData._xata.mPriority ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + default: QVERIFY2(false, "Incorrect Test"); break; } } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAbstractDynamic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAbstractDynamic data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAbstractDynamic_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::addColumn("expectedIndex"); + QTest::addColumn("expectedParameters"); + + const QByteArray testFieldDescriptor1_U1 = QByteArray("00" "00" "00" "01" // mID + "01" "00" "00" "00" // mFieldDescriptor1 + ); + const QByteArray testFieldDescriptor1_S1 = QByteArray("00" "00" "00" "01" // mID + "02" "00" "00" "00" // mFieldDescriptor1 + ); + const QByteArray testFieldDescriptor1_F1 = QByteArray("00" "00" "00" "01" // mID + "03" "00" "00" "00" // mFieldDescriptor1 + ); + const QByteArray testFieldDescriptor1_BL = QByteArray("00" "00" "00" "01" // mID + "04" "00" "00" "00" // mFieldDescriptor1 + ); + + const QByteArray testFieldDescriptor2 = QByteArray("00" "00" "00" "01" // mID + "01" "00" "00" "00" // mFieldDescriptor1 + "02" "00" "00" "00" // mDataFieldU1 + ); + const QByteArray testFieldDescriptor2_U2 = QByteArray().append(testFieldDescriptor2).append("01" "00" "00" "00"); // mFieldDescriptor2 + const QByteArray testFieldDescriptor2_S2 = QByteArray().append(testFieldDescriptor2).append("02" "00" "00" "00"); // mFieldDescriptor2 + const QByteArray testFieldDescriptor2_F2 = QByteArray().append(testFieldDescriptor2).append("03" "00" "00" "00"); // mFieldDescriptor2 + const QByteArray testFieldDescriptor2_BL = QByteArray().append(testFieldDescriptor2).append("04" "00" "00" "00"); // mFieldDescriptor2 + + // ------------------------------------------------------------------ + // These data set are for testing the incomplete data, getting into the false case of GetValue() + // ------------------------------------------------------------------ + // test 1 to test x does not test MAbstractDynamic's parameters(), thus the expectedParameters are empty + // 20 front bytes + 3 parameters * 4 bytes + 1 byte ending = 20 + 3*4 + 1 bytes + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(HelperFunctions_tstModel::createByteDataArray(20 + 3*4 + 1)) << 0 << QVariantList(); + QTest::newRow("msg mFieldDescriptor2 default Type case") << 1 << QByteArray::fromHex(QByteArray().append(testFieldDescriptor2)).append("00" "00" "00" "00") << 20 << QVariantList(); + QTest::newRow("msg mFieldDescriptor2 None Type case") << 1 << QByteArray::fromHex(QByteArray().append(testFieldDescriptor2).append("00" "00" "00" "00")) << 20 << QVariantList(); + + const int numberIncompleteBytes = 3; // each field has 4 bytes to complete it, to hit the "incomplete" condition, we need to account for 3 front bytes + for(int byteCount = 1; byteCount <= numberIncompleteBytes; byteCount++) + { + QTest::newRow("msg incomplete mID") << 1 << QByteArray::fromHex(HelperFunctions_tstModel::createByteDataArray(byteCount)) << 0 << QVariantList(); + QTest::newRow("msg incomplete mFieldDescriptor1") << 1 << QByteArray::fromHex(HelperFunctions_tstModel::createByteDataArray(byteCount+4)) << 0 << QVariantList(); + + // mFieldDescriptor1 subFields + QTest::newRow("msg incomplete mFieldDescriptor1 mDataFieldU1") << 1 << QByteArray::fromHex(QByteArray().append(testFieldDescriptor1_U1).append(HelperFunctions_tstModel::createByteDataArray(byteCount))) << 0 << QVariantList(); + QTest::newRow("msg incomplete mFieldDescriptor1 mDataFieldS1") << 1 << QByteArray::fromHex(QByteArray().append(testFieldDescriptor1_S1).append(HelperFunctions_tstModel::createByteDataArray(byteCount))) << 0 << QVariantList(); + QTest::newRow("msg incomplete mFieldDescriptor1 mDataFieldF1") << 1 << QByteArray::fromHex(QByteArray().append(testFieldDescriptor1_F1).append(HelperFunctions_tstModel::createByteDataArray(byteCount))) << 0 << QVariantList(); + QTest::newRow("msg incomplete mFieldDescriptor1 mDataFieldBL") << 1 << QByteArray::fromHex(QByteArray().append(testFieldDescriptor1_BL).append(HelperFunctions_tstModel::createByteDataArray(byteCount))) << 0 << QVariantList(); + + // mFieldDescriptor2 subFields + QTest::newRow("msg incomplete mFieldDescriptor2 mDataFieldU1") << 1 << QByteArray::fromHex(QByteArray().append(testFieldDescriptor2_U2).append(HelperFunctions_tstModel::createByteDataArray(byteCount))) << 0 << QVariantList(); + QTest::newRow("msg incomplete mFieldDescriptor2 mDataFieldS1") << 1 << QByteArray::fromHex(QByteArray().append(testFieldDescriptor2_S2).append(HelperFunctions_tstModel::createByteDataArray(byteCount))) << 0 << QVariantList(); + QTest::newRow("msg incomplete mFieldDescriptor2 mDataFieldF1") << 1 << QByteArray::fromHex(QByteArray().append(testFieldDescriptor2_F2).append(HelperFunctions_tstModel::createByteDataArray(byteCount))) << 0 << QVariantList(); + QTest::newRow("msg incomplete mFieldDescriptor2 mDataFieldBL") << 1 << QByteArray::fromHex(QByteArray().append(testFieldDescriptor2_BL).append(HelperFunctions_tstModel::createByteDataArray(byteCount))) << 0 << QVariantList(); + } + + // ------------------------------------------------------------------ + // These data set are for testing the parameters() unreached cases + // ------------------------------------------------------------------ + quint32 zero = 0; + QVariantList testParameterFieldDescriptor2; + testParameterFieldDescriptor2 << 16777216 // mID + << 1 // mFieldDescriptor1 + << 2 // mDataFieldU1 + << zero << zero // values added for the default case in the field type switch statement + << zero << zero << zero; // the rank, priority, and cleartop + QTest::newRow("msg parameters - mFieldDescriptor2 none Type case") << 2 << QByteArray::fromHex(QByteArray().append(testFieldDescriptor2).append("00" "00" "00" "00")) << 20 << testParameterFieldDescriptor2; + QTest::newRow("msg parameters - mFieldDescriptor2 default Type case") << 2 << QByteArray::fromHex(QByteArray().append(testFieldDescriptor2).append("00" "00" "00" "01")) << 20 << testParameterFieldDescriptor2; + + QVariantList testParameterFieldDescriptor1; + testParameterFieldDescriptor1 << 16777216 // mID + << zero // mFieldDescriptor1 + << zero << zero << zero // values added for the default case in the field type switch statement + << zero << zero << zero; // the rank, priority, and cleartop + QTest::newRow("msg parameters - mFieldDescriptor1 default Type case") << 2 << QByteArray::fromHex(QByteArray("00" "00" "00" "01" // mID + "00" "00" "00" "01" // mFieldDescriptor1 + )) << 20 << testParameterFieldDescriptor1; + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAbstractDynamic test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +// Will be testing MAbstractDynamic using MAlarmTriggered since MAlarmTriggered derives from MAbstractDynamic +void tst_models::tst_MAbstractDynamic() { + Model::MAlarmTriggered mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + QFETCH(int , expectedIndex ); + QFETCH(QVariantList, expectedParameters); + + 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 is for "complete" data tests + case 0: { QVERIFY ( mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + + // case 1 is for "incomplete" data tests / partial byte set (ie: 3 bytes of 4 bytes of U32 exists) + case 1: { QVERIFY ( !mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + + // case 2 is testing parameters() call + case 2: + { + const QVariantList list = mData.parameters(); + bool sameLength = list.length() == expectedParameters.length(); + QVERIFY (sameLength); + if(sameLength){ + for(int i=0; i < mData.parameters().length(); i++) + { + QVERIFY(list.at(i) == expectedParameters.at(i)); + } + } + + } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmCleared ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmCleared data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MAlarmCleared_data () { @@ -1519,81 +1929,26 @@ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentParametersResp data definition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MTreatmentParametersResp_data() { - QTest::addColumn("errorIndex"); - QTest::addColumn("data"); - QTest::newRow("msg complete") << 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" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" "40" "41" "42" "43" "44" "45" "46" "47" "48")); - QTest::newRow("requestValid") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("requestValid") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("requestValid") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("requestValid") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); - QTest::newRow("bloodFlowRate") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" )); - QTest::newRow("bloodFlowRate") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); - QTest::newRow("bloodFlowRate") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); - QTest::newRow("bloodFlowRate") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); - QTest::newRow("dialysateFlowRate") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("dialysateFlowRate") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("dialysateFlowRate") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("dialysateFlowRate") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); - QTest::newRow("duration") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); - QTest::newRow("duration") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); - QTest::newRow("duration") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); - QTest::newRow("duration") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); - QTest::newRow("heparinDispensingRate") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); - QTest::newRow("heparinDispensingRate") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); - QTest::newRow("heparinDispensingRate") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); - QTest::newRow("heparinDispensingRate") << 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("heparinBolusVolume") << 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("heparinBolusVolume") << 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("heparinBolusVolume") << 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("heparinBolusVolume") << 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("heparinStopTime") << 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("heparinStopTime") << 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("heparinStopTime") << 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("heparinStopTime") << 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("salineBolus") << 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("salineBolus") << 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("salineBolus") << 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("salineBolus") << 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("acidConcentrate") << 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("acidConcentrate") << 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("acidConcentrate") << 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("acidConcentrate") << 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("bicarbonateConcentrate") << 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("bicarbonateConcentrate") << 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("bicarbonateConcentrate") << 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("bicarbonateConcentrate") << 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("dialyzerType") << 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("dialyzerType") << 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("dialyzerType") << 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("dialyzerType") << 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("dialysateTemp") << 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" "2B" "2C")); - QTest::newRow("dialysateTemp") << 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" "2B" "2C" "2D")); - QTest::newRow("dialysateTemp") << 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" "2B" "2C" "2D" "2E")); - QTest::newRow("dialysateTemp") << 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" "2B" "2C" "2D" "2E" "2F")); - QTest::newRow("arterialPressureLimitLow") << 13 << 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" "2B" "2C" "2D" "2E" "2F" "30")); - QTest::newRow("arterialPressureLimitLow") << 13 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31")); - QTest::newRow("arterialPressureLimitLow") << 13 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32")); - QTest::newRow("arterialPressureLimitLow") << 13 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33")); - QTest::newRow("arterialPressureLimitHigh") << 14 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34")); - QTest::newRow("arterialPressureLimitHigh") << 14 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35")); - QTest::newRow("arterialPressureLimitHigh") << 14 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36")); - QTest::newRow("arterialPressureLimitHigh") << 14 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37")); - QTest::newRow("venousPressureLimitLow") << 15 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38")); - QTest::newRow("venousPressureLimitLow") << 15 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39")); - QTest::newRow("venousPressureLimitLow") << 15 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A")); - QTest::newRow("venousPressureLimitLow") << 15 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B")); - QTest::newRow("venousPressureLimitHigh") << 16 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C")); - QTest::newRow("venousPressureLimitHigh") << 16 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D")); - QTest::newRow("venousPressureLimitHigh") << 16 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E")); - QTest::newRow("venousPressureLimitHigh") << 16 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F")); - QTest::newRow("bloodPressureMeasureInterval") << 17 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" "40")); - QTest::newRow("bloodPressureMeasureInterval") << 17 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" "40" "41")); - QTest::newRow("bloodPressureMeasureInterval") << 17 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" "40" "41" "42")); - QTest::newRow("bloodPressureMeasureInterval") << 17 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" "40" "41" "42" "43")); - QTest::newRow("rinsebackFlowRate") << 18 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" "40" "41" "42" "43" "44")); - QTest::newRow("rinsebackFlowRate") << 18 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" "40" "41" "42" "43" "44" "45")); - QTest::newRow("rinsebackFlowRate") << 18 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" "40" "41" "42" "43" "44" "45" "46")); - QTest::newRow("rinsebackFlowRate") << 18 << 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" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" "40" "41" "42" "43" "44" "45" "46" "47")); + HelperFunctions_tstModel::generate_ByteDataSet( { + "mAccepted ", + "mBloodFlowRate ", + "mDialysateFlowRate ", + "mDuration ", + "mHeparinStopTime ", + "mSalineBolus ", + "mAcidConcentrate ", + "mBicarbonateConcentrate ", + "mDialyzerType ", + "mHeparinType ", + "mBloodPressureMeasureInterval ", + "mRinsebackFlowRate ", + "mArterialPressureLimitWindow ", + "mVenousPressureLimitWindow ", + "mVenousPressureLimitAsymtrc ", + "mHeparinDispensingRate ", + "mHeparinBolusVolume ", + "mDialysateTemp " + }); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentParametersResp test definition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @@ -1617,33 +1972,34 @@ << "data: " << data; #endif switch (errorIndex) { - case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 1: { index = index * sizeof mData._data.requestValid ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 2: { index = index * sizeof mData._data.bloodFlowRate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 3: { index = index * sizeof mData._data.dialysateFlowRate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 4: { index = index * sizeof mData._data.duration ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 5: { index = index * sizeof mData._data.heparinDispensingRate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 6: { index = index * sizeof mData._data.heparinBolusVolume ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 7: { index = index * sizeof mData._data.heparinStopTime ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 8: { index = index * sizeof mData._data.salineBolus ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 9: { index = index * sizeof mData._data.acidConcentrate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 10: { index = index * sizeof mData._data.bicarbonateConcentrate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 11: { index = index * sizeof mData._data.dialyzerType ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 12: { index = index * sizeof mData._data.dialysateTemp ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 13: { index = index * sizeof mData._data.arterialPressureLimitLow ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 14: { index = index * sizeof mData._data.arterialPressureLimitHigh ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 15: { index = index * sizeof mData._data.venousPressureLimitLow ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 16: { index = index * sizeof mData._data.venousPressureLimitHigh ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 17: { index = index * sizeof mData._data.bloodPressureMeasureInterval ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 18: { index = index * sizeof mData._data.rinsebackFlowRate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + 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.mBloodFlowRate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 3: { index = index * sizeof mData._data.mDialysateFlowRate ; 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.mHeparinStopTime ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 6: { index = index * sizeof mData._data.mSalineBolus ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 7: { index = index * sizeof mData._data.mAcidConcentrate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 8: { index = index * sizeof mData._data.mBicarbonateConcentrate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 9: { index = index * sizeof mData._data.mDialyzerType ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 10: { index = index * sizeof mData._data.mHeparinType ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 11: { index = index * sizeof mData._data.mBloodPressureMeasureInterval ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 12: { index = index * sizeof mData._data.mRinsebackFlowRate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 13: { index = index * sizeof mData._data.mArterialPressureLimitWindow ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 14: { index = index * sizeof mData._data.mVenousPressureLimitWindow ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 15: { index = index * sizeof mData._data.mVenousPressureLimitAsymtrc ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 16: { index = index * sizeof mData._data.mHeparinDispensingRate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 17: { index = index * sizeof mData._data.mHeparinBolusVolume ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 18: { index = index * sizeof mData._data.mDialysateTemp ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + default: QVERIFY2(false, "Incorrect Test"); break; } } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentSalineBolusData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentSalineBolusData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentmSalineBolusData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentmSalineBolusData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MTreatmentSalineBolusData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); @@ -1661,7 +2017,7 @@ QTest::newRow("mDelivered ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); QTest::newRow("mDelivered ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentSalineBolusData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentmSalineBolusData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MTreatmentSalineBolusData() { Model::MTreatmentSaline mData; @@ -1699,6 +2055,11 @@ QTest::newRow("mCumulative ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mCumulative ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); QTest::newRow("mCumulative ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mTarget ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mTarget ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mTarget ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mTarget ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentHeparinData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MTreatmentHeparinData() { @@ -1719,6 +2080,7 @@ switch (errorIndex) { case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 1: { index = index * sizeof mData._data.mCumulative; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mTarget ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; @@ -1773,14 +2135,14 @@ QTest::addColumn("errorIndex"); QTest::addColumn("data"); QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("startTreatmentResponse ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("startTreatmentResponse ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("startTreatmentResponse ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("startTreatmentResponse ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); - QTest::newRow("startTreatmentRejectReason") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("startTreatmentRejectReason") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); - QTest::newRow("startTreatmentRejectReason") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); - QTest::newRow("startTreatmentRejectReason") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + 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")); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustInitTreatmentResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // @@ -1800,161 +2162,2172 @@ #endif switch (errorIndex) { - case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 1: { index = index * sizeof mData._data.startTreatmentResponse ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 2: { index = index * sizeof mData._data.startTreatmentRejectReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + 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; default: QVERIFY2(false, "Incorrect Test"); break; } } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MEndTreatmentResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MEndTreatmentResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MEndTreatmentResponse_data () { +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MmSalineBolusResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MmSalineBolusResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHeparinResponse_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("endTreatmentResponse") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("endTreatmentResponse") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("endTreatmentResponse") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("endTreatmentResponse") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("msg complete") << 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")); } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHeparinResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHeparinResponse() { + Model::MAdjustHeparinResponse mData; -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MEndTreatmentResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MEndTreatmentResponse() { - Model::MEndTreatmentResponse 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.endTreatmentResponse ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + 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; default: QVERIFY2(false, "Incorrect Test"); break; } } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MSalineBolusResponse_data () { +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustTreatmentLogResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustTreatmentLogResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustTreatmentLogResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { + "mAccepted" , + "mReason" , + "mBloodFlowRate" , + "mDialysateFlowRate" , + "mTreatmentDuration" , + "mActualTreatmentDuration" , + "mAcidConcentrateType" , + "mBicarbonateConcentrateType", + "mPotassiumConcentration" , + "mCalciumConcentration" , + "mBicarbonateConcentration" , + "mSodiumConcentration" , + "mDialysateTemperature" , + "mDialyzerType" , + "mTreatmentStartEpoch" , + "mTreatmentEndEpoch" , + "mAverageBloodFlow" , + "mAverageDialysateFlow" , + "mDialysateVolumeUsed" , + "mAverageDialysateTemp" , + "mOriginUFVolume" , + "mTargetUFVolume" , + "mActualUFVolume" , + "mOriginUFRate" , + "mTargetUFRate" , + "mActualUFRate" , + "mSalineBolusVolume" , + "mHeparinBolusVolume" , + "mHeparinDispenseRate" , + "mHeparinStop" , + "mHeparinDeliveredVolume" , + "mHeparinType" , + "mAverageArterialPressure" , + "mAverageVenousPressure" , + "mDeviceID" , + "mWaterSampleTestResult" + }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustTreatmentLogResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustTreatmentLogResponse() { + Model::MAdjustTreatmentLogResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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.mBloodFlowRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mDialysateFlowRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mTreatmentDuration ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mActualTreatmentDuration ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mAcidConcentrateType ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mBicarbonateConcentrateType; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mPotassiumConcentration ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mCalciumConcentration ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 11: { index = index * sizeof mData._data.mBicarbonateConcentration; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 12: { index = index * sizeof mData._data.mSodiumConcentration ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 13: { index = index * sizeof mData._data.mDialysateTemperature ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 14: { index = index * sizeof mData._data.mDialyzerType ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 15: { index = index * sizeof mData._data.mTreatmentStartEpoch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 16: { index = index * sizeof mData._data.mTreatmentEndEpoch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 17: { index = index * sizeof mData._data.mAverageBloodFlow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 18: { index = index * sizeof mData._data.mAverageDialysateFlow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 19: { index = index * sizeof mData._data.mDialysateVolumeUsed ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 20: { index = index * sizeof mData._data.mAverageDialysateTemp ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 21: { index = index * sizeof mData._data.mOriginUFVolume ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 22: { index = index * sizeof mData._data.mTargetUFVolume ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 23: { index = index * sizeof mData._data.mActualUFVolume ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 24: { index = index * sizeof mData._data.mOriginUFRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 25: { index = index * sizeof mData._data.mTargetUFRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 26: { index = index * sizeof mData._data.mActualUFRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 27: { index = index * sizeof mData._data.mSalineBolusVolume ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 28: { index = index * sizeof mData._data.mHeparinBolusVolume ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 29: { index = index * sizeof mData._data.mHeparinDispenseRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 30: { index = index * sizeof mData._data.mHeparinStop ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 31: { index = index * sizeof mData._data.mHeparinDeliveredVolume ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 32: { index = index * sizeof mData._data.mHeparinType ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 33: { index = index * sizeof mData._data.mAverageArterialPressure ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 34: { index = index * sizeof mData._data.mAverageVenousPressure ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 35: { index = index * sizeof mData._data.mDeviceID ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 36: { index = index * sizeof mData._data.mWaterSampleTestResult ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDSyringePump ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDSyringePump data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDSyringePump_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { + "mSyringePumpState " , + "mHeparinState" , + "mSetRate" , + "mMeasuredRate" , + "mSyringePumpPosition" , + "mVolumeDelivered" , + "mMeasuredHome" , + "mMeasuredSwitch" , + "mMeasuredForce" , + "mSafetyVol" , + "mStatus" + }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDSyringePump test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDSyringePump() { + Model::MHDSyringePump 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mSyringePumpState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mHeparinState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mSetRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mMeasuredRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mSyringePumpPosition ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mVolumeDelivered ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mMeasuredHome ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mMeasuredSwitch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mMeasuredForce ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mSafetyVol ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 11: { index = index * sizeof mData._data.mStatus ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDBloodLeakData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDBloodLeakData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MHDBloodLeakData_data () { + HelperFunctions_tstModel::generate_ByteDataSet({"mBloodLeakStatus", "mBloodLeakState"}); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDBloodLeakData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDBloodLeakData() { + Model::MHDBloodLeakData 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mBloodLeakStatus ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mBloodLeakState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDAirTrapData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDAirTrapData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MHDAirTrapData_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAirTrapLowerLevel", "mAirTrapUpperLevel" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDAirTrapData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDAirTrapData() { + Model::MHDAirTrapData 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAirTrapLowerLevel ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mAirTrapUpperLevel ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDAccelerometer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDAccelerometer data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MHDAccelerometer_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { + "mX" , + "mY" , + "mZ" , + "mXMax" , + "mYMax" , + "mZMax" , + "mXTilt", + "mYTilt", + "mZTilt" + }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDAccelerometer test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDAccelerometer() { + Model::MHDAccelerometer 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mX ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mY ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mZ ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mXMax ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mYMax ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mZMax ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mXTilt; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mYTilt; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mZTilt; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDUsageInfoResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDUsageInfoResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MHDUsageInfoResponse_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete") << 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("mTarget ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mTarget ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("mTarget ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("mTarget ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::addColumn("expectedIndex"); + + int errorIndex = 1; + int lastCount = 0; + + // The "msg complete" has a total of 4*4+2 bytes since four 32-bits (or 4-bytes) and one 16-bits ( or 2 byte) + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(HelperFunctions_tstModel::createByteDataArray(4*4+2))<< 0; + + // These parameters are U32 + lastCount = HelperFunctions_tstModel::addRowsForByteData("mTotalTxHours ", errorIndex, 0, (errorIndex-1)*4); errorIndex++; + lastCount = HelperFunctions_tstModel::addRowsForByteData("mTotalTxHoursSinceLastService ", errorIndex, lastCount+1, (errorIndex-1)*4); errorIndex++; + lastCount = HelperFunctions_tstModel::addRowsForByteData("mEpochOfStartOfLastTx ", errorIndex, lastCount+1, (errorIndex-1)*4); errorIndex++; + lastCount = HelperFunctions_tstModel::addRowsForByteData("mEpochOfLastRecordReset ", errorIndex, lastCount+1, (errorIndex-1)*4); errorIndex++; + + // This parameter is U16 + // This function adds eight 1-bit incremented rows. + lastCount = HelperFunctions_tstModel::addTestDataRow_bitRows("mCrc", errorIndex, (errorIndex-1)*4*8, (errorIndex-1)*4); + + return; } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MSalineBolusResponse() { - Model::MAdjustSalineResponse mData; +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDUsageInfoResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDUsageInfoResponse() { + Model::MHDUsageInfoResponse mData; + QFETCH(int , errorIndex ); QFETCH(QByteArray, data ); + QFETCH(int , expectedIndex ); int startIndex = 0; int index = errorIndex - 1; bool ok = mData.fromByteArray(data, &startIndex); Q_UNUSED(ok) #ifdef CONSOLEOUT - qDebug() << index << errorIndex << startIndex << ok << data ; + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; #endif switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mTotalTxHours ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mTotalTxHoursSinceLastService ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mEpochOfStartOfLastTx ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mEpochOfLastRecordReset ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mCrc ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDAirBubbleData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDAirBubbleData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MHDAirBubbleData_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mVenousAirBubbleStatus", "mVenousAirBubbleState" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDAirBubbleData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDAirBubbleData() { + Model::MHDAirBubbleData 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mVenousAirBubbleStatus ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mVenousAirBubbleState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPreTreatmentStates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPreTreatmentStates data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MPreTreatmentStates_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { + "mSubMode" , + "mWaterSampleState" , + "mSelfTestConsumablesState" , + "mSelfTestNoCartridgeState" , + "mInstallationState" , + "mSelfTestDryState" , + "mPrimeState" , + "mRecirculateState" , + "mPatientConnectionState" , + "mWetSelfTestsState" , + "mPreTreatmentRsrvrState" + }); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPreTreatmentStates test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MPreTreatmentStates() { + Model::MPreTreatmentStates 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mSubMode ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mWaterSampleState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mSelfTestConsumablesState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mSelfTestNoCartridgeState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mInstallationState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mSelfTestDryState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mPrimeState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mRecirculateState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mPatientConnectionState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mWetSelfTestsState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 11: { index = index * sizeof mData._data.mPreTreatmentRsrvrState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPreTreatmentSelfTestNoCartridge ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPreTreatmentSelfTestNoCartridge data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MPreTreatmentSelfTestNoCartridge_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mTimeout", "mCountdown" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPreTreatmentSelfTestNoCartridge test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MPreTreatmentSelfTestNoCartridge() { + Model::MPreTreatmentSelfTestNoCartridge 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mTimeout ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mCountdown; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPreTreatmentSelfTestDry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPreTreatmentSelfTestDry data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MPreTreatmentSelfTestDry_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mTimeout", "mCountdown" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPreTreatmentSelfTestDry test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MPreTreatmentSelfTestDry() { + Model::MPreTreatmentSelfTestDry 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mTimeout ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mCountdown; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPostTreatmentStates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPostTreatmentStates data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MPostTreatmentStates_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mSubMode ", "mDrainState" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPostTreatmentStates test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MPostTreatmentStates() { + Model::MPostTreatmentStates 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mSubMode ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mDrainState; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentStop ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentStop data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MTreatmentStop_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mTotal", "mCountDown" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentStop test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentStop() { + Model::MTreatmentStop 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mTotal ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mCountDown; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentRinseback ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentRinseback data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MTreatmentRinseback_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { + "mTarget " , + "mCurrent" , + "mRate" , + "mTimeoutTotal" , + "mTimeoutCountDown" , + "mIsCompleted" + }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentRinseback test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentRinseback() { + Model::MTreatmentRinseback 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mTarget ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mCurrent ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mTimeoutTotal ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mTimeoutCountDown ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mIsCompleted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentRecirculate ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentRecirculate data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MTreatmentRecirculate_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mTimeoutTotal", "mTimeoutCountDown" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentRecirculate test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentRecirculate() { + Model::MTreatmentRecirculate 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mTimeoutTotal ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mTimeoutCountDown ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentBloodPrime ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentBloodPrime data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MTreatmentBloodPrime_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mTarget", "mCurrent" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentBloodPrime test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentBloodPrime() { + Model::MTreatmentBloodPrime 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mTarget ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mCurrent ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentLogEventData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentLogEventData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MTreatmentLogEventData_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { + "mEventID" , + "mOldValue" , + "mNewValue" + }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentLogEventData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentLogEventData() { + Model::MTreatmentLogEventData 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mEventID ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mOldValue ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mNewValue ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentLogAvrgeData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentLogAvrgeData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MTreatmentLogAvrgeData_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { + "mBloodFlowRate" , + "mDialysateFlowRate", + "mUFRate" , + "mArterialPressure" , + "mVenousPressure" + }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentLogAvrgeData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentLogAvrgeData() { + Model::MTreatmentLogAvrgeData 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mBloodFlowRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mDialysateFlowRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mUFRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mArterialPressure ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mVenousPressure ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentLogAlarmData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentLogAlarmData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MTreatmentLogAlarmData_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { + "mAlarmID", + "mParam1" , + "mParam2" + } ); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentLogAlarmData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentLogAlarmData() { + Model::MTreatmentLogAlarmData 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAlarmID ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mParam1 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mParam2 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDRTCEpochData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDRTCEpochData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MHDRTCEpochData_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mEpoch" }); +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDRTCEpochData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDRTCEpochData() { + Model::MHDRTCEpochData 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mEpoch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDPostSingleResult ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDPostSingleResult data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDPostSingleResult_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mResult", "mIndex" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDPostSingleResult test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDPostSingleResult() { + Model::MHDPostSingleResult 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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.mTarget ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mResult ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mIndex ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: QVERIFY2(false, "Incorrect Test"); break; } } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MHeparinResponse_data () { +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDPostFinalResult ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDPostFinalResult data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDPostFinalResult_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mResult"}); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDPostFinalResult test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDPostFinalResult() { + Model::MHDPostFinalResult 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mResult ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustHDAlarmVolumeResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustHDAlarmVolumeResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustHDAlarmVolumeResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason"}); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustHDAlarmVolumeResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustHDAlarmVolumeResponse() { + Model::MAdjustHDAlarmVolumeResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustHDDateTimeResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustHDDateTimeResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustHDDateTimeResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason"}); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustHDDateTimeResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustHDDateTimeResponse() { + Model::MAdjustHDDateTimeResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustServiceModeResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustServiceModeResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustServiceModeResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason"}); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustServiceModeResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustServiceModeResponse() { + Model::MAdjustServiceModeResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustVersionsHDResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustVersionsHDResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustVersionsHDResponse_data () { + QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete") << 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::addColumn("expectedIndex"); + + int errorIndex = 1; + + // The "msg complete" has a total of 9+4 bytes since nine u8 (or 1-bytes) and one U32 ( or 4 bytes) + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(HelperFunctions_tstModel::createByteDataArray(9+4))<< 0; + + QTest::newRow("mMajor") << errorIndex << QByteArray() << 0; + int currentBit = 1; + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mMajor ", errorIndex++, currentBit, 1); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mMinor ", errorIndex++, currentBit, 2); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mMicro ", errorIndex++, currentBit, 3); + + // mBuild is U16, this requires us to add two sets of 8-bits. + // The first set of 8-bit, the expected index is data-index less 1 since it's not possible to get the full 16-bits + // yet. When we add the second byte's bits, the expected index is 5 since we are handling full bytes not partials + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mBuild ", errorIndex++, currentBit, 3); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mBuild ", errorIndex++, currentBit, 5); + + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mFPGAId ", errorIndex++, currentBit, 6); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mFPGAMajor ", errorIndex++, currentBit, 7); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mFPGAMinor ", errorIndex++, currentBit, 8); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mFPGALab ", errorIndex++, currentBit, 9); + + // U32 parameter - expecting one short to check for "false" case only + (void) HelperFunctions_tstModel::addRowsForByteData("mCompatibilityRev", errorIndex, currentBit/8, 9); } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHeparinResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MHeparinResponse() { - Model::MAdjustHeparinResponse mData; +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustVersionsHDResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustVersionsHDResponse() { + Model::MAdjustVersionsHDResponse mData; QFETCH(int , errorIndex ); QFETCH(QByteArray, data ); + QFETCH(int , expectedIndex ); int startIndex = 0; + int index = errorIndex; // Note: this is not being use in test, but only to show which param is being checked + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) + +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mMicro ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mMicro ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mMicro ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mBuild ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mFPGAId ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mFPGAMajor; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mFPGAMinor; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mFPGALab ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mFPGALab ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mCompatibilityRev ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustServiceDatesHDResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustServiceDatesHDResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustServiceDatesHDResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mLastServiceDateEpoch", "mServiceIntervalSeconds" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustServiceDatesHDResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustServiceDatesHDResponse() { + Model::MAdjustServiceDatesHDResponse 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 ; + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mLastServiceDateEpoch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mServiceIntervalSeconds ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: QVERIFY2(false, "Incorrect Test"); break; } } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustRinsebackResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustRinsebackResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustRinsebackResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustRinsebackResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustRinsebackResponse() { + Model::MAdjustRinsebackResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustRecirculateResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustRecirculateResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustRecirculateResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustRecirculateResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustRecirculateResponse() { + Model::MAdjustRecirculateResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustTreatmentEndResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustTreatmentEndResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustTreatmentEndResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustTreatmentEndResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustTreatmentEndResponse() { + Model::MAdjustTreatmentEndResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustSalineResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustSalineResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustSalineResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason", "mTarget"}); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustSalineResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustSalineResponse() { + Model::MAdjustSalineResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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.mTarget ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustWaterSampleResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustWaterSampleResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustWaterSampleResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustWaterSampleResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustWaterSampleResponse() { + Model::MAdjustWaterSampleResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustStartTreatmentResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustStartTreatmentResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustStartTreatmentResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustStartTreatmentResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustStartTreatmentResponse() { + Model::MAdjustStartTreatmentResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientConnectionConfirmResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientConnectionConfirmResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustPatientConnectionConfirmResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientConnectionConfirmResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustPatientConnectionConfirmResponse() { + Model::MAdjustPatientConnectionConfirmResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientConnectionBeginResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientConnectionBeginResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustPatientConnectionBeginResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientConnectionBeginResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustPatientConnectionBeginResponse() { + Model::MAdjustPatientConnectionBeginResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesPrimeResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesPrimeResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisposablesPrimeResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesPrimeResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisposablesPrimeResponse() { + Model::MAdjustDisposablesPrimeResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesConfirmResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesConfirmResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisposablesConfirmResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesConfirmResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisposablesConfirmResponse() { + Model::MAdjustDisposablesConfirmResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisinfectStartResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisinfectStartResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisinfectStartResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisinfectStartResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisinfectStartResponse() { + Model::MAdjustDisinfectStartResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisinfectModeResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisinfectModeResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisinfectModeResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisinfectModeResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisinfectModeResponse() { + Model::MAdjustDisinfectModeResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientDisconnectionConfirmResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientDisconnectionConfirmResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustPatientDisconnectionConfirmResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientDisconnectionConfirmResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustPatientDisconnectionConfirmResponse() { + Model::MAdjustPatientDisconnectionConfirmResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesRemovalConfirmResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesRemovalConfirmResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisposablesRemovalConfirmResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesRemovalConfirmResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisposablesRemovalConfirmResponse() { + Model::MAdjustDisposablesRemovalConfirmResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmActiveListResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmActiveListResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MAlarmActiveListResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { + "mAccepted" , + "mReason" , + "mAlarmID0" , + "mAlarmID1" , + "mAlarmID2" , + "mAlarmID3" , + "mAlarmID4" , + "mAlarmID5" , + "mAlarmID6" , + "mAlarmID7" , + "mAlarmID8" , + "mAlarmID9" + }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmActiveListResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAlarmActiveListResponse() { + Model::MAlarmActiveListResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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.mAlarmID0 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mAlarmID1 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mAlarmID2 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mAlarmID3 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mAlarmID4 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mAlarmID5 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mAlarmID6 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mAlarmID7 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 11: { index = index * sizeof mData._data.mAlarmID8 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 12: { index = index * sizeof mData._data.mAlarmID9 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmClearedCondition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmClearedCondition data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAlarmClearedCondition_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAlarmID" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAlarmClearedCondition test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAlarmClearedCondition() { + Model::MAlarmClearedCondition 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAlarmID ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDGCleaningUsageResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDGCleaningUsageResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MAdjustDGCleaningUsageResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { + "mRoWaterGenTotalL" , + "mRoWaterGenSinceLastServiceL" , + "mLastBasicFlushCompleteDateEpoch" , + "mLastChemDisStartDateEpoch" , + "mLastChemDisCompleteDateEpoch" , + "mLastChemDisFlushCompleteDateEpoch" , + "mLastHeatDisCompleteDateEpoch" , + "mLastHeatActiveCoolCompleteDateEpoch" , + "mLastFilterFlushCompleteDateEpoch" , + "mLastResetTimeEpoch" + }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDGCleaningUsageResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDGCleaningUsageResponse() { + Model::MAdjustDGCleaningUsageResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mRoWaterGenTotalL ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mRoWaterGenSinceLastServiceL ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mLastBasicFlushCompleteDateEpoch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mLastChemDisStartDateEpoch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mLastChemDisCompleteDateEpoch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mLastChemDisFlushCompleteDateEpoch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mLastHeatDisCompleteDateEpoch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mLastHeatActiveCoolCompleteDateEpoch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mLastFilterFlushCompleteDateEpoch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mLastResetTimeEpoch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDGDateTimeResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDGDateTimeResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDGDateTimeResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDGDateTimeResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDGDateTimeResponse() { + Model::MAdjustDGDateTimeResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustServiceDatesDGResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustServiceDatesDGResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustServiceDatesDGResponse_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mLastServiceDateEpoch", "mServiceIntervalSeconds" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustServiceDatesDGResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustServiceDatesDGResponse() { + Model::MAdjustServiceDatesDGResponse 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mLastServiceDateEpoch ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mServiceIntervalSeconds ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustVersionsDGResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustVersionsDGResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MAdjustVersionsDGResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::addColumn("expectedIndex"); + + // int lastFlag = 0; + int errorIndex = 1; + + // The "msg complete" has a total of 9+4 bytes since nine u8 (or 1-bytes) and one U32 ( or 4 bytes) + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(HelperFunctions_tstModel::createByteDataArray(9+4))<< 0; + + QTest::newRow("mMajor") << errorIndex << QByteArray() << 0; + int currentBit = 1; + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mMajor ", errorIndex++, currentBit, 1); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mMinor ", errorIndex++, currentBit, 2); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mMicro ", errorIndex++, currentBit, 3); + + // mBuild is U16, this requires us to add two sets of 8-bits. + // The first set of 8-bit, the expected index is data-index less 1 since it's not possible to get the full 16-bits + // yet. When we add the second byte's bits, the expected index is 5 since we are handling full bytes not partials + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mBuild ", errorIndex++, currentBit, 3); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mBuild ", errorIndex++, currentBit, 5); + + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mFPGAId ", errorIndex++, currentBit, 6); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mFPGAMajor ", errorIndex++, currentBit, 7); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mFPGAMinor ", errorIndex++, currentBit, 8); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mFPGALab ", errorIndex++, currentBit, 9); + + // U32 parameter - expecting one short to check for "false" case only + (void) HelperFunctions_tstModel::addRowsForByteData("mCompatibilityRev", errorIndex, currentBit/8, 9); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustVersionsDGResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustVersionsDGResponse() { + Model::MAdjustVersionsDGResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + QFETCH(int , expectedIndex ); + + int startIndex = 0; + int index = errorIndex; // Note: this is not being use in test, but only to show which param is being checked + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) + +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mMicro ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mMicro ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mMicro ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mBuild ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mFPGAId ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mFPGAMajor; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mFPGAMinor; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mFPGALab ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mFPGALab ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mCompatibilityRev ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDuetRoWaterModeDGr ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDuetRoWaterModeDGr data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDuetRoWaterModeDGr_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mAccepted" , "mReason" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDuetRoWaterModeDGr test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDuetRoWaterModeDGr() { + Model::MDuetRoWaterModeDGr 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< 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; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGConductivityData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGConductivityData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MDGConductivityData_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mRORejectionRatio" , + "mCPi" , + "mCPo" , + "mCD1" , + "mCD2" , + "mCPiRaw" , + "mCPoRaw" , + "mCD1Raw" , + "mCD2Raw" , + "mCPiSensorStatus" , + "mCPoSensorStatus" , + "mCD1SensorStatus" , + "mCD2SensorStatus" + }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGConductivityData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDGConductivityData() { + Model::MDGConductivityData 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mRORejectionRatio ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mCPi ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mCPo ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mCD1 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mCD2 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mCPiRaw ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mCPoRaw ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mCD1Raw ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mCD2Raw ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mCPiSensorStatus ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 11: { index = index * sizeof mData._data.mCPoSensorStatus ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 12: { index = index * sizeof mData._data.mCD1SensorStatus ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 13: { index = index * sizeof mData._data.mCD2SensorStatus ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGAccelerometer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGAccelerometer data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDGAccelerometer_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mX" , + "mY" , + "mZ" , + "mXMax" , + "mYMax" , + "mZMax" , + "mXTilt", + "mYTilt", + "mZTilt" + }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGAccelerometer test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDGAccelerometer() { + Model::MDGAccelerometer 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mX ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mY ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mZ ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mXMax ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mYMax ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mZMax ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mXTilt; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mYTilt; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mZTilt; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGFilterFlush ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGFilterFlush data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDGFilterFlush_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mTimeout", "mCountdown" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGFilterFlush test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDGFilterFlush() { + Model::MDGFilterFlush 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mTimeout ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mCountdown ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGPostSingleResult ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGPostSingleResult data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDGPostSingleResult_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mResult", "mIndex" }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGPostSingleResult test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDGPostSingleResult() { + Model::MDGPostSingleResult 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mResult ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mIndex ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGPostFinalResult ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGPostFinalResult data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDGPostFinalResult_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mResult"}); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDGPostFinalResult test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDGPostFinalResult() { + Model::MDGPostFinalResult 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mResult ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MUIBloodPressure ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MUIBloodPressure data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MUIBloodPressure_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::addColumn("expectedIndex"); + + // int lastFlag = 0; + int errorIndex = 1; + + // The "msg complete" has a total of 7*1 + 6*2 ( seven 1-byte and six 2-byte parameters) + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(HelperFunctions_tstModel::createByteDataArray(7*1 + 6*2))<< 0; + + QTest::newRow("mMajor") << errorIndex << QByteArray() << 0; + int currentBit = 1; + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mFlags ", errorIndex++, currentBit, 1); + + // mBuild is U16, this requires us to add two sets of 8-bits. + // The first set of 8-bit, the expected index is data-index less 1 since it's not possible to get the full 16-bits + // yet. When we add the second byte's bits, the expected index is 5 since we are handling full bytes not partials + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mSystolic ", errorIndex, currentBit, 1); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mSystolic ", errorIndex++, currentBit, 3); + + // U16 + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mDiastolic ", errorIndex, currentBit, 3); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mDiastolic ", errorIndex++, currentBit, 5); + + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mMeanArterial ", errorIndex, currentBit, 5); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mMeanArterial ", errorIndex++, currentBit, 7); + + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mYear ", errorIndex, currentBit, 7); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mYear ", errorIndex++, currentBit, 9); + + // U8 + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mMonth ", errorIndex++, currentBit, 10); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mDay ", errorIndex++, currentBit, 11); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mHour ", errorIndex++, currentBit, 12); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mMinute ", errorIndex++, currentBit, 13); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mSecond ", errorIndex++, currentBit, 14); + + // U16 + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mPulseRate ", errorIndex, currentBit, 14); + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mPulseRate ", errorIndex++, currentBit, 16); + + // U8 + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mUserId ", errorIndex++, currentBit, 17); + + // U16 - Since this is the last one, only considering the failed case of GetValue(), not handling second half of the U16 + currentBit = HelperFunctions_tstModel::addTestDataRow_bitRows("mStatus ", errorIndex, currentBit, 17); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MUIBloodPressure test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MUIBloodPressure() { + Model::MUIBloodPressure mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + QFETCH(int , expectedIndex ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mFlags ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mSystolic ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mDiastolic ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mMeanArterial ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mYear ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mMonth ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mDay ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mHour ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mMinute ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mSecond ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 11: { index = index * sizeof mData._data.mPulseRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 12: { index = index * sizeof mData._data.mUserId ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + case 13: { index = index * sizeof mData._data.mStatus ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( expectedIndex, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDuetConfirmHDi ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDuetConfirmHDi data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDuetConfirmHDi_data () { + HelperFunctions_tstModel::generate_ByteDataSet( { "mId" , + "mCommand" , + "mReason" + }); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDuetConfirmHDi test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDuetConfirmHDi() { + Model::MDuetConfirmHDi 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 " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mId ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mCommand ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + void tst_models::tst_MAlarmAcknowledgeRequest() { MessageInterpreter interpreter; QVariantList vData; QByteArray payload; - QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_AlarmUserActionReq, vData, payload)); + Can_Id canId = Can::Can_Id::eChlid_HD_Alarm; + QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_AlarmUserActionReq, vData, payload, canId)); } void tst_models::tst_MInitTreatmentRequest() { MessageInterpreter interpreter; QVariantList vData; QByteArray payload; - QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_AdjustInitTreatmentReq, vData, payload)); + Can_Id canId = Can::Can_Id::eChlid_HD_UI; + QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_AdjustInitTreatmentReq, vData, payload, canId)); } void tst_models::tst_MConfirmTreatmentRequest() { MessageInterpreter interpreter; QVariantList vData; QByteArray payload; - QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_AdjustParametersConfirmReq, vData, payload)); + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + + QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_AdjustParametersConfirmReq, vData, payload, canId)); } void tst_models::tst_MEndTreatmentRequest() @@ -1963,18 +4336,489 @@ QVariantList vData; QByteArray payload; Message msg; - msg.actionId = Gui::GuiActions::ID_EndTreatmentReq; + msg.actionId = Gui::GuiActions::ID_AdjustTreatmentEndReq; - QVERIFY(interpreter.interpretMessage(Gui::GuiActions::ID_EndTreatmentReq, vData, payload)); + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + + QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_AdjustTreatmentEndReq, vData, payload, canId)); QVERIFY(!interpreter.interpretMessage_HD(msg,vData)); + + // Add a value to the data list to avoid length check returning false vData.append(0); - QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_EndTreatmentReq, vData, payload)); + QVERIFY(interpreter.interpretMessage(Gui::GuiActions::ID_AdjustTreatmentEndReq, vData, payload, canId)); + QVERIFY(!interpreter.interpretMessage_HD(msg,vData)); } void tst_models::tst_MAdjustmentTreatmentParametersRequest() { MessageInterpreter interpreter; QVariantList vData; QByteArray payload; - QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_AdjustParametersValidationReq, vData, payload)); + Can_Id canId = Can::Can_Id::eChlid_UI_HD; + QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_AdjustParametersValidationReq, vData, payload, canId)); } + +void tst_models::tst_DG_headerCoverage() { + // This test is for code coverage purposes of the DG model headers + + // ----------------------------------- + // FROM model/dg/data/ + // ----------------------------------- + // MDGValvesStates + Model::MDGValvesStates mdgValvesStates; + QCOMPARE(mdgValvesStates.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MDGTemperatures + Model::MDGTemperatures mDGTemperatures; + QCOMPARE(mDGTemperatures.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MDGReservoir + Model::MDGReservoir mDGReservoir; + QCOMPARE(mDGReservoir.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MDGROPump + Model::MDGROPump mDGROPump; + QCOMPARE(mDGROPump.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MDGPressures + Model::MDGPressures mDGPressures; + QCOMPARE(mDGPressures.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MDGOperationMode + Model::MDGOperationMode mDGOperationMode; + QCOMPARE(mDGOperationMode.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MDGLoadCellReadings + Model::MDGLoadCellReadings mDGLoadCellReadings; + QCOMPARE(mDGLoadCellReadings.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MDGHeaters + Model::MDGHeaters mDGHeaters; + QCOMPARE(mDGHeaters.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MDGGeneralEvent + Model::MDGGeneralEvent mDGGeneralEvent; + QCOMPARE(mDGGeneralEvent.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MDGDrainPump + Model::MDGDrainPump mDGDrainPump; + QCOMPARE(mDGDrainPump.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MDGDebugText + Model::MDGDebugText mDGDebugText; + QCOMPARE(mDGDebugText.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MDGConductivityData + Model::MDGConductivityData mDGConductivityData; + QCOMPARE(mDGConductivityData.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MDGAccelerometer + Model::MDGAccelerometer mDGAccelerometer; + QCOMPARE(mDGAccelerometer.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // ----------------------------------- + // FROM model/dg/data/pretreatment/ + // ----------------------------------- + // MDGFilterFlush + Model::MDGFilterFlush mDGFilterFlush; + QCOMPARE(mDGFilterFlush.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // ----------------------------------- + // FROM model/dg/data/post/ + // ----------------------------------- + // MDGPostSingleResult + Model::MDGPostSingleResult mDGPostSingleResult; + QCOMPARE(mDGPostSingleResult.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MDGPostFinalResult + Model::MDGPostFinalResult mDGPostFinalResult; + QCOMPARE(mDGPostFinalResult.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // ----------------------------------- + // FROM model/dg/adjustment/settings/ + // ----------------------------------- + + // MAdjustVersionsDGResponse + Model::MAdjustVersionsDGResponse mAdjustVersionsDGResponse; + QCOMPARE(mAdjustVersionsDGResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustServiceDatesDGResponse + Model::MAdjustServiceDatesDGResponse mAdjustServiceDatesDGResponse; + QCOMPARE(mAdjustServiceDatesDGResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustSerialNumberDGResponse + Model::MAdjustSerialNumberDGResponse mAdjustSerialNumberDGResponse; + QCOMPARE(mAdjustVersionsDGResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustDGCleaningUsageResponse + Model::MAdjustDGCleaningUsageResponse mAdjustDGCleaningUsageResponse; + QCOMPARE(mAdjustDGCleaningUsageResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MDuetRoWaterStatDGq + Model::MDuetRoWaterStatDGq mDuetRoWaterStatDGq; + QCOMPARE(mDuetRoWaterStatDGq.typeText(), Model::MAbstract::Type_Enum::eEvent ); +} + + +void tst_models::tst_HD_headerCoverage() { + // This test is for code coverage purposes of the HD model headers + + // ----------------------------------- + // FROM model/hd/alarm/ + // ----------------------------------- + // MAlarmTriggered + Model::MAlarmTriggered mAlarmTriggered; + QCOMPARE(mAlarmTriggered.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAlarmStatus + Model::MAlarmStatus mAlarmStatus; + QCOMPARE(mAlarmStatus.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MAlarmConditionCleared + Model::MAlarmClearedCondition mAlarmClearedCondition; + QCOMPARE(mAlarmClearedCondition.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAlarmCleared + Model::MAlarmCleared mAlarmCleared; + QCOMPARE(mAlarmCleared.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAlarmActiveListReq + Model::MAlarmActiveListReq mAlarmActiveListReq; + QVERIFY(mAlarmActiveListReq.toString() == "UI,AlarmActiveList"); + + Model::MAlarmActiveListResponse mAlarmActiveListResponse; + QCOMPARE(mAlarmActiveListResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // ----------------------------------- + // FROM model/hd/data/treatment + // ----------------------------------- + // MTreatmentTime + Model::MTreatmentTime mTreatmentTime; + QCOMPARE(mTreatmentTime.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MTreatmentStop + Model::MTreatmentStop mTreatmentStop; + QCOMPARE(mTreatmentStop.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MTreatmentStates + Model::MTreatmentStates mTreatmentStates; + QCOMPARE(mTreatmentStates.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MTreatmentSaline + Model::MTreatmentSaline mTreatmentSaline; + QCOMPARE(mTreatmentSaline.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MTreatmentRinseback + Model::MTreatmentRinseback mTreatmentRinseback; + QCOMPARE(mTreatmentRinseback.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MTreatmentRecirculate + Model::MTreatmentRecirculate mTreatmentRecirculate; + QCOMPARE(mTreatmentRecirculate.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MPressureOcclusion + Model::MPressureOcclusion mPressureOcclusion; + QCOMPARE(mPressureOcclusion.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MOutletFlow + Model::MOutletFlow mOutletFlow; + QCOMPARE(mOutletFlow.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MTreatmentHeparin + Model::MTreatmentHeparin mTreatmentHeparin; + QCOMPARE(mTreatmentHeparin.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MDialysateFlow + Model::MDialysateFlow mDialysateFlow; + QCOMPARE(mDialysateFlow.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MTreatmentBloodPrime + Model::MTreatmentBloodPrime mTreatmentBloodPrime; + QCOMPARE(mTreatmentBloodPrime.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MBloodFlow + Model::MBloodFlow mBloodFlow; + QCOMPARE(mBloodFlow.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // ----------------------------------- + // FROM model/hd/data/pretreatment/ + // ----------------------------------- + // MPreTreatmentStates + Model::MPreTreatmentStates mPreTreatmentStates; + QCOMPARE(mPreTreatmentStates.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MPreTreatmentSelfTestNoCartridge + Model::MPreTreatmentSelfTestNoCartridge mPreTreatmentSelfTestNoCartridge; + QCOMPARE(mPreTreatmentSelfTestNoCartridge.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MPreTreatmentSelfTestDry + Model::MPreTreatmentSelfTestDry mPreTreatmentSelfTestDry; + QCOMPARE(mPreTreatmentSelfTestDry.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MPreTreatmentDisposablesPrime + Model::MPreTreatmentDisposablesPrime mPreTreatmentDisposablesPrime; + QCOMPARE(mPreTreatmentDisposablesPrime.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // ----------------------------------- + // FROM model/hd/data/treatmentlog/ + // ----------------------------------- + // MTreatmentLogEventData + Model::MTreatmentLogEventData mTreatmentLogEventData; + QCOMPARE(mTreatmentLogEventData.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MTreatmentLogAvrgeData + Model::MTreatmentLogAvrgeData mTreatmentLogAvrgeData; + QCOMPARE(mTreatmentLogAvrgeData.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MTreatmentLogAlarmData + Model::MTreatmentLogAlarmData mTreatmentLogAlarmData; + QCOMPARE(mTreatmentLogAlarmData.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // ----------------------------------- + // FROM model/hd/data/posttreatment/ + // ----------------------------------- + // MPostTreatmentStates + Model::MPostTreatmentStates mPostTreatmentStates2; + QCOMPARE(mPostTreatmentStates2.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // ----------------------------------- + // FROM model/hd/data/post/ + // ----------------------------------- + // MUIPostFinalResultHDRequest + Model::MUIPostFinalResultHDRequest mUIPostFinalResultHDRequest; + QCOMPARE(mUIPostFinalResultHDRequest.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MHDRTCEpochData + Model::MHDRTCEpochData mHDRTCEpochData; + QCOMPARE(mHDRTCEpochData.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MHDPostSingleResult + Model::MHDPostSingleResult mHDPostSingleResult; + QCOMPARE(mHDPostSingleResult.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MHDPostFinalResult + Model::MHDPostFinalResult mHDPostFinalResult; + QCOMPARE(mHDPostFinalResult.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // ----------------------------------- + // FROM model/hd/data/ + // ----------------------------------- + // MTreatmentRanges + Model::MTreatmentRanges mTreatmentRanges; + QCOMPARE(mTreatmentRanges.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MHDUsageInfoResponse + Model::MHDUsageInfoResponse mHDUsageInfoResponse; + QCOMPARE(mHDUsageInfoResponse.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MHDSyringePump + Model::MHDSyringePump mHDSyringePump; + QCOMPARE(mHDSyringePump.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MHDOperationMode + Model::MHDOperationMode mHDOperationMode; + QCOMPARE(mHDOperationMode.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MHDGeneralEvent + Model::MHDGeneralEvent mHDGeneralEvent; + QCOMPARE(mHDGeneralEvent.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MHDSyringePump + Model::MHDDebugText mHDDebugText; + QCOMPARE(mHDDebugText.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MHDBloodLeakData + Model::MHDBloodLeakData mHDBloodLeakData; + QCOMPARE(mHDBloodLeakData.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MHDAirTrapData + Model::MHDAirTrapData mHDAirTrapData; + QCOMPARE(mHDAirTrapData.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MHDAirBubbleData + Model::MHDAirBubbleData mHDAirBubbleData; + QCOMPARE(mHDAirBubbleData.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // MHDAccelerometer + Model::MHDAccelerometer mHDAccelerometer; + QCOMPARE(mHDAccelerometer.typeText(), Model::MAbstract::Type_Enum::eDatum ); + + // ----------------------------------- + // FROM model/hd/adjustment/posttreatment + // ----------------------------------- + // MAdjustTreatmentLogResponse + Model::MAdjustTreatmentLogResponse mAdjustTreatmentLogResponse; + QCOMPARE(mAdjustTreatmentLogResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustPatientDisconnectionConfirmResponse + Model::MAdjustPatientDisconnectionConfirmResponse mAdjustPatientDisconnectionConfirmResponse; + QCOMPARE(mAdjustPatientDisconnectionConfirmResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustDisposablesRemovalConfirmResponse + Model::MAdjustDisposablesRemovalConfirmResponse mAdjustDisposablesRemovalConfirmResponse; + QCOMPARE(mAdjustDisposablesRemovalConfirmResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // ----------------------------------- + // FROM model/hd/adjustment/pretreatment + // ----------------------------------- + // MAdjustWaterSampleResponse + Model::MAdjustWaterSampleResponse mAdjustWaterSampleResponse; + QCOMPARE(mAdjustWaterSampleResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustUltrafiltrationInitResponse + Model::MAdjustUltrafiltrationInitResponse mAdjustUltrafiltrationInitResponse; + QCOMPARE(mAdjustUltrafiltrationInitResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustStartTreatmentResponse + Model::MAdjustStartTreatmentResponse mAdjustStartTreatmentResponse; + QCOMPARE(mAdjustStartTreatmentResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustPatientConnectionConfirmResponse + Model::MAdjustPatientConnectionConfirmResponse mAdjustPatientConnectionConfirmResponse; + QCOMPARE(mAdjustPatientConnectionConfirmResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustPatientConnectionBeginResponse + Model::MAdjustPatientConnectionBeginResponse mAdjustPatientConnectionBeginResponse; + QCOMPARE(mAdjustPatientConnectionBeginResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustParametersValidationResponse + Model::MAdjustParametersValidationResponse mAdjustParametersValidationResponse; + QCOMPARE(mAdjustParametersValidationResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustInitTreatmentResponse + Model::MAdjustInitTreatmentResponse mAdjustInitTreatmentResponse; + QCOMPARE(mAdjustInitTreatmentResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustDisposablesPrimeResponse + Model::MAdjustDisposablesPrimeResponse mAdjustDisposablesPrimeResponse; + QCOMPARE(mAdjustDisposablesPrimeResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustDisposablesConfirmResponse + Model::MAdjustDisposablesConfirmResponse mAdjustDisposablesConfirmResponse; + QCOMPARE(mAdjustDisposablesConfirmResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // ----------------------------------- + // FROM model/hd/adjustment/settings + // ----------------------------------- + // MAdjustVersionsHDResponse + Model::MAdjustVersionsHDResponse mAdjustVersionsHDResponse; + QCOMPARE(mAdjustVersionsHDResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustVersionsHDRequest + Model::MAdjustVersionsHDRequest mAdjustVersionsHDRequest; + QCOMPARE(mAdjustVersionsHDRequest.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustServiceModeResponse + Model::MAdjustServiceModeResponse mAdjustServiceModeResponse; + QCOMPARE(mAdjustServiceModeResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustSerialNumberHDResponse + Model::MAdjustSerialNumberHDResponse mAdjustSerialNumberHDResponse; + QCOMPARE(mAdjustSerialNumberHDResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustHDDateTimeResponse + Model::MAdjustHDDateTimeResponse mAdjustHDDateTimeResponse; + QCOMPARE(mAdjustHDDateTimeResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustHDAlarmVolumeResponse + Model::MAdjustHDAlarmVolumeResponse mAdjustHDAlarmVolumeResponse; + QCOMPARE(mAdjustHDAlarmVolumeResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // ----------------------------------- + // FROM model/hd/adjustment/treatment + // ----------------------------------- + // MAdjustVersionsHDResponse + Model::MAdjustUltrafiltrationStateResponse mAdjustUltrafiltrationStateResponse; + QCOMPARE(mAdjustUltrafiltrationStateResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustSalineResponse + Model::MAdjustSalineResponse mAdjustSalineResponse; + QCOMPARE(mAdjustSalineResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustRinsebackResponse + Model::MAdjustRinsebackResponse mAdjustRinsebackResponse; + QCOMPARE(mAdjustRinsebackResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustRecirculateResponse + Model::MAdjustRecirculateResponse mAdjustRecirculateResponse; + QCOMPARE(mAdjustRecirculateResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustPressuresLimitsResponse + Model::MAdjustPressuresLimitsResponse mAdjustPressuresLimitsResponse; + QCOMPARE(mAdjustPressuresLimitsResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustHeparinResponse + Model::MAdjustHeparinResponse mAdjustHeparinResponse; + QCOMPARE(mAdjustHeparinResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustTreatmentEndResponse + Model::MAdjustTreatmentEndResponse mAdjustTreatmentEndResponse; + QCOMPARE(mAdjustTreatmentEndResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustDurationResponse + Model::MAdjustDurationResponse mAdjustDurationResponse; + QCOMPARE(mAdjustDurationResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustBloodDialysateResponse + Model::MAdjustBloodDialysateResponse mAdjustBloodDialysateResponse; + QCOMPARE(mAdjustBloodDialysateResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // ----------------------------------- + // FROM model/hd/adjustment/disinfect/ + // ----------------------------------- + // MAdjustDisinfectStartResponse + Model::MAdjustDisinfectStartResponse mAdjustDisinfectStartResponse; + QCOMPARE(mAdjustDisinfectStartResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // MAdjustDisinfectModeResponse + Model::MAdjustDisinfectModeResponse mAdjustDisinfectModeResponse; + QCOMPARE(mAdjustDisinfectModeResponse.typeText(), Model::MAbstract::Type_Enum::eEvent ); + + // ----------------------------------- + // FROM model/hd/adjustment/ + // ----------------------------------- + // MPowerOff + Model::MPowerOff mPowerOff; + QCOMPARE(mPowerOff.typeText(), Model::MAbstract::Type_Enum::eEvent ); +} + +void tst_models::tst_modelsHeader_Coverage() +{ + QVERIFY(Model::MAbstract::typeText(Model::MAbstract::Type_Enum::eEvent) == "E"); + QVERIFY(Model::MAbstract::typeText(Model::MAbstract::Type_Enum::eDatum) == "D"); +} + +void tst_models::tst_MDisinfectAdjustModeRequests_ToStrings() +{ + // This is to do code coverage for the toString functions + // MAdjustDisinfectModeReq + Model::MAdjustDisinfectModeReq mMAdjustDisinfectModeReq; + QVERIFY(mMAdjustDisinfectModeReq.toString().contains("DisinfectMode")); + +} + +void tst_models::tst_MPostTreatmentAdjustRequests_ToStrings() +{ + // This is to do code coverage for the toString functions + // MAdjustPatientDisconnectionNotifyReq + Model::MAdjustPatientDisconnectionNotifyReq mMAdjustPatientDisconnectionNotifyReq; + QVERIFY(mMAdjustPatientDisconnectionNotifyReq.toString().contains("PatientDisconnectionNotify")); + + // MAdjustPatientDisconnectionConfirmReq + Model::MAdjustPatientDisconnectionConfirmReq mAdjustPatientDisconnectionConfirmReq; + QVERIFY(mAdjustPatientDisconnectionConfirmReq.toString().contains("PatientDisconnectionConfirm")); + + // MAdjustDisposablesRemovalConfirmReq + Model::MAdjustDisposablesRemovalConfirmReq mMAdjustDisposablesRemovalConfirmReq; + QVERIFY(mMAdjustDisposablesRemovalConfirmReq.toString().contains("DisposablesRemovalConfirm")); + + // MAdjustTreatmentLogReq + Model::MAdjustTreatmentLogReq mMAdjustTreatmentLogReq; + QVERIFY(mMAdjustTreatmentLogReq.toString().contains("TreatmentLog")); +} + + + + + +