Beispiel #1
0
// Check equality of the contents of two 16-bit descriptors 
void CTestCase::AssertEqualsL (const TDesC16& aExpected,
                               const TDesC16& aActual,
                               TInt aLineNumber,
                               const TDesC8& aFileName)
    {
    if (aExpected.Compare(aActual) != 0)
        {
        AllocFailureSimulation(EFalse);
        HBufC8* msg = NotEqualsMessageLC (aExpected, aActual);
        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
        CleanupStack::PopAndDestroy(); // msg
        User::Leave (KErrCppUnitAssertionFailed);
        }
    }
TBool CUT_PBASE_T_USBDI_0486::CheckSN(const TDesC16& aSerialNumberGot, const TDesC& aExpectedSerialNumber)
	{
	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0486_CHECKSN_ENTRY, this );
	TBool areSNsIdenticals = (aSerialNumberGot.Compare(aExpectedSerialNumber) == 0);	
	 
	if(!areSNsIdenticals)
		{
		// Incorrect device for this test case	
		OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0486_CHECKSN, "<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
			KErrNotFound,aSerialNumberGot, aExpectedSerialNumber);
		}
	OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0486_CHECKSN_EXIT, this, areSNsIdenticals );
	return areSNsIdenticals;
	}
//
//
//	SIP Uri Logger
//
//
void CSipUriAndAuthorityTest::SipLogError(TInt aError, const TDesC16& aSipUri) const
	{
	TBool wrongError=EFalse;
	
	//compare the Equivalent SIP URI to look for the correct error, these SIP URIs must be in T_UriParserSipUri.txt
	//All equal
	if (0==aSipUri.Compare(KCompsSipUriEqual0) && KErrNone != aError 
		|| 0==aSipUri.Compare(KCompsSipUriEqual1) && KErrNone != aError 
		|| 0==aSipUri.Compare(KCompsSipUriEqual2) && KErrNone != aError)
		{
		iTestHarness->LogIt(KCompsSipUriValidMess0);
		wrongError=ETrue;
		}
	//All not equal		
	if (0==aSipUri.Compare(KCompsSipUriNotEqual0) && KUriUtilsErrDifferentUserInfo == aError 
		|| 0==aSipUri.Compare(KCompsSipUriNotEqual1) && KUriUtilsErrDifferentPath  == aError 
		|| 0==aSipUri.Compare(KCompsSipUriNotEqual2) && KUriUtilsErrDifferentPort  == aError )
		{
		iTestHarness->LogIt(KCompsSipUriEqualMess1);
		}

	//compare the SIP URIs to look for the correct error returned by CUri for validation
	if (0==aSipUri.Compare(KCompsSipUriNotEqual1) && KUriUtilsErrDifferentPath  != aError )
		{
		iTestHarness->LogIt(KCompsSipUriInvalidMess9);
		wrongError=ETrue;
		}


	if (0==aSipUri.Compare(KCompsSipUriValid0) && KErrNone!= aError
		|| 0==aSipUri.Compare(KCompsSipUriValid1) && KErrNone!= aError)
		{
		iTestHarness->LogIt(KCompsSipUriValidMess0);
		wrongError=ETrue;
		}

	if (0==aSipUri.Compare(KCompsSipUriInvalid0) && KErrNotSupported != aError)
		{
		iTestHarness->LogIt(KCompsSipUriInvalidMess0);
		wrongError=ETrue;
		}
	
	if( 0==aSipUri.Compare(KCompsSipUriInvalid5) && KUriUtilsErrInvalidParam!= aError
		|| 0==aSipUri.Compare(KCompsSipUriInvalid6) && KUriUtilsErrInvalidParam!= aError)
		{
		iTestHarness->LogIt(KCompsSipUriInvalidMess1);
		wrongError=ETrue;
		}
	
	if (0==aSipUri.Compare(KCompsSipUriInvalid3) && KUriUtilsErrInvalidHost!= aError)
		{
		iTestHarness->LogIt(KCompsSipUriInvalidMess2);
		wrongError=ETrue;
		}
		
	if (0==aSipUri.Compare(KCompsSipUriInvalid2) && KUriUtilsErrInvalidHeaders != aError)
		{
		iTestHarness->LogIt(KCompsSipUriInvalidMess8);
		wrongError=ETrue;
		}

	if (0==aSipUri.Compare(KCompsSipUriInvalid1) && KUriUtilsErrInvalidPort != aError
		|| 0==aSipUri.Compare(KCompsSipUriInvalid4) && KUriUtilsErrInvalidPort!= aError
		|| 0==aSipUri.Compare(KCompsSipUriNotEqual2) && KUriUtilsErrDifferentPort  != aError)
		{
		iTestHarness->LogIt(KCompsSipUriInvalidMess3);
		wrongError=ETrue;
		}

	if (0==aSipUri.Compare(KCompsSipUriInvalid7) && KUriUtilsErrInvalidUserInfo!= aError
		|| 0==aSipUri.Compare(KCompsSipUriNotEqual0) && KUriUtilsErrDifferentUserInfo != aError)
		{
		iTestHarness->LogIt(KCompsSipUriInvalidMess7);
		wrongError=ETrue;
		}

	if (wrongError)
		{
		iTestHarness->LogIt(KCompsSipUriInvalidMess5);
		}
	
	LogErrorMessage(aSipUri, aError);
	
	if (wrongError)
		{
		iTestHarness->EndTest(aError);
		}		
	else
		{
		iTestHarness->EndTest(KErrNone);	
		}
	}