Index: unittests/tst_models.cpp =================================================================== diff -u -r4489378415df8f8398f59a20ca637b39f2ed2613 -r62dbaac7d0c3da3d46276d958072fcc3bf86a674 --- unittests/tst_models.cpp (.../tst_models.cpp) (revision 4489378415df8f8398f59a20ca637b39f2ed2613) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision 62dbaac7d0c3da3d46276d958072fcc3bf86a674) @@ -2748,10 +2748,10 @@ QTest::addColumn("data"); QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); - QTest::newRow("mEventID . ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mEventID . ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mEventID . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mEventID . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mEventID ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mEventID ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mEventID ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mEventID ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); int lastElementCount = 3; // The number of elements in the last row int errorIndex_index = 1; // the errorIndex of the current string key @@ -2793,10 +2793,10 @@ QTest::addColumn("data"); QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(5)); - QTest::newRow("mBloodFlowRate . ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mBloodFlowRate . ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mBloodFlowRate . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mBloodFlowRate . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mBloodFlowRate ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mBloodFlowRate ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mBloodFlowRate ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mBloodFlowRate ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); int lastElementCount = 3; // The number of elements in the last row int errorIndex_index = 1; // the errorIndex of the current string key @@ -2843,10 +2843,10 @@ QTest::addColumn("data"); QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); - QTest::newRow("mAlarmID . ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mAlarmID . ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mAlarmID . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mAlarmID . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAlarmID ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); int lastElementCount = 3; // The number of elements in the last row int errorIndex_index = 1; // the errorIndex of the current string key @@ -2890,10 +2890,10 @@ QTest::addColumn("data"); QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(1)); - QTest::newRow("mEpoch . ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mEpoch . ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mEpoch . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mEpoch . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mEpoch ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mEpoch ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mEpoch ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mEpoch ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDRTCEpochData test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // @@ -2929,10 +2929,10 @@ QTest::addColumn("data"); QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); - QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mResult ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mResult ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mResult ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mResult ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); int lastElementCount = 3; // The number of elements in the last row int errorIndex_index = 1; // the errorIndex of the current string key @@ -2972,10 +2972,10 @@ QTest::addColumn("data"); QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); - QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mResult . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mResult ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mResult ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mResult ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mResult ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MHDPostFinalResult test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // @@ -3009,10 +3009,10 @@ QTest::addColumn("data"); QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); - QTest::newRow("mAccepted . ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mAccepted . ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mAccepted . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mAccepted . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); int lastElementCount = 3; // The number of elements in the last row int errorIndex_index = 1; // the errorIndex of the current string key @@ -3052,10 +3052,10 @@ QTest::addColumn("data"); QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); - QTest::newRow("mAccepted . ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mAccepted . ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mAccepted . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mAccepted . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); int lastElementCount = 3; // The number of elements in the last row int errorIndex_index = 1; // the errorIndex of the current string key @@ -3095,10 +3095,10 @@ QTest::addColumn("data"); QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); - QTest::newRow("mAccepted . ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mAccepted . ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mAccepted . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mAccepted . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); int lastElementCount = 3; // The number of elements in the last row int errorIndex_index = 1; // the errorIndex of the current string key @@ -3196,10 +3196,10 @@ QTest::addColumn("data"); QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); - QTest::newRow("mLastServiceDateEpoch . ") << 1 << QByteArray::fromHex(QByteArray()); - QTest::newRow("mLastServiceDateEpoch . ") << 1 << QByteArray::fromHex(QByteArray("00")); - QTest::newRow("mLastServiceDateEpoch . ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); - QTest::newRow("mLastServiceDateEpoch . ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + QTest::newRow("mLastServiceDateEpoch ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mLastServiceDateEpoch ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mLastServiceDateEpoch ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mLastServiceDateEpoch ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); int lastElementCount = 3; // The number of elements in the last row int errorIndex_index = 1; // the errorIndex of the current string key @@ -3232,6 +3232,517 @@ } } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustRinsebackResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustRinsebackResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustRinsebackResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustRinsebackResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustRinsebackResponse() { + Model::MAdjustRinsebackResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustRecirculateResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustRecirculateResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustRecirculateResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustRecirculateResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustRecirculateResponse() { + Model::MAdjustRecirculateResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustTreatmentEndResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustTreatmentEndResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustTreatmentEndResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); + +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustTreatmentEndResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustTreatmentEndResponse() { + Model::MAdjustTreatmentEndResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustSalineResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustSalineResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustSalineResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); + lastElementCount = helperFunction_addSetOfFour_rows("mTarget", ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustSalineResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustSalineResponse() { + Model::MAdjustSalineResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mTarget ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustWaterSampleResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustWaterSampleResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustWaterSampleResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustWaterSampleResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustWaterSampleResponse() { + Model::MAdjustWaterSampleResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustStartTreatmentResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustStartTreatmentResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustStartTreatmentResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustStartTreatmentResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustStartTreatmentResponse() { + Model::MAdjustStartTreatmentResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientConnectionConfirmResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientConnectionConfirmResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustPatientConnectionConfirmResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientConnectionConfirmResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustPatientConnectionConfirmResponse() { + Model::MAdjustPatientConnectionConfirmResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientConnectionBeginResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientConnectionBeginResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustPatientConnectionBeginResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustPatientConnectionBeginResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustPatientConnectionBeginResponse() { + Model::MAdjustPatientConnectionBeginResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesPrimeResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesPrimeResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisposablesPrimeResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesPrimeResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisposablesPrimeResponse() { + Model::MAdjustDisposablesPrimeResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesConfirmResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesConfirmResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisposablesConfirmResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisposablesConfirmResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisposablesConfirmResponse() { + Model::MAdjustDisposablesConfirmResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisinfectStartResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisinfectStartResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisinfectStartResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisinfectStartResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisinfectStartResponse() { + Model::MAdjustDisinfectStartResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisinfectModeResponse ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisinfectModeResponse data definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisinfectModeResponse_data () { + QTest::addColumn("errorIndex"); + QTest::addColumn("data"); + + QTest::newRow("msg complete") << 0 << QByteArray::fromHex(helperFunction_createArray(3)); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray()); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); + QTest::newRow("mAccepted ") << 1 << QByteArray::fromHex(QByteArray("00" "01" "02")); + + int lastElementCount = 3; // The number of elements in the last row + int errorIndex_index = 1; // the errorIndex of the current string key + lastElementCount = helperFunction_addSetOfFour_rows("mReason", ++errorIndex_index, lastElementCount+1); +} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAdjustDisinfectModeResponse test definition ~~~~~~~~~~~~~~~~~~~~~~~~ // +void tst_models::tst_MAdjustDisinfectModeResponse() { + Model::MAdjustDisinfectModeResponse mData; + + QFETCH(int , errorIndex ); + QFETCH(QByteArray, data ); + + int startIndex = 0; + int index = errorIndex - 1; + bool ok = mData.fromByteArray(data, &startIndex); + Q_UNUSED(ok) +#ifdef CONSOLEOUT + qDebug() << " index " << index << " errorIndex " << errorIndex <<" startIndex "<< startIndex << " ok "<< ok << data ; +#endif + + switch (errorIndex) { + case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + + default: + QVERIFY2(false, "Incorrect Test"); + break; + } +} + void tst_models::tst_MAlarmAcknowledgeRequest() { MessageInterpreter interpreter;