Index: unittests/tst_models.cpp =================================================================== diff -u -rc3a1e077ddeba65709084f9af5dd756741db8b4f -r66e87ea403ec12a273553284919684282d87bc6a --- unittests/tst_models.cpp (.../tst_models.cpp) (revision c3a1e077ddeba65709084f9af5dd756741db8b4f) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision 66e87ea403ec12a273553284919684282d87bc6a) @@ -44,7 +44,9 @@ #include "MTreatmentAdjustUltrafiltrationStateResponse.h" #include "MTreatmentAdjustUltrafiltrationEditResponse.h" #include "MTreatmentAdjustUltrafiltrationConfirmResponse.h" +#include "MTreatmentAdjustPressuresLimitsResponse.h" #include "MTreatmentAdjustSalineResponse.h" +#include "MTreatmentAdjustHeparinResponse.h" #include "MAlarmStatusData.h" #include "MAlarmTriggered.h" @@ -235,7 +237,7 @@ { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ")<< 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F")); + QTest::newRow("msg complete ")<< 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -405,7 +407,68 @@ } } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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("mArterialLimitLow ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mArterialLimitLow ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mArterialLimitLow ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mArterialLimitLow ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mArterialLimitHigh ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mArterialLimitHigh ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mArterialLimitHigh ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mArterialLimitHigh ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mVenousLimitLow ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mVenousLimitLow ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mVenousLimitLow ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mVenousLimitLow ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12")); + QTest::newRow("mVenousLimitHigh ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13")); + QTest::newRow("mVenousLimitHigh ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14")); + QTest::newRow("mVenousLimitHigh ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15")); + QTest::newRow("mVenousLimitHigh ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16")); +} +void tst_models::tst_MAdjustPressuresLimitsResponse() +{ + Model::MAdjustPressuresLimitsResponse 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.mArterialLimitLow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mArterialLimitHigh ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mVenousLimitLow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mVenousLimitHigh ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGROPumpData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGROPumpData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // @@ -492,7 +555,7 @@ #endif switch (errorIndex) { - case 0: { index = 0 ; 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.mROInletPSI ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 2: { index = index * sizeof mData._data.mROOutletPSI ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 3: { index = index * sizeof mData._data.mDrainInletPSI ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; @@ -854,19 +917,23 @@ void tst_models::tst_MTreatmentStateData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); - 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")); - QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); - QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); - QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); - QTest::newRow("mSalineState") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mSalineState") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("mSalineState") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("mSalineState") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + 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("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")); + QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mUFState ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mSalineState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mSalineState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mSalineState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mSalineState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mHeparinState") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + 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")); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentStateData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MTreatmentStateData() { @@ -884,10 +951,11 @@ #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.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 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.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; default: QVERIFY2(false, "Incorrect Test"); break; @@ -1408,43 +1476,43 @@ { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" "40" "41" "42" "43" "44" "45" "46" "47")); - QTest::newRow("requestValid") << 1 << QByteArray::fromHex(QByteArray ()); - QTest::newRow("requestValid") << 1 << QByteArray::fromHex(QByteArray ("00")); - QTest::newRow("requestValid") << 1 << QByteArray::fromHex(QByteArray ("00" "01")); - QTest::newRow("requestValid") << 1 << QByteArray::fromHex(QByteArray ("00" "01" "02")); - QTest::newRow("bloodFlowRate") << 2 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" )); - QTest::newRow("bloodFlowRate") << 2 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04")); - QTest::newRow("bloodFlowRate") << 2 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05")); - QTest::newRow("bloodFlowRate") << 2 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06")); - QTest::newRow("dialysateFlowRate") << 3 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("dialysateFlowRate") << 3 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("dialysateFlowRate") << 3 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("dialysateFlowRate") << 3 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); - QTest::newRow("duration") << 4 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); - QTest::newRow("duration") << 4 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); - QTest::newRow("duration") << 4 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); - QTest::newRow("duration") << 4 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); - QTest::newRow("heparinDispensingRate") << 5 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); - QTest::newRow("heparinDispensingRate") << 5 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); - QTest::newRow("heparinDispensingRate") << 5 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); - QTest::newRow("heparinDispensingRate") << 5 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12")); - QTest::newRow("heparinBolusVolume") << 6 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13")); - QTest::newRow("heparinBolusVolume") << 6 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14")); - QTest::newRow("heparinBolusVolume") << 6 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15")); - QTest::newRow("heparinBolusVolume") << 6 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16")); - QTest::newRow("heparinStopTime") << 7 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17")); - QTest::newRow("heparinStopTime") << 7 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18")); - QTest::newRow("heparinStopTime") << 7 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19")); - QTest::newRow("heparinStopTime") << 7 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A")); - QTest::newRow("salineBolus") << 8 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); - QTest::newRow("salineBolus") << 8 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C")); - QTest::newRow("salineBolus") << 8 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D")); - QTest::newRow("salineBolus") << 8 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E")); - QTest::newRow("acidConcentrate") << 9 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F")); - QTest::newRow("acidConcentrate") << 9 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20")); - QTest::newRow("acidConcentrate") << 9 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21")); - QTest::newRow("acidConcentrate") << 9 << QByteArray::fromHex(QByteArray ("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22")); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F" "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" "40" "41" "42" "43" "44" "45" "46" "47" "48")); + QTest::newRow("requestValid") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("requestValid") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("requestValid") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("requestValid") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("bloodFlowRate") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" )); + QTest::newRow("bloodFlowRate") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("bloodFlowRate") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("bloodFlowRate") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("dialysateFlowRate") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("dialysateFlowRate") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("dialysateFlowRate") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("dialysateFlowRate") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("duration") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("duration") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("duration") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("duration") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("heparinDispensingRate") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("heparinDispensingRate") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("heparinDispensingRate") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("heparinDispensingRate") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12")); + QTest::newRow("heparinBolusVolume") << 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13")); + QTest::newRow("heparinBolusVolume") << 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14")); + QTest::newRow("heparinBolusVolume") << 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15")); + QTest::newRow("heparinBolusVolume") << 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16")); + QTest::newRow("heparinStopTime") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17")); + QTest::newRow("heparinStopTime") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18")); + QTest::newRow("heparinStopTime") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19")); + QTest::newRow("heparinStopTime") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A")); + QTest::newRow("salineBolus") << 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); + QTest::newRow("salineBolus") << 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C")); + QTest::newRow("salineBolus") << 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D")); + QTest::newRow("salineBolus") << 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E")); + QTest::newRow("acidConcentrate") << 9 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F")); + QTest::newRow("acidConcentrate") << 9 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20")); + QTest::newRow("acidConcentrate") << 9 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21")); + QTest::newRow("acidConcentrate") << 9 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22")); QTest::newRow("bicarbonateConcentrate") << 10 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23")); QTest::newRow("bicarbonateConcentrate") << 10 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24")); QTest::newRow("bicarbonateConcentrate") << 10 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25")); @@ -1488,7 +1556,6 @@ { Model::MTreatmentParametersResponse mData; - QFETCH(int , errorIndex ); QFETCH(QByteArray, data ); @@ -1505,64 +1572,26 @@ << "data: " << data; #endif switch (errorIndex) { - case 0: { index = 0; - QVERIFY ( mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 1: { index = index * sizeof mData._data.requestValid; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 2: { index = index * sizeof mData._data.bloodFlowRate; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 3: { index = index * sizeof mData._data.dialysateFlowRate; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 4: { index = index * sizeof mData._data.duration; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 5: { index = index * sizeof mData._data.heparinDispensingRate; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 6: { index = index * sizeof mData._data.heparinBolusVolume; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 7: { index = index * sizeof mData._data.heparinStopTime; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 8: { index = index * sizeof mData._data.salineBolus; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 9: { index = index * sizeof mData._data.acidConcentrate; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 10: { index = index * sizeof mData._data.bicarbonateConcentrate; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 11: { index = index * sizeof mData._data.dialyzerType; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 12: { index = index * sizeof mData._data.dialysateTemp; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 13: { index = index * sizeof mData._data.arterialPressureLimitLow; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 14: { index = index * sizeof mData._data.arterialPressureLimitHigh; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 15: { index = index * sizeof mData._data.venousPressureLimitLow; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 16: { index = index * sizeof mData._data.venousPressureLimitHigh; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 17: { index = index * sizeof mData._data.bloodPressureMeasureInterval; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - - case 18: { index = index * sizeof mData._data.rinsebackFlowRate; - QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; - default: - QVERIFY2(false, "Incorrect Test"); + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 1: { index = index * sizeof mData._data.requestValid ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 2: { index = index * sizeof mData._data.bloodFlowRate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 3: { index = index * sizeof mData._data.dialysateFlowRate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 4: { index = index * sizeof mData._data.duration ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 5: { index = index * sizeof mData._data.heparinDispensingRate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 6: { index = index * sizeof mData._data.heparinBolusVolume ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 7: { index = index * sizeof mData._data.heparinStopTime ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 8: { index = index * sizeof mData._data.salineBolus ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 9: { index = index * sizeof mData._data.acidConcentrate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 10: { index = index * sizeof mData._data.bicarbonateConcentrate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 11: { index = index * sizeof mData._data.dialyzerType ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 12: { index = index * sizeof mData._data.dialysateTemp ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 13: { index = index * sizeof mData._data.arterialPressureLimitLow ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 14: { index = index * sizeof mData._data.arterialPressureLimitHigh ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 15: { index = index * sizeof mData._data.venousPressureLimitLow ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 16: { index = index * sizeof mData._data.venousPressureLimitHigh ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 17: { index = index * sizeof mData._data.bloodPressureMeasureInterval ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + case 18: { index = index * sizeof mData._data.rinsebackFlowRate ; QVERIFY ( !mData.fromByteArray(data)); QCOMPARE(index, startIndex); } break; + default: QVERIFY2(false, "Incorrect Test"); break; } } @@ -1614,6 +1643,43 @@ } } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentHeparinData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentHeparinData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentHeparinData_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mCumulative ") << 1 << QByteArray::fromHex(QByteArray()); + 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")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentHeparinData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentHeparinData() { + Model::MTreatmentHeparin 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.mCumulative; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPrimingData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPrimingData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // void tst_models::tst_MPrimingData_data () { @@ -1791,6 +1857,52 @@ } } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSalineBolusResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHeparinResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "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("mState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mState ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHeparinResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHeparinResponse() { + Model::MAdjustHeparinResponse 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.mState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + void tst_models::tst_MAlarmAcknowledgeRequest() { MessageInterpreter interpreter;