Index: unittests/tst_models.cpp =================================================================== diff -u -rc421ddadef2ade71d3abe269493a84b12b85296b -raa0772fe1b0ff6b07e9f64e8c38acad66ad5468d --- unittests/tst_models.cpp (.../tst_models.cpp) (revision c421ddadef2ade71d3abe269493a84b12b85296b) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision aa0772fe1b0ff6b07e9f64e8c38acad66ad5468d) @@ -19,13 +19,25 @@ #include "MTreatmentAdjustBloodDialysateResponse.h" #include "MTreatmentAdjustDurationResponse.h" #include "MTreatmentRangesData.h" +#include "MPowerOff.h" #include "MDGDrainPumpData.h" #include "MDGHeatersData.h" #include "MDGLoadCellReadingsData.h" #include "MDGOperationModeData.h" +#include "MDGPressuresData.h" +#include "MDGReservoirData.h" +#include "MDGROPumpData.h" #include "MDGTemperaturesData.h" +#include "MDGValvesStatesData.h" +#include "MHDOperationModeData.h" +#include "MTreatmentStatesData.h" +#include "MTreatmentOutletFlowData.h" +#include "MTreatmentFlowsData.h" +#include "MTreatmentTimeData.h" +#include "MTreatmentPressureOcclusionData.h" + #include "MTreatmentAdjustUltrafiltrationStateResponse.h" #include "MTreatmentAdjustUltrafiltrationEditResponse.h" #include "MTreatmentAdjustUltrafiltrationConfirmResponse.h" @@ -202,33 +214,18 @@ } } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DG Load Cell Readings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MDGLoadCellReadings_data () +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Adjust Ultrafiltration State Response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustUltrafiltrationStateResponse_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("mReservoir1Prim")<< 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mReservoir1Prim")<< 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mReservoir1Prim")<< 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mReservoir1Prim")<< 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); - QTest::newRow("mReservoir1Bkup")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("mReservoir1Bkup")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); - QTest::newRow("mReservoir1Bkup")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); - QTest::newRow("mReservoir1Bkup")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); - QTest::newRow("mReservoir2Prim")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mReservoir2Prim")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("mReservoir2Prim")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("mReservoir2Prim")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); - QTest::newRow("mReservoir2Bkup")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); - QTest::newRow("mReservoir2Bkup")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); - QTest::newRow("mReservoir2Bkup")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); - QTest::newRow("mReservoir2Bkup")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("msg complete ")<< 0 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray()); } -void tst_models::tst_MDGLoadCellReadings () +void tst_models::tst_MAdjustUltrafiltrationStateResponse () { - Model::MDGLoadCellReadings mData; + Model::MAdjustUltrafiltrationStateResponse mData; QFETCH(int , errorIndex ); QFETCH(QByteArray, data ); @@ -237,82 +234,62 @@ int index = errorIndex - 1; bool ok = mData.fromByteArray(data, &startIndex); Q_UNUSED(ok) - #ifdef CONSOLEOUT qDebug() << index << errorIndex << startIndex << ok << data ; #endif switch (errorIndex) { - case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 1: { index = index * sizeof mData._data.mReservoir1Prim ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 2: { index = index * sizeof mData._data.mReservoir1Bkup ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 3: { index = index * sizeof mData._data.mReservoir2Prim ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 4: { index = index * sizeof mData._data.mReservoir2Bkup ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; } } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DG Temperatures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MDGTemperatures_data () +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Adjust Ultrafiltration Edit Response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustUltrafiltrationEditResponse_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ")<< 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F")); - QTest::newRow("mInletPrimaryHeater ")<< 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mInletPrimaryHeater ")<< 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mInletPrimaryHeater ")<< 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mInletPrimaryHeater ")<< 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); - QTest::newRow("mOutletPrimaryHeater ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("mOutletPrimaryHeater ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); - QTest::newRow("mOutletPrimaryHeater ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); - QTest::newRow("mOutletPrimaryHeater ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); - QTest::newRow("mConductivitySensor1 ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mConductivitySensor1 ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("mConductivitySensor1 ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("mConductivitySensor1 ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); - QTest::newRow("mConductivitySensor2 ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); - QTest::newRow("mConductivitySensor2 ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); - QTest::newRow("mConductivitySensor2 ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); - QTest::newRow("mConductivitySensor2 ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); - QTest::newRow("mOutletRedundancy ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); - QTest::newRow("mOutletRedundancy ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); - QTest::newRow("mOutletRedundancy ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); - QTest::newRow("mOutletRedundancy ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12")); - QTest::newRow("mInletDialysate ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13")); - QTest::newRow("mInletDialysate ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14")); - QTest::newRow("mInletDialysate ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15")); - QTest::newRow("mInletDialysate ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16")); - QTest::newRow("mPrimaryHeaterThermoCouple")<< 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17")); - QTest::newRow("mPrimaryHeaterThermoCouple")<< 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18")); - QTest::newRow("mPrimaryHeaterThermoCouple")<< 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19")); - QTest::newRow("mPrimaryHeaterThermoCouple")<< 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A")); - QTest::newRow("mTrimmerHeaterThermoCouple")<< 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); - QTest::newRow("mTrimmerHeaterThermoCouple")<< 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C")); - QTest::newRow("mTrimmerHeaterThermoCouple")<< 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D")); - QTest::newRow("mTrimmerHeaterThermoCouple")<< 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E")); - QTest::newRow("mPrimaryHeaterColdJunction")<< 9 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F")); - QTest::newRow("mPrimaryHeaterColdJunction")<< 9 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20")); - QTest::newRow("mPrimaryHeaterColdJunction")<< 9 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21")); - QTest::newRow("mPrimaryHeaterColdJunction")<< 9 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22")); - QTest::newRow("mTrimmerHeaterColdJunction")<< 10 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23")); - QTest::newRow("mTrimmerHeaterColdJunction")<< 10 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24")); - QTest::newRow("mTrimmerHeaterColdJunction")<< 10 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25")); - QTest::newRow("mTrimmerHeaterColdJunction")<< 10 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26")); - QTest::newRow("mPrimaryHeaterInternal ")<< 11 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27")); - QTest::newRow("mPrimaryHeaterInternal ")<< 11 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28")); - QTest::newRow("mPrimaryHeaterInternal ")<< 11 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29")); - QTest::newRow("mPrimaryHeaterInternal ")<< 11 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A")); - QTest::newRow("mTrimmerHeaterInternal ")<< 12 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B")); - QTest::newRow("mTrimmerHeaterInternal ")<< 12 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" )); - QTest::newRow("mTrimmerHeaterInternal ")<< 12 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D")); - QTest::newRow("mTrimmerHeaterInternal ")<< 12 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E")); + 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("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mDurationDiff ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mDurationDiff ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mDurationDiff ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mDurationDiff ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12")); + QTest::newRow("mRate ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13")); + QTest::newRow("mRate ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14")); + QTest::newRow("mRate ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15")); + QTest::newRow("mRate ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16")); + QTest::newRow("mRateDiff ")<< 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17")); + QTest::newRow("mRateDiff ")<< 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18")); + QTest::newRow("mRateDiff ")<< 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19")); + QTest::newRow("mRateDiff ")<< 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A")); + QTest::newRow("mRateOld ")<< 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); + QTest::newRow("mRateOld ")<< 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C")); + QTest::newRow("mRateOld ")<< 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D")); + QTest::newRow("mRateOld ")<< 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E")); } -void tst_models::tst_MDGTemperatures () +void tst_models::tst_MAdjustUltrafiltrationEditResponse () { - Model::MDGTemperatures mData; + Model::MAdjustUltrafiltrationEditResponse mData; QFETCH(int , errorIndex ); QFETCH(QByteArray, data ); @@ -327,43 +304,193 @@ #endif switch (errorIndex) { - case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 1: { index = index * sizeof mData._data.mInletPrimaryHeater ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 2: { index = index * sizeof mData._data.mOutletPrimaryHeater ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 3: { index = index * sizeof mData._data.mConductivitySensor1 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 4: { index = index * sizeof mData._data.mConductivitySensor2 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 5: { index = index * sizeof mData._data.mOutletRedundancy ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 6: { index = index * sizeof mData._data.mInletDialysate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 7: { index = index * sizeof mData._data.mPrimaryHeaterThermoCouple ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 8: { index = index * sizeof mData._data.mTrimmerHeaterThermoCouple ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 9: { index = index * sizeof mData._data.mPrimaryHeaterColdJunction ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 10: { index = index * sizeof mData._data.mTrimmerHeaterColdJunction ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 11: { index = index * sizeof mData._data.mPrimaryHeaterInternal ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 12: { index = index * sizeof mData._data.mTrimmerHeaterInternal ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mVolume ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mDuration ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mDurationDiff ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mRateDiff ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mRateOld ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; } } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DG Drain Pump ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MDGDrainPump_data () +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Adjust Ultrafiltration Confirm Response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustUltrafiltrationConfirmResponse_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ")<< 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mRPM" )<< 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mRPM" )<< 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mRPM" )<< 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mRPM" )<< 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); - QTest::newRow("mDAC" )<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("mDAC" )<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); - QTest::newRow("mDAC" )<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); - QTest::newRow("mDAC" )<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("msg complete ")<< 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13")); + QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mRate ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mRate ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mRate ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mRate ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12")); } -void tst_models::tst_MDGDrainPump () +void tst_models::tst_MAdjustUltrafiltrationConfirmResponse () { + Model::MAdjustUltrafiltrationConfirmResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) + +#ifdef CONSOLEOUT + qDebug() << index << errorIndex << startIndex << ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mVolume ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mDuration ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGROPumpData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGROPumpData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGROPumpData_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mPressure ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mPressure ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mPressure ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mPressure ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mFlowRate ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mFlowRate ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mFlowRate ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mFlowRate ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mPWM ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mPWM ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mPWM ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mPWM ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGROPumpData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGROPumpData() { + Model::MDGROPump 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.mPressure ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mFlowRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mPWM ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGPressuresData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGPressuresData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGPressuresData_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mROInletPSI ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mROInletPSI ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mROInletPSI ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mROInletPSI ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mROOutletPSI ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mROOutletPSI ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mROOutletPSI ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mROOutletPSI ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mDrainInletPSI ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mDrainInletPSI ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mDrainInletPSI ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mDrainInletPSI ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mDrainOutletPSI") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mDrainOutletPSI") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mDrainOutletPSI") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mDrainOutletPSI") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGPressuresData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGPressuresData() { + Model::MDGPressures 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.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; + case 4: { index = index * sizeof mData._data.mDrainOutletPSI; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGDrainPumpData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGDrainPumpData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGDrainPumpData_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mRPM ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mRPM ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mRPM ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mRPM ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mDAC ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mDAC ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mDAC ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mDAC ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGDrainPumpData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGDrainPumpData() { Model::MDGDrainPump mData; QFETCH(int , errorIndex ); @@ -373,43 +500,158 @@ 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.mRPM ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mDAC ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGOperationMode ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGOperationMode data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGOperationMode_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGOperationMode test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGOperationMode() { + Model::MDGOperationMode 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.mRPM ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 2: { index = index * sizeof mData._data.mDAC ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mOpMode ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; } } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DG Heaters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MDGHeaters_data () -{ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGReservoirData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGReservoirData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGReservoirData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ")<< 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); - QTest::newRow("mMainPrimaryDC ")<< 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mMainPrimaryDC ")<< 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mMainPrimaryDC ")<< 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mMainPrimaryDC ")<< 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); - QTest::newRow("mSmallPrimaryDC")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("mSmallPrimaryDC")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); - QTest::newRow("mSmallPrimaryDC")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); - QTest::newRow("mSmallPrimaryDC")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); - QTest::newRow("mTrimmerDC ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mTrimmerDC ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("mTrimmerDC ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("mTrimmerDC ")<< 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")); + QTest::newRow("mActiveReservoir") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mActiveReservoir") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mActiveReservoir") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mActiveReservoir") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mFillToVol ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mFillToVol ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mFillToVol ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mFillToVol ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mDrainToVol ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mDrainToVol ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mDrainToVol ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mDrainToVol ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGReservoirData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGReservoirData() { + Model::MDGReservoir mData; -void tst_models::tst_MDGHeaters () -{ + 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.mActiveReservoir ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mFillToVol ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mDrainToVol ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGValvesStates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGValvesStates data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGValvesStates_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mStates ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mStates ") << 1 << QByteArray::fromHex(QByteArray("00")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGValvesStates test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGValvesStates() { + Model::MDGValvesStates 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.mStates ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGHeatersData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGHeatersData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGHeatersData_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mMainPrimaryDC ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mMainPrimaryDC ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mMainPrimaryDC ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mMainPrimaryDC ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mSmallPrimaryDC") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mSmallPrimaryDC") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mSmallPrimaryDC") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mSmallPrimaryDC") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mTrimmerDC ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mTrimmerDC ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mTrimmerDC ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mTrimmerDC ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGHeatersData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGHeatersData() { Model::MDGHeaters mData; QFETCH(int , errorIndex ); @@ -419,35 +661,187 @@ 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.mMainPrimaryDC ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mSmallPrimaryDC; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mTrimmerDC ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGLoadCellReadingsData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGLoadCellReadingsData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGLoadCellReadingsData_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("mReservoir1Prim") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mReservoir1Prim") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mReservoir1Prim") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mReservoir1Prim") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mReservoir1Bkup") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mReservoir1Bkup") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mReservoir1Bkup") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mReservoir1Bkup") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mReservoir2Prim") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mReservoir2Prim") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mReservoir2Prim") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mReservoir2Prim") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mReservoir2Bkup") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mReservoir2Bkup") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mReservoir2Bkup") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mReservoir2Bkup") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGLoadCellReadingsData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGLoadCellReadingsData() { + Model::MDGLoadCellReadings 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.mMainPrimaryDC ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 2: { index = index * sizeof mData._data.mSmallPrimaryDC ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 3: { index = index * sizeof mData._data.mTrimmerDC ; 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.mReservoir1Prim; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReservoir1Bkup; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mReservoir2Prim; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mReservoir2Bkup; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; } } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Adjust Ultrafiltration State Response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MAdjustUltrafiltrationStateResponse_data () -{ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGTemperaturesData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGTemperaturesData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGTemperaturesData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ")<< 0 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F")); + QTest::newRow("mInletPrimaryHeater ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mInletPrimaryHeater ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mInletPrimaryHeater ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mInletPrimaryHeater ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mOutletPrimaryHeater ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mOutletPrimaryHeater ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mOutletPrimaryHeater ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mOutletPrimaryHeater ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mConductivitySensor1 ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mConductivitySensor1 ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mConductivitySensor1 ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mConductivitySensor1 ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mConductivitySensor2 ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mConductivitySensor2 ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mConductivitySensor2 ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mConductivitySensor2 ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mOutletRedundancy ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mOutletRedundancy ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mOutletRedundancy ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mOutletRedundancy ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12")); + QTest::newRow("mInletDialysate ") << 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13")); + QTest::newRow("mInletDialysate ") << 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14")); + QTest::newRow("mInletDialysate ") << 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15")); + QTest::newRow("mInletDialysate ") << 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16")); + QTest::newRow("mPrimaryHeaterThermoCouple ") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17")); + QTest::newRow("mPrimaryHeaterThermoCouple ") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18")); + QTest::newRow("mPrimaryHeaterThermoCouple ") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19")); + QTest::newRow("mPrimaryHeaterThermoCouple ") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A")); + QTest::newRow("mTrimmerHeaterThermoCouple ") << 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); + QTest::newRow("mTrimmerHeaterThermoCouple ") << 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C")); + QTest::newRow("mTrimmerHeaterThermoCouple ") << 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D")); + QTest::newRow("mTrimmerHeaterThermoCouple ") << 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E")); + QTest::newRow("mPrimaryHeaterColdJunction ") << 9 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F")); + QTest::newRow("mPrimaryHeaterColdJunction ") << 9 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20")); + QTest::newRow("mPrimaryHeaterColdJunction ") << 9 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21")); + QTest::newRow("mPrimaryHeaterColdJunction ") << 9 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22")); + QTest::newRow("mTrimmerHeaterColdJunction ") << 10 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23")); + QTest::newRow("mTrimmerHeaterColdJunction ") << 10 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24")); + QTest::newRow("mTrimmerHeaterColdJunction ") << 10 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25")); + QTest::newRow("mTrimmerHeaterColdJunction ") << 10 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26")); + QTest::newRow("mPrimaryHeaterInternal ") << 11 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27")); + QTest::newRow("mPrimaryHeaterInternal ") << 11 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28")); + QTest::newRow("mPrimaryHeaterInternal ") << 11 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29")); + QTest::newRow("mPrimaryHeaterInternal ") << 11 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A")); + QTest::newRow("mTrimmerHeaterInternal ") << 12 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B")); + QTest::newRow("mTrimmerHeaterInternal ") << 12 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C")); + QTest::newRow("mTrimmerHeaterInternal ") << 12 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D")); + QTest::newRow("mTrimmerHeaterInternal ") << 12 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E")); } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DGTemperaturesData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_DGTemperaturesData() { + Model::MDGTemperatures mData; -void tst_models::tst_MAdjustUltrafiltrationStateResponse () -{ - Model::MAdjustUltrafiltrationStateResponse mData; + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << index << errorIndex << startIndex << ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mInletPrimaryHeater ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mOutletPrimaryHeater ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mConductivitySensor1 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mConductivitySensor2 ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mOutletRedundancy ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mInletDialysate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mPrimaryHeaterThermoCouple; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 8: { index = index * sizeof mData._data.mTrimmerHeaterThermoCouple; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 9: { index = index * sizeof mData._data.mPrimaryHeaterColdJunction; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 10: { index = index * sizeof mData._data.mTrimmerHeaterColdJunction; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 11: { index = index * sizeof mData._data.mPrimaryHeaterInternal ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 12: { index = index * sizeof mData._data.mTrimmerHeaterInternal ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentStateData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentStateData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +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")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentStateData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentStateData() { + Model::MTreatmentStates mData; + QFETCH(int , errorIndex ); QFETCH(QByteArray, data ); @@ -460,139 +854,383 @@ #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 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; default: QVERIFY2(false, "Incorrect Test"); break; } } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Adjust Ultrafiltration Edit Response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MAdjustUltrafiltrationEditResponse_data () -{ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDOperationModeData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDOperationModeData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDOperationModeData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ")<< 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F")); - QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); - QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); - QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); - QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); - QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); - QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); - QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); - QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); - QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); - QTest::newRow("mDurationDiff ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); - QTest::newRow("mDurationDiff ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); - QTest::newRow("mDurationDiff ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); - QTest::newRow("mDurationDiff ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12")); - QTest::newRow("mRate ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13")); - QTest::newRow("mRate ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14")); - QTest::newRow("mRate ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15")); - QTest::newRow("mRate ")<< 6 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16")); - QTest::newRow("mRateDiff ")<< 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17")); - QTest::newRow("mRateDiff ")<< 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18")); - QTest::newRow("mRateDiff ")<< 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19")); - QTest::newRow("mRateDiff ")<< 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A")); - QTest::newRow("mRateOld ")<< 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); - QTest::newRow("mRateOld ")<< 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C")); - QTest::newRow("mRateOld ")<< 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D")); - QTest::newRow("mRateOld ")<< 8 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E")); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mOpMode ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDOperationModeData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MHDOperationModeData() { + Model::MHDOperationMode mData; -void tst_models::tst_MAdjustUltrafiltrationEditResponse () -{ - Model::MAdjustUltrafiltrationEditResponse mData; + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << index << errorIndex << startIndex << ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mOpMode; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MOutletFlowData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MOutletFlowData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MOutletFlowData_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); + QTest::newRow("mRefUFVol ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mRefUFVol ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mRefUFVol ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mRefUFVol ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mMeasUFVol ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mMeasUFVol ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mMeasUFVol ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mMeasUFVol ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mRotorSpeed ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mRotorSpeed ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mRotorSpeed ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mRotorSpeed ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mMotorSpeed ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mMotorSpeed ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mMotorSpeed ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mMotorSpeed ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mMotorCtlSpeed ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mMotorCtlSpeed ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mMotorCtlSpeed ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mMotorCtlSpeed ") << 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("mMotorCtlCurrent") << 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("mMotorCtlCurrent") << 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("mMotorCtlCurrent") << 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("mMotorCtlCurrent") << 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("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")); + 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")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MOutletFlowData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MOutletFlowData() { + Model::MOutletFlow 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.mRefUFVol ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mMeasUFVol ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mRotorSpeed ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mMotorSpeed ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + 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; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MBloodFlowData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MBloodFlowData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MBloodFlowData_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); + QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mMeasuredFlow ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mMeasuredFlow ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mMeasuredFlow ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mMeasuredFlow ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mRotorSpeed ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mRotorSpeed ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mRotorSpeed ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mRotorSpeed ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mMotorSpeed ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mMotorSpeed ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mMotorSpeed ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mMotorSpeed ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mMotorCtlSpeed ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mMotorCtlSpeed ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mMotorCtlSpeed ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mMotorCtlSpeed ") << 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("mMotorCtlCurrent") << 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("mMotorCtlCurrent") << 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("mMotorCtlCurrent") << 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("mMotorCtlCurrent") << 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("mPWMDutyCycle ") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17")); + QTest::newRow("mPWMDutyCycle ") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18")); + QTest::newRow("mPWMDutyCycle ") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19")); + QTest::newRow("mPWMDutyCycle ") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MBloodFlowData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MBloodFlowData() { + Model::MBloodFlow mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) #ifdef CONSOLEOUT qDebug() << index << errorIndex << startIndex << ok << data ; #endif switch (errorIndex) { - case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 3: { index = index * sizeof mData._data.mVolume ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 4: { index = index * sizeof mData._data.mDuration ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 5: { index = index * sizeof mData._data.mDurationDiff ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 6: { index = index * sizeof mData._data.mRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 7: { index = index * sizeof mData._data.mRateDiff ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 8: { index = index * sizeof mData._data.mRateOld ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mFlowSetPoint ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mMeasuredFlow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mRotorSpeed ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mMotorSpeed ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mMotorCtlSpeed ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mMotorCtlCurrent; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mPWMDutyCycle ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; } } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Adjust Ultrafiltration Confirm Response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MAdjustUltrafiltrationConfirmResponse_data () -{ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDialysateFlowData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDialysateFlowData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDialysateFlowData_data () { QTest::addColumn("errorIndex"); QTest::addColumn("data"); - QTest::newRow("msg complete ")<< 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13")); - QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mAccepted ")<< 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); - QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); - QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); - QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); - QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("mVolume ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); - QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); - QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); - QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); - QTest::newRow("mDuration ")<< 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); - QTest::newRow("mRate ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); - QTest::newRow("mRate ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); - QTest::newRow("mRate ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); - QTest::newRow("mRate ")<< 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12")); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B")); + QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mFlowSetPoint ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mMeasuredFlow ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mMeasuredFlow ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mMeasuredFlow ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mMeasuredFlow ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mRotorSpeed ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mRotorSpeed ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mRotorSpeed ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mRotorSpeed ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mMotorSpeed ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); + QTest::newRow("mMotorSpeed ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); + QTest::newRow("mMotorSpeed ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); + QTest::newRow("mMotorSpeed ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); + QTest::newRow("mMotorCtlSpeed ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F")); + QTest::newRow("mMotorCtlSpeed ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10")); + QTest::newRow("mMotorCtlSpeed ") << 5 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11")); + QTest::newRow("mMotorCtlSpeed ") << 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("mMotorCtlCurrent") << 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("mMotorCtlCurrent") << 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("mMotorCtlCurrent") << 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("mMotorCtlCurrent") << 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("mPWMDutyCycle ") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17")); + QTest::newRow("mPWMDutyCycle ") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18")); + QTest::newRow("mPWMDutyCycle ") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19")); + QTest::newRow("mPWMDutyCycle ") << 7 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A")); } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MDialysateFlowData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MDialysateFlowData() { + Model::MDialysateFlow mData; -void tst_models::tst_MAdjustUltrafiltrationConfirmResponse () -{ - Model::MAdjustUltrafiltrationConfirmResponse mData; + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << index << errorIndex << startIndex << ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mFlowSetPoint ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mMeasuredFlow ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mRotorSpeed ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 4: { index = index * sizeof mData._data.mMotorSpeed ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 5: { index = index * sizeof mData._data.mMotorCtlSpeed ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 6: { index = index * sizeof mData._data.mMotorCtlCurrent; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 7: { index = index * sizeof mData._data.mPWMDutyCycle ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentTimeData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentTimeData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentTimeData_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("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")); + QTest::newRow("mElapsed ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mElapsed ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mElapsed ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mElapsed ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mRemaining ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mRemaining ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mRemaining ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mRemaining ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MTreatmentTimeData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MTreatmentTimeData() { + Model::MTreatmentTime 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.mTotal ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mElapsed ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mRemaining; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPressureOcclusionData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPressureOcclusionData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MPressureOcclusionData_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" "10" "11" "12" "13")); + QTest::newRow("mArterialPressure ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mArterialPressure ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mArterialPressure ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mArterialPressure ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mVenousPressure ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("mVenousPressure ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("mVenousPressure ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("mVenousPressure ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); + QTest::newRow("mBloodPumpOcclusion ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + 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")); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPressureOcclusionData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MPressureOcclusionData() { + Model::MPressureOcclusion mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) #ifdef CONSOLEOUT qDebug() << index << errorIndex << startIndex << ok << data ; #endif switch (errorIndex) { - case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 3: { index = index * sizeof mData._data.mVolume ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 4: { index = index * sizeof mData._data.mDuration ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 5: { index = index * sizeof mData._data.mRate ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + 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; default: QVERIFY2(false, "Incorrect Test"); break; } } + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPowerOff ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPowerOff data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MPowerOff_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mStatus ") << 1 << QByteArray::fromHex(QByteArray()); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPowerOff test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MPowerOff() { + Model::MPowerOff 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.mStatus; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +