Index: unittests/tst_models.cpp =================================================================== diff -u -r7777127f3b60d5f884cd07adc9d586353d914f69 -r96854524927f212c24b9e4a253baeff2e672228f --- unittests/tst_models.cpp (.../tst_models.cpp) (revision 7777127f3b60d5f884cd07adc9d586353d914f69) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision 96854524927f212c24b9e4a253baeff2e672228f) @@ -39,7 +39,7 @@ #include "MTreatmentTimeData.h" #include "MTreatmentPressureOcclusionData.h" #include "MTreatmentSalineData.h" -#include "MPrimingData.h" +#include "MPreTreatmentPrimeData.h" #include "MTreatmentAdjustUltrafiltrationStateResponse.h" #include "MTreatmentAdjustUltrafiltrationEditResponse.h" @@ -54,7 +54,6 @@ #include "MTreatmentParametersResp.h" #include "MStartTreatmentResponse.h" -#include "MEndTreatmentResponse.h" #include "MessageInterpreter.h" @@ -1726,29 +1725,25 @@ } } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPrimingData ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPrimingData data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MPrimingData_data () { +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPreTreatmentPrime ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPreTreatmentPrime data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MPreTreatmentPrime_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("currentState ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("currentState ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("currentState ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("currentState ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); - QTest::newRow("secondsRemaining ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("secondsRemaining ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); - QTest::newRow("secondsRemaining ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); - QTest::newRow("secondsRemaining ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); - QTest::newRow("secondsTotal ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("secondsTotal ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("secondsTotal ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("secondsTotal ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("timeout ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("timeout ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("timeout ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("timeout ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("countdown ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); + QTest::newRow("countdown ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); + QTest::newRow("countdown ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); + QTest::newRow("countdown ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPrimingData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // -void tst_models::tst_MPrimingData() { - Model::MPrimingData mData; +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MPreTreatmentPrime test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MPreTreatmentPrime() { + Model::MPreTreatmentPrime mData; QFETCH(int , errorIndex ); QFETCH(QByteArray, data ); @@ -1763,10 +1758,9 @@ #endif switch (errorIndex) { - case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 1: { index = index * sizeof mData._data.currentState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 2: { index = index * sizeof mData._data.secondsRemaining ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 3: { index = index * sizeof mData._data.secondsTotal ; 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.mTimeout ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mCountdown ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break;