293 lines
7.7 KiB
C++
293 lines
7.7 KiB
C++
#include "AutomatedTestReport.h"
|
|
#include "GlobalDefine.h"
|
|
|
|
CAutomatedTestReport::CAutomatedTestReport(QObject *parent) :
|
|
QObject(parent)
|
|
{
|
|
}
|
|
|
|
int CAutomatedTestReport::ClearAutomatedTestReport()
|
|
{
|
|
mTestPinsResult.clear();
|
|
mPinCount = 0;
|
|
mPreTestResult = AUTO_TEST_RESULT_UNKNOWN;
|
|
return RET_OK;
|
|
}
|
|
|
|
int CAutomatedTestReport::SetPinCount(int Pincount)
|
|
{
|
|
mPinCount = Pincount;
|
|
mTestPinsResult.clear();
|
|
for(int i = 0; i < Pincount; i++)
|
|
{
|
|
mTestPinsResult.append(CPinTestResult(i+1));
|
|
}
|
|
|
|
return RET_OK;
|
|
}
|
|
|
|
int CAutomatedTestReport::SetPinResult(int PinNumber, bool ContinuityPassed, bool IsolationPassed)
|
|
{
|
|
int ZeroBasedPinIndex = PinNumber - 1;
|
|
if(ZeroBasedPinIndex < 0 || ZeroBasedPinIndex >= mPinCount) //Try not to crash.
|
|
{
|
|
return RET_ERROR;
|
|
}
|
|
|
|
mTestPinsResult[ZeroBasedPinIndex].mIsolationTestPass = IsolationPassed;
|
|
mTestPinsResult[ZeroBasedPinIndex].mContinuityTestPass = ContinuityPassed;
|
|
|
|
return RET_OK;
|
|
}
|
|
|
|
int CAutomatedTestReport::SetPinTestAllPassed(int PinNumber)
|
|
{
|
|
int ZeroBasedPinIndex = PinNumber - 1;
|
|
if(ZeroBasedPinIndex < 0 || ZeroBasedPinIndex >= mPinCount) //Try not to crash.
|
|
{
|
|
return RET_ERROR;
|
|
}
|
|
|
|
mTestPinsResult[ZeroBasedPinIndex].mIsolationTestPass = true;
|
|
mTestPinsResult[ZeroBasedPinIndex].mContinuityTestPass = true;
|
|
mTestPinsResult[ZeroBasedPinIndex].mPinAssignationTestPass = true;
|
|
return RET_OK;
|
|
}
|
|
|
|
|
|
int CAutomatedTestReport::SetPinContinuityResult(int PinNumber,bool ContinuityPassed)
|
|
{
|
|
int ZeroBasedPinIndex = PinNumber - 1;
|
|
if(ZeroBasedPinIndex < 0 || ZeroBasedPinIndex >= mPinCount) //Try not to crash.
|
|
{
|
|
return RET_ERROR;
|
|
}
|
|
|
|
mTestPinsResult[ZeroBasedPinIndex].mContinuityTestPass = ContinuityPassed;
|
|
|
|
return RET_OK;
|
|
}
|
|
|
|
int CAutomatedTestReport::SetPinIsolationResult(int PinNumber, bool IsolationPassed)
|
|
{
|
|
int ZeroBasedPinIndex = PinNumber - 1;
|
|
if(ZeroBasedPinIndex < 0 || ZeroBasedPinIndex >= mPinCount) //Try not to crash.
|
|
{
|
|
return RET_ERROR;
|
|
}
|
|
|
|
mTestPinsResult[ZeroBasedPinIndex].mIsolationTestPass = IsolationPassed;
|
|
|
|
return RET_OK;
|
|
}
|
|
|
|
int CAutomatedTestReport::SetPinConcordanceTestResult(int PinNumber, bool AssignationTestPassed, int WrongPinNbr)
|
|
{
|
|
int ZeroBasedPinIndex = PinNumber - 1;
|
|
if(ZeroBasedPinIndex < 0 || ZeroBasedPinIndex >= mPinCount) //Try not to crash.
|
|
{
|
|
return RET_ERROR;
|
|
}
|
|
|
|
mTestPinsResult[ZeroBasedPinIndex].mPinAssignationTestPass = AssignationTestPassed;
|
|
if(AssignationTestPassed == false)
|
|
{
|
|
mTestPinsResult[ZeroBasedPinIndex].mWrongAssignationPinNbr = WrongPinNbr;
|
|
}
|
|
|
|
return RET_OK;
|
|
}
|
|
|
|
int CAutomatedTestReport::SetPinSecondTestResult(int PinNumber, bool SecondTestPassed)
|
|
{
|
|
int ZeroBasedPinIndex = PinNumber - 1;
|
|
if(ZeroBasedPinIndex < 0 || ZeroBasedPinIndex >= mPinCount) //Try not to crash.
|
|
{
|
|
return RET_ERROR;
|
|
}
|
|
|
|
mTestPinsResult[ZeroBasedPinIndex].mSecondTestPass = SecondTestPassed;
|
|
|
|
return RET_OK;
|
|
}
|
|
|
|
int CAutomatedTestReport::AddShortedPinToPinTest(int PinNumber, int ShortedPinNumber)
|
|
{
|
|
int ZeroBasedPinIndex = PinNumber - 1;
|
|
if(ZeroBasedPinIndex < 0 || ZeroBasedPinIndex >= mPinCount) //Try not to crash.
|
|
{
|
|
return RET_ERROR;
|
|
}
|
|
|
|
mTestPinsResult[ZeroBasedPinIndex].mShortedPinsList.append(ShortedPinNumber);
|
|
|
|
return RET_OK;
|
|
}
|
|
|
|
int CAutomatedTestReport::SetPreTestResult(bool PreTestPassed)
|
|
{
|
|
mPreTestResult = PreTestPassed;
|
|
return RET_OK;
|
|
}
|
|
|
|
CPinTestResult::CPinTestResult(int PinNumber)
|
|
{
|
|
mPinNumber = PinNumber;
|
|
mContinuityTestPass = AUTO_TEST_RESULT_UNKNOWN;
|
|
mIsolationTestPass = AUTO_TEST_RESULT_UNKNOWN;
|
|
mPinAssignationTestPass = AUTO_TEST_RESULT_UNKNOWN;
|
|
mSecondTestPass = AUTO_TEST_RESULT_UNKNOWN;
|
|
mShortedPinsList.clear();
|
|
mWrongAssignationPinNbr = 0;
|
|
|
|
}
|
|
|
|
CPinTestResult::~CPinTestResult()
|
|
{
|
|
mShortedPinsList.clear();
|
|
}
|
|
|
|
bool CPinTestResult::IsPinTestSuccess()
|
|
{
|
|
if(mPinNumber > 0 &&
|
|
mContinuityTestPass == AUTO_TEST_SUCCESS &&
|
|
mIsolationTestPass == AUTO_TEST_SUCCESS &&
|
|
mPinAssignationTestPass == AUTO_TEST_SUCCESS) //TODO: Add 2nd pass result.
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
QString CAutomatedTestReport::GetPinIsolationResult(int PinNumber)
|
|
{
|
|
int ZeroBasedPinIndex = PinNumber - 1;
|
|
if(ZeroBasedPinIndex < 0 || ZeroBasedPinIndex >= mPinCount) //Try not to crash.
|
|
{
|
|
return QString("?");
|
|
}
|
|
|
|
if(mTestPinsResult[ZeroBasedPinIndex].mIsolationTestPass == AUTO_TEST_RESULT_UNKNOWN)
|
|
{
|
|
return QString("N/A");
|
|
}
|
|
else if(mTestPinsResult[ZeroBasedPinIndex].mIsolationTestPass == AUTO_TEST_SUCCESS)
|
|
{
|
|
return QString("Succès");
|
|
}
|
|
else if(mTestPinsResult[ZeroBasedPinIndex].mIsolationTestPass == AUTO_TEST_FAILED)
|
|
{
|
|
QString Result("Échec[");
|
|
for(int i = 0; i < mTestPinsResult[ZeroBasedPinIndex].mShortedPinsList.size(); i++)
|
|
{
|
|
Result.append(QString("%1").arg(mTestPinsResult[ZeroBasedPinIndex].mShortedPinsList.at(i)));
|
|
if(i != mTestPinsResult[ZeroBasedPinIndex].mShortedPinsList.size() - 1)
|
|
{
|
|
Result.append(",");
|
|
}
|
|
}
|
|
Result.append("]");
|
|
return Result;
|
|
}
|
|
return QString("?");
|
|
}
|
|
|
|
QString CAutomatedTestReport::GetPinContinuityResult(int PinNumber)
|
|
{
|
|
int ZeroBasedPinIndex = PinNumber - 1;
|
|
if(ZeroBasedPinIndex < 0 || ZeroBasedPinIndex >= mPinCount) //Try not to crash.
|
|
{
|
|
return QString("?");
|
|
}
|
|
|
|
if(mTestPinsResult[ZeroBasedPinIndex].mContinuityTestPass == AUTO_TEST_RESULT_UNKNOWN)
|
|
{
|
|
return QString("N/A");
|
|
}
|
|
else if(mTestPinsResult[ZeroBasedPinIndex].mContinuityTestPass == AUTO_TEST_SUCCESS)
|
|
{
|
|
return QString("Succès");
|
|
}
|
|
else if(mTestPinsResult[ZeroBasedPinIndex].mContinuityTestPass == AUTO_TEST_FAILED)
|
|
{
|
|
return QString("Échec");
|
|
}
|
|
return QString("?");
|
|
}
|
|
QString CAutomatedTestReport::GetPinConcordanceResult(int PinNumber)
|
|
{
|
|
int ZeroBasedPinIndex = PinNumber - 1;
|
|
if(ZeroBasedPinIndex < 0 || ZeroBasedPinIndex >= mPinCount) //Try not to crash.
|
|
{
|
|
return QString("?");
|
|
}
|
|
|
|
if(mTestPinsResult[ZeroBasedPinIndex].mPinAssignationTestPass == AUTO_TEST_RESULT_UNKNOWN)
|
|
{
|
|
return QString("N/A");
|
|
}
|
|
else if(mTestPinsResult[ZeroBasedPinIndex].mPinAssignationTestPass == AUTO_TEST_SUCCESS)
|
|
{
|
|
return QString("Succès");
|
|
}
|
|
else if(mTestPinsResult[ZeroBasedPinIndex].mPinAssignationTestPass == AUTO_TEST_FAILED)
|
|
{
|
|
return QString("Échec[%1]").arg(mTestPinsResult[ZeroBasedPinIndex].mWrongAssignationPinNbr);
|
|
}
|
|
return QString("?");
|
|
}
|
|
QString CAutomatedTestReport::GetPinSecondTestResult(int PinNumber)
|
|
{
|
|
int ZeroBasedPinIndex = PinNumber - 1;
|
|
if(ZeroBasedPinIndex < 0 || ZeroBasedPinIndex >= mPinCount) //Try not to crash.
|
|
{
|
|
return QString("?");
|
|
}
|
|
|
|
if(mTestPinsResult[ZeroBasedPinIndex].mSecondTestPass == AUTO_TEST_RESULT_UNKNOWN)
|
|
{
|
|
return QString("N/A");
|
|
}
|
|
else if(mTestPinsResult[ZeroBasedPinIndex].mSecondTestPass == AUTO_TEST_SUCCESS)
|
|
{
|
|
return QString("Succès");
|
|
}
|
|
else if(mTestPinsResult[ZeroBasedPinIndex].mSecondTestPass == AUTO_TEST_FAILED)
|
|
{
|
|
return QString("Échec");
|
|
}
|
|
return QString("?");
|
|
}
|
|
|
|
bool CAutomatedTestReport::IsAutomatedTestSuccess()
|
|
{
|
|
if(mPinCount == 0)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
for(int i = 0; i < mTestPinsResult.size(); i++)
|
|
{
|
|
if(mTestPinsResult[i].IsPinTestSuccess() == false)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
return true;
|
|
}
|
|
|
|
QString CAutomatedTestReport::GetPretestResult()
|
|
{
|
|
if(mPreTestResult)
|
|
{
|
|
return "Succès";
|
|
}
|
|
|
|
return "Échec";
|
|
}
|