Index: unittests/tst_models.cpp =================================================================== diff -u -r0de28b779f05ad19581646e2efc4b3ffda65de21 -r4489378415df8f8398f59a20ca637b39f2ed2613 --- unittests/tst_models.cpp (.../tst_models.cpp) (revision 0de28b779f05ad19581646e2efc4b3ffda65de21) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision 4489378415df8f8398f59a20ca637b39f2ed2613) @@ -456,33 +456,33 @@ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Adjust Pressures Response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MAdjustPressuresLimitsResponse_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")); -// 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("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")); -// 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::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")); + 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("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")); + 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")); } void tst_models::tst_MAdjustPressuresLimitsResponse() @@ -979,6 +979,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 +1026,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; @@ -1078,6 +1110,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 +1156,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; @@ -1306,14 +1364,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 +1406,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; @@ -1617,11 +1692,11 @@ << "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 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.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 4: { index = index * sizeof mData._data.mDuration ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; case 5: { index = index * sizeof mData._data.mHeparinDispensingRate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; case 6: { index = index * sizeof mData._data.mHeparinBolusVolume ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; case 7: { index = index * sizeof mData._data.mHeparinStopTime ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; @@ -1630,9 +1705,9 @@ case 10: { index = index * sizeof mData._data.mBicarbonateConcentrate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; case 11: { index = index * sizeof mData._data.mDialyzerType ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; case 12: { index = index * sizeof mData._data.mDialysateTemp ; 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 15: { index = index * sizeof mData._data.mVenousPressureLimitWindow ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - case 16: { index = index * sizeof mData._data.mVenousPressureLimitAsymtrc ; 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 15: { index = index * sizeof mData._data.mVenousPressureLimitWindow ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 16: { index = index * sizeof mData._data.mVenousPressureLimitAsymtrc ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; case 17: { index = index * sizeof mData._data.mBloodPressureMeasureInterval ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; case 18: { index = index * sizeof mData._data.mRinsebackFlowRate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; default: QVERIFY2(false, "Incorrect Test"); @@ -1698,6 +1773,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() { @@ -1718,6 +1798,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; @@ -1772,10 +1853,10 @@ 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("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")); @@ -1808,90 +1889,6 @@ } } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MEndTreatmentResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MEndTreatmentResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MEndTreatmentResponse_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")); -} - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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; -// default: -// QVERIFY2(false, "Incorrect Test"); -// break; -// } -} - -//// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MmSalineBolusResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -//// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MmSalineBolusResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // -/// TODo need to figure out what this test is -//void tst_models::tst_MTreatmentSalineBolusData_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")); -//} -//// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MmSalineBolusResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // -//void tst_models::tst_MTreatmentSalineBolusData() { -// 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 << errorIndex << startIndex << ok << data ; -//#endif - -// switch (errorIndex) { -// case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; -// case 1: { index = index * sizeof mData._data.mAccepted; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; -// case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; -// case 3: { index = index * sizeof mData._data.mTarget ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; -// default: -// QVERIFY2(false, "Incorrect Test"); -// break; -// } -//} - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MmSalineBolusResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MmSalineBolusResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // @@ -1933,6 +1930,1308 @@ } } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustTreatmentLogResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustTreatmentLogResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +QByteArray helperFunction_createArray(int vCount) +{ + /* + * Based on the existing tests and test data, this helper function will reduce the need to copy-paste + * and creating data sets by hand. The function generates a QByteArray of elements "00"..."xx" up to + * vCount of them. + * + * Expected return for a vCount == 5 is: + * { "00" "01" "02" "03" "04" } + */ + QByteArray returnArray = {}; + for(int i = 0; i("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(37)); + 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")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mBloodFlowRate" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mDialysateFlowRate" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mTreatmentDuration" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mActualTreatmentDuration" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mAcidConcentrateType" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mBicarbonateConcentrateType", ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mPotassiumConcentration" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mCalciumConcentration" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mBicarbonateConcentration" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mSodiumConcentration" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mDialysateTemperature" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mDialyzerType" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mTreatmentStartEpoch" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mTreatmentEndEpoch" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mAverageBloodFlow" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mAverageDialysateFlow" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mDialysateVolumeUsed" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mAverageDialysateTemp" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mOriginUFVolume" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mTargetUFVolume" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mActualUFVolume" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mOriginUFRate" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mTargetUFRate" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mActualUFRate" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mSalineBolusVolume" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mHeparinBolusVolume" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mHeparinDispenseRate" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mHeparinStop" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mHeparinDeliveredVolume" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mHeparinType" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mAverageArterialPressure" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mAverageVenousPressure" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mDeviceID" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mWaterSampleTestResult" , ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(11)); + QTest::newRow("mSyringePumpState ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mSyringePumpState ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mSyringePumpState ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mSyringePumpState ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mHeparinState" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mSetRate" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mMeasuredRate" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mSyringePumpPosition" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mVolumeDelivered" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mMeasuredHome" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mMeasuredSwitch" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mMeasuredForce" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mSafetyVol" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mStatus" , ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(2)); + QTest::newRow("mBloodLeakStatus ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mBloodLeakStatus ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mBloodLeakStatus ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mBloodLeakStatus ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mBloodLeakState" , ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(2)); + QTest::newRow("mAirTrapLowerLevel ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAirTrapLowerLevel ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAirTrapLowerLevel ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAirTrapLowerLevel ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mAirTrapUpperLevel" , ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(9)); + QTest::newRow("mX ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mX ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mX ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mX ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mY" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mZ" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mXMax" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mYMax" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mZMax" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mXTilt", ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mYTilt", ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mZTilt", ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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(helperFunction_createArray(5)); + QTest::newRow("mTotalTxHours ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mTotalTxHours ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mTotalTxHours ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mTotalTxHours ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mTotalTxHoursSinceLastService" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mEpochOfStartOfLastTx" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mEpochOfLastRecordReset" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mCrc" , ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDUsageInfoResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDUsageInfoResponse() { + Model::MHDUsageInfoResponse 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.mTotalTxHours ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mTotalTxHoursSinceLastService ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mEpochOfStartOfLastTx ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mEpochOfLastRecordReset ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mCrc ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDAirBubbleData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDAirBubbleData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // + +void tst_models::tst_MHDAirBubbleData_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(11)); + QTest::newRow("mVenousAirBubbleStatus ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mVenousAirBubbleStatus ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mVenousAirBubbleStatus ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mVenousAirBubbleStatus ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mVenousAirBubbleState" , ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(9)); + QTest::newRow("mSubMode ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mSubMode ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mSubMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mSubMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mWaterSampleState" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mSelfTestConsumablesState" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mSelfTestNoCartridgeState" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mInstallationState" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mSelfTestDryState" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mPrimeState" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mRecirculateState" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mPatientConnectionState" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mWetSelfTestsState" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mPreTreatmentRsrvrState" , ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(2)); + QTest::newRow("mTimeout ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mTimeout ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mTimeout ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mTimeout ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mCountdown" , ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(2)); + QTest::newRow("mTimeout ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mTimeout ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mTimeout ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mTimeout ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mCountdown" , ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(2)); + QTest::newRow("mSubMode ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mSubMode ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mSubMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mSubMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mDrainState" , ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(2)); + QTest::newRow("mTotal ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mTotal ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mTotal ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mTotal ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mCountDown" , ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(6)); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mCurrent" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mRate" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mTimeoutTotal" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mTimeoutCountDown" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mIsCompleted" , ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(2)); + QTest::newRow("mTimeoutTotal ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mTimeoutTotal ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mTimeoutTotal ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mTimeoutTotal ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mTimeoutCountDown" , ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(2)); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mCurrent" , ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mEventID . ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mEventID . ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mEventID . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mEventID . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mOldValue" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mNewValue" , ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(5)); + QTest::newRow("mBloodFlowRate . ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mBloodFlowRate . ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mBloodFlowRate . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mBloodFlowRate . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mDialysateFlowRate", ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mUFRate" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mArterialPressure" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mVenousPressure" , ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + 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")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mParam1", ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mParam2", ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(1)); + QTest::newRow("mEpoch . ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mEpoch . ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mEpoch . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mEpoch . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mIndex", ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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.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; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDPostFinalResult ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDPostFinalResult data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDPostFinalResult_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + 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")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + 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")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + 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")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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(helperFunction_createArray(9)); + QTest::newRow("mMajor ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mMajor ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mMajor ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mMajor ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mMinor" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mMicro" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mBuild" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mFPGAId" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mFPGAMajor", ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mFPGAMinor", ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mFPGALab" , ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mCompatibilityRev" , ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustVersionsHDResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustVersionsHDResponse() { + Model::MAdjustVersionsHDResponse 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.mMajor ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mMinor ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mMicro ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mBuild ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mFPGAId ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mFPGAMajor; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mFPGAMinor; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mFPGALab ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mFPGALab ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mCompatibilityRev ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustServiceDatesHDResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustServiceDatesHDResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustServiceDatesHDResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mLastServiceDateEpoch . ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mLastServiceDateEpoch . ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mLastServiceDateEpoch . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mLastServiceDateEpoch . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mServiceIntervalSeconds", ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 " << 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; + } +} + void tst_models::tst_MAlarmAcknowledgeRequest() { MessageInterpreter interpreter; @@ -1985,3 +3284,4 @@ Can_Id canId = Can::Can_Id::eChlid_UI_HD; QVERIFY(!interpreter.interpretMessage(Gui::GuiActions::ID_AdjustParametersValidationReq, vData, payload, canId)); } +