Index: unittests/tst_models.cpp =================================================================== diff -u -rcc1e9d6d55c816f3fcd626dc6948cca24da283b3 -rc8b2c06141831ba2908323138d94dec0ccc0d402 --- unittests/tst_models.cpp (.../tst_models.cpp) (revision cc1e9d6d55c816f3fcd626dc6948cca24da283b3) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision c8b2c06141831ba2908323138d94dec0ccc0d402) @@ -44,6 +44,7 @@ #include "MTreatmentAdjustUltrafiltrationEditResponse.h" #include "MTreatmentAdjustUltrafiltrationConfirmResponse.h" #include "MTreatmentAdjustSalineResponse.h" +#include "MTreatmentAdjustPressuresLimitsResponse.h" #include "MAlarmStatusData.h" #include "MAlarmTriggered.h" @@ -399,6 +400,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 ~~~~~~~~~~~~~~~~~~~~~~~~ //