示例#1
0
/******************************************************************************
Function Name  :  nGenerateTextReport
Input(s)       :  CStdioFile& omReportFile
Output         :  INT
Functionality  :  Generates Text Report
Member of      :  CResultGenerator
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  07/04/2011
Modifications  :
Code Tag       :
******************************************************************************/
INT CResultGenerator::nGenerateTextReport(CStdioFile& omReportFile)
{
    //BUSMASTER Version
    omReportFile.WriteString("\n\t\t\t\tBUSMASTER Version:: BUSMASTER " + m_omStrVersion);
    omReportFile.WriteString("\n\t\t\t\tReport File For:: ");
    omReportFile.WriteString(m_omStrTestSetupFile);
    omReportFile.WriteString("\n\nTestSetup File Information:");
    omReportFile.WriteString("\n---------------------------\n\t");
    omReportFile.WriteString("\n\tTitle: "+ m_omStrTestSetupFile);
    omReportFile.WriteString("\n\tModule Name:"+m_ouHeaderInfo.m_sModuleName.m_omValue);
    omReportFile.WriteString("\n\tVersion: "+m_ouHeaderInfo.m_sVersion.m_omValue);
    omReportFile.WriteString("\n\tDatabase Information:"+m_ouHeaderInfo.m_omDatabasePath);
    omReportFile.WriteString("\n\n");
    omReportFile.WriteString("Engineer Info:");
    omReportFile.WriteString("\n--------------");
    omReportFile.WriteString("\n\tName: "+m_ouHeaderInfo.m_sEngineerInfo1.m_omValue);
    omReportFile.WriteString("\n\tDesignation: "+m_ouHeaderInfo.m_sEngineerInfo2.m_omValue);
    omReportFile.WriteString("\nResults:");
    omReportFile.WriteString("\n-------");
    omReportFile.WriteString("\n");
    INT nTcCount = (INT)m_odTcResultList.GetCount();

    for(INT nTcIndex = 0; nTcIndex< nTcCount; nTcIndex++)
    {
        POSITION pos = m_odTcResultList.FindIndex(nTcIndex);
        CResultTc& ouResultTc = m_odTcResultList.GetAt(pos);
        omReportFile.WriteString("\nTestCase:  "+ouResultTc.m_omTestCase);

        if(ouResultTc.m_eResult == ERRORS)
        {
            omReportFile.WriteString("\nResult:\tFAILED");
        }
        else
        {
            omReportFile.WriteString("\nResult:\tSUCCESS");
        }

        omReportFile.WriteString("\nStratTime:"+SysTimeToString(ouResultTc.m_sStartTime));
        omReportFile.WriteString("\nEndTime:"+SysTimeToString(ouResultTc.m_sEndTime));
        //omReportFile.WriteString("\n");
        INT nVerifyCount = (INT)ouResultTc.m_ouVerifyList.GetCount();

        for(INT nVerifyIndex = 0; nVerifyIndex <nVerifyCount; nVerifyIndex++)
        {
            CString omStrVerify;
            omStrVerify.Format("\n\tVerify - %d", nVerifyIndex+1);
            omReportFile.WriteString(omStrVerify);
            POSITION pos = ouResultTc.m_ouVerifyList.FindIndex(nVerifyIndex);
            CResultVerify& ouVerify = ouResultTc.m_ouVerifyList.GetAt(pos);
            INT nMsgCount = (INT)ouVerify.m_MessageResultList.GetCount();

            if(nMsgCount == 0)
            {
                CString omStrTemp("No Message is Verified");
                omReportFile.WriteString("\n\t\t" + omStrTemp);
            }
            else
            {
                for(INT nMsgIndex = 0; nMsgIndex<nMsgCount; nMsgIndex++)
                {
                    POSITION pos = ouVerify.m_MessageResultList.FindIndex(nMsgIndex);
                    CMessageResult& ouMsgResult = ouVerify.m_MessageResultList.GetAt(pos);
                    omReportFile.WriteString("\n\t\t" + ouMsgResult.m_omMessage + ":");
                    INT nSignalCount = (INT)ouMsgResult.m_SignalResultList.GetCount();

                    for(INT nSignalIndex=0; nSignalIndex<nSignalCount; nSignalIndex++)
                    {
                        CString omStrTemp;
                        POSITION posSignal = ouMsgResult.m_SignalResultList.FindIndex(nSignalIndex);
                        CSignalResult ouSignalResult = ouMsgResult.m_SignalResultList.GetAt(posSignal);
                        omStrTemp.Format("\n\t\t\t%-32s %16s (x = %s) %16s", ouSignalResult.m_omSignal, ouSignalResult.m_omSignalCondition,
                                         ouSignalResult.m_omSignalValue, ouSignalResult.m_omResult);
                        omReportFile.WriteString(omStrTemp);
                    }
                }
            }
        }

        omReportFile.WriteString("\n");
    }

    return 0;
}
示例#2
0
void vConvStrtoByteArray(CByteArray* pomByteArrayBufTx,
                         CHAR* pctempBuf,
                         BOOL bHexON)
{
    char tCh = ' ';
    UINT unCount=0;
    UCHAR ucFirstCh = '\0';
    UCHAR ucSecondCh = '\0';
    UCHAR ucThirdCh = '\0';
    //Copy the modified string to a local Cstring
    //variable and remove all white spaces
    CString omStrTemp(pctempBuf);
    omStrTemp.Remove(tCh);


    INT nStrLength = omStrTemp.GetLength();

    //start converting them into a byte.
    while (nStrLength)
    {
        //get the first char
        ucFirstCh = omStrTemp.GetAt(unCount++);
        //if the value is greater than or equal to zero or
        //less than or equal to nine, get the value by
        //subtracting the ASCII value of '0'
        if (('0' <= ucFirstCh) && (ucFirstCh <= '9'))
        {
            ucFirstCh -='0';
        }
        else
        {
            //The character is between 'a' to 'f'. First
            //convert to lowercase and deduct 87 which
            //will give the correct value for the char
            //as the ASCII value of 'a' is 97.
            ucFirstCh = (UCHAR)tolower (ucFirstCh);
            ucFirstCh-= 87;
        }
        //if the value is greater than or equal to zero or
        //less than or equal to nine, get the value by
        //subtracting the ASCII value of '0'
        nStrLength --;
        if(nStrLength)
        {
            ucSecondCh = omStrTemp.GetAt(unCount++);

            if (('0' <= ucSecondCh) && (ucSecondCh <= '9'))
            {
                ucSecondCh -='0';
            }
            else
            {
                //The character is between 'a' to 'f'. First
                //convert to lowercase and deduct 87 which
                //will give the correct value for the char
                //as the ASCII value of 'a' is 97.
                ucSecondCh = (UCHAR)tolower (ucSecondCh);
                ucSecondCh-= 87;
            }
            //Now add the byte to the byte array
            if(bHexON == TRUE)
            {
                ucFirstCh <<= 4;
                ucFirstCh |= ucSecondCh;
                pomByteArrayBufTx->Add(ucFirstCh);
            }
            nStrLength --;
        }
        if(bHexON == FALSE )
        {
            //if the value is greater than or equal to zero or
            //less than or equal to nine, get the value by
            //subtracting the ASCII value of '0'
            //check if the mode is Decimal ,then get the third character
            if(nStrLength )
            {
                ucThirdCh = omStrTemp.GetAt(unCount++);
                if (('0' <= ucThirdCh) && (ucThirdCh <= '9'))
                {
                    ucThirdCh -='0';
                }
                ucFirstCh  = ucFirstCh * 100;
                ucFirstCh += ucSecondCh * 10;
                ucFirstCh = (UCHAR)(ucFirstCh + ucThirdCh);                 //ucFirstCh += ucThirdCh;
                nStrLength --;
                pomByteArrayBufTx->Add(ucFirstCh);
            }
        }

    }//while (nStrLength);
}