TEST(Result, constructFromfailureRes) { Result bResult(TestResult::B); bResult << "<B>"; Result trans(bResult, TestResult::D); trans << "<D>"; EXPECT_EQ("D (Code 669): <D> {B (Code 667): <B>}", trans.format()); EXPECT_EQ(trans.format(), (Result(TestResult::D) << "<D>" << (Result(TestResult::B) << "<B>") ).format()); }
//--------------------------------------------------------------------------- // IsToolHelpSupported // // Checks whether Tool Help library is supported by the current platform //--------------------------------------------------------------------------- static BOOL IsToolHelpSupported() { BOOL bResult(FALSE); HMODULE hModToolHelp; PROC pfnCreateToolhelp32Snapshot; hModToolHelp = ::LoadLibrary("KERNEL32.DLL"); if (NULL != hModToolHelp) { pfnCreateToolhelp32Snapshot = ::GetProcAddress( hModToolHelp, "CreateToolhelp32Snapshot"); bResult = (NULL != pfnCreateToolhelp32Snapshot); ::FreeLibrary(hModToolHelp); } return bResult; }
// Call this function from CMyListView::OnInitialUpdate() or // a dialog's OnInitDialog() function BOOL CClonePairListCtrl::Init(CloneFiles * p_CloneFiles) { BOOL bResult(false); if( p_CloneFiles == NULL) return bResult; CloneFiles::CloneFileVector_t clonefilesvec; p_CloneFiles->getCloneFileVector(clonefilesvec); int numOfClonePairFiles = clonefilesvec.size(); // Insert the columns int iCol = 0; int iColNum; //First column - ID iColNum = this->InsertColumn(iCol, _T("ID"), LVCFMT_LEFT, 50); ASSERT(iCol == iColNum); iCol++; // col 1 // Second - Number of clone pairs iColNum = this->InsertColumn(iCol, _T("Number Of Clone Pairs"), LVCFMT_CENTER, 250); ASSERT(iCol == iColNum); iCol++; // col 2 // Third - Number of File A iColNum = this->InsertColumn(iCol, _T("File A"), LVCFMT_LEFT, 320); ASSERT(iCol == iColNum); iCol++; // col 3 // Third - Number of File B iColNum = this->InsertColumn(iCol, _T("File B"), LVCFMT_LEFT, 320); ASSERT(iCol == iColNum); // now insert rows int iRow=0; while(iRow < numOfClonePairFiles ) { CloneFile clonefile = clonefilesvec[iRow]; int numOfClonePairs = clonefile.getNumberOfClonePairs(); CString fileA; CString fileB; clonefile.getFilesWithoutPath(fileA,fileB); if( m_toolTipTexts.find(fileA) == m_toolTipTexts.end()) { CString tipsA(clonefile.getFileA()); m_toolTipTexts[fileA] = tipsA; } if( m_toolTipTexts.find(fileB) == m_toolTipTexts.end()) { CString tipsB(clonefile.getFileA()); m_toolTipTexts[fileB] = tipsB; } CString idItem; idItem.Format(_T("%d"),iRow+1); CString numOfClonePairsItem; numOfClonePairsItem.Format(_T("%d"),numOfClonePairs); int iRowNum; iRowNum = this->InsertItem(iRow, idItem); ASSERT(iRow == iRowNum); bResult = SetItemText(iRow, 1, numOfClonePairsItem ); bResult = SetItemText(iRow, 2, fileA ); bResult = SetItemText(iRow, 3, fileB ); ++iRow; } // for some reason, if the number of rows is less than or equal to 1, // the rest of the list will not displayed properly, therefore we need // to insert empty line(s) to ensure there are at least twoo rows on the frame if( iRow==1) { this->InsertItem(iRow, _T("")); } else if( iRow==0) { this->InsertItem(0, _T("")); this->InsertItem(1, _T("")); } if( bResult == TRUE) { m_init = true; } return(bResult); }//Init
// ----------------------------------------------------------------------------- // ProfileUtil::CopyToTempStruct // Copies profile attributes from profile to temp data struct // ----------------------------------------------------------------------------- // void ProfileUtil::CopyToTempStruct( CSIPManagedProfile* aProfile, TSIPProfileData& aProfileData ) { // Profile ID TInt err= aProfile->GetParameter(KSIPProfileId,(TUint32 &)aProfileData.iID); if(err) { // don't know what to do } // Access Point index err= aProfile->GetParameter(KSIPAccessPointId ,(TUint32 &)aProfileData.iAPIndex); if(err) { // don't know what to do } // Service provider name const TDesC8 * tmpProviderName = 0; err= aProfile->GetParameter(KSIPProviderName,tmpProviderName); if(err) { // don't know what to do } else { aProfileData.iProviderName.Copy( *tmpProviderName ); // delete tmpProviderName; } // Registration mode TBool bResult(EFalse); err= aProfile->GetParameter(KSIPAutoRegistration,bResult); if(err) { // don't know what to do } if (bResult) { aProfileData.iRegistrationMode = EAlwaysOn; } else { aProfileData.iRegistrationMode = EWhenNeeded; } //reset the value to EFalse since we are not caring err . bResult = EFalse; err= aProfile->GetParameter(KSIPSigComp,bResult); if(err) { // don't know what to do } if ( bResult) { aProfileData.iCompression = EComprYes; } else { aProfileData.iCompression = EComprNo; } //reset the value to EFalse since we are not caring err . // Security negotiation bResult = EFalse; err= aProfile->GetParameter(KSIPSecurityNegotiation ,bResult); if(err) { // don't know what to do } if (bResult) { aProfileData.iSecurity = ESecurityOn; } else { aProfileData.iSecurity = ESecurityOff; } // Profile type aProfileData.iServiceProfile = aProfile->Type(); // Username const TDesC8 * userName = 0; err= aProfile->GetParameter(KSIPUserAor ,userName); if(err) { // don't know what to do } if (userName && (userName->Length() > KSIPProtocolHeader().Length() ) ) { TPtrC8 ptr( *userName); aProfileData.iUsername.Copy( ptr.Right( ptr.Length() - KSIPProtocolHeader().Length() ) ); } else { aProfileData.iUsername.Zero(); } }