Index: unittests/tst_models.cpp =================================================================== diff -u -r51bfd04e3f843dd29f7171a678eb000434efd18c -rc9a1c1dd6e73cba5f266595f948c77422472a150 --- unittests/tst_models.cpp (.../tst_models.cpp) (revision 51bfd04e3f843dd29f7171a678eb000434efd18c) +++ unittests/tst_models.cpp (.../tst_models.cpp) (revision c9a1c1dd6e73cba5f266595f948c77422472a150) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file tst_models.cpp - * \author (last) Tiffany Mejia - * \date (last) 18-Jul-2022 + * \author (last) Behrouz NematiPour + * \date (last) 11-Sep-2022 * \author (original) Behrouz NematiPour * \date (original) 21-Apr-2020 * @@ -19,9 +19,9 @@ // Project // -- HD Adjustment -- //-- HD disinfect -#include "MDisinfectAdjustChemicalConfirmResponse.h" // need to test -#include "MDisinfectAdjustRequests.h" -#include "MDisinfectAdjustResponse.h"// need to test +//#include "MDisinfectAdjustChemicalConfirmResponse.h" // need to test +//#include "MDisinfectAdjustRequests.h" +//#include "MDisinfectAdjustResponse.h"// need to test //-- HD Adjustment Post Treatment #include "MPostTreatmentAdjustTreatmentLogResponse.h" #include "MPostTreatmentAdjustDisposablesRemovalConfirmResponse.h" // need to test @@ -80,7 +80,7 @@ #include "MAdjustDGServiceDatesResponse.h" //-- DG Disinfect Data -#include "MDisinfectStatesData.h" +//#include "MDisinfectStatesData.h" //-- DG Post Data #include "MDGPostSingleResultData.h" @@ -980,10 +980,10 @@ QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); QTest::newRow("mReason ")<< 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); - QTest::newRow("mState ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mState ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("mState ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("mState ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); + QTest::newRow("mUFState ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); + QTest::newRow("mUFState ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); + QTest::newRow("mUFState ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); + QTest::newRow("mUFState ")<< 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); } void tst_models::tst_MAdjustUltrafiltrationStateResponse () @@ -1005,7 +1005,7 @@ case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 1: { index = index * sizeof mData._data.mAccepted ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 2: { index = index * sizeof mData._data.mReason ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 3: { index = index * sizeof mData._data.mState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; + case 3: { index = index * sizeof mData._data.mUFState ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; @@ -2217,7 +2217,7 @@ void tst_models::tst_MTreatmentBloodPrimeData_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("msg complete ") << 0 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray()); QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00")); QTest::newRow("mTarget ") << 1 << QByteArray::fromHex(QByteArray("00" "01")); @@ -2226,11 +2226,6 @@ QTest::newRow("mCurrent ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); QTest::newRow("mCurrent ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); QTest::newRow("mCurrent ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); - QTest::newRow("mSafety ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mSafety ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("mSafety ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("mSafety ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); - } void tst_models::tst_MTreatmentBloodPrimeData() { @@ -2251,7 +2246,6 @@ case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 1: { index = index * sizeof mData._data.mTarget ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; case 2: { index = index * sizeof mData._data.mCurrent ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 3: { index = index * sizeof mData._data.mSafety ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; default: QVERIFY2(false, "Incorrect Test"); break; @@ -2748,53 +2742,53 @@ * Teststatus * Fail: None */ -void tst_models::tst_MDisinfectStates_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("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("mFlushStates ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); - QTest::newRow("mFlushStates ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); - QTest::newRow("mFlushStates ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); - QTest::newRow("mFlushStates ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); - QTest::newRow("mHeatStates ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); - QTest::newRow("mHeatStates ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); - QTest::newRow("mHeatStates ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); - QTest::newRow("mHeatStates ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); - QTest::newRow("mChemicalStates ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); - QTest::newRow("mChemicalStates ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); - QTest::newRow("mChemicalStates ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); - QTest::newRow("mChemicalStates ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); -} +//void tst_models::tst_MDisinfectStates_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("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("mFlushStates ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03")); +// QTest::newRow("mFlushStates ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04")); +// QTest::newRow("mFlushStates ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05")); +// QTest::newRow("mFlushStates ") << 2 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06")); +// QTest::newRow("mHeatStates ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07")); +// QTest::newRow("mHeatStates ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08")); +// QTest::newRow("mHeatStates ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09")); +// QTest::newRow("mHeatStates ") << 3 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A")); +// QTest::newRow("mChemicalStates ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B")); +// QTest::newRow("mChemicalStates ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C")); +// QTest::newRow("mChemicalStates ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D")); +// QTest::newRow("mChemicalStates ") << 4 << QByteArray::fromHex(QByteArray("00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E")); +//} -void tst_models::tst_MDisinfectStates() { - Model::MDisinfectStates mData; +//void tst_models::tst_MDisinfectStates() { +// Model::MDisinfectStates mData; - QFETCH(int , errorIndex ); - QFETCH(QByteArray, data ); +// 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 +// 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.mSubMode ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 2: { index = index * sizeof mData._data.mFlushStates ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 3: { index = index * sizeof mData._data.mHeatStates ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - case 4: { index = index * sizeof mData._data.mChemicalStates ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; - default: - QVERIFY2(false, "Incorrect Test"); - break; - } -} +// switch (errorIndex) { +// case 0: { index = 0 ; QVERIFY ( mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; +// case 1: { index = index * sizeof mData._data.mSubMode ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; +// case 2: { index = index * sizeof mData._data.mFlushStates ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; +// case 3: { index = index * sizeof mData._data.mHeatStates ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; +// case 4: { index = index * sizeof mData._data.mChemicalStates ; QVERIFY (! mData.fromByteArray(data)); QCOMPARE( index, startIndex ); } break; +// default: +// QVERIFY2(false, "Incorrect Test"); +// break; +// } +//} // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DG POST MESSAGES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // -- DG Post Single Result Data