本文整理汇总了C++中TBuf16::Compare方法的典型用法代码示例。如果您正苦于以下问题:C++ TBuf16::Compare方法的具体用法?C++ TBuf16::Compare怎么用?C++ TBuf16::Compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBuf16
的用法示例。
在下文中一共展示了TBuf16::Compare方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doTestStepL
TVerdict CSysUtilsGetLangSWVersionNoNewLinesStep::doTestStepL()
{
TInt err = SetTestPath(ETrue);
if( err != KErrNone )
{
ERR_PRINTF2(_L("Could not turn test path on. Error = %d"), err);
SetTestStepResult(EAbort);
return TestStepResult();
}
INFO_PRINTF1(_L("Test path turned on."));
err = DeletePSProperties();
if( err != KErrNone )
{
ERR_PRINTF2(_L("Could not delete P&S properties. Error = %d"), err);
SetTestStepResult(EAbort);
return TestStepResult();
}
INFO_PRINTF1(_L("Deleted P&S properties successfully."));
_LIT16(KDummy,"xxxxx");
TBuf16<KSysUtilVersionTextLength> version;
version.Insert(0,KDummy);
err = SysUtil::GetLangSWVersion( version );
if ( err == KErrNone)
{
_LIT(KLangSw, "LangSW");
TPtrC16 line;
TESTL( GetStringFromConfig(ConfigSection(), KLangSw, line) );
TBuf16<KSysUtilVersionTextLength> testBuf(line);
if (version.Compare(testBuf)==0)
{
INFO_PRINTF1(_L("Got version "));
INFO_PRINTF1(version);
}
else
{
ERR_PRINTF1(_L("Version not correct"));
INFO_PRINTF1(version);
SetTestStepResult(EFail);
}
}
else
{
ERR_PRINTF2(_L("Error code = %d"), err);
SetTestStepResult(EFail);
}
return TestStepResult();
}
示例2: doTestStepL
TVerdict CSysUtilsGetPRInformationStep::doTestStepL()
{
TInt err=KErrNone;
_LIT16(KDummy,"xxxxx");
TBuf16<KSysUtilVersionTextLength> version;
version.Insert(0,KDummy);
TInt fileErr = CheckIsFileExist( _L("C:\\versions\\purpose.txt"));
if(fileErr == KErrNone)
{
err = DeletePSProperties();
if(err != KErrNone)
{
ERR_PRINTF2(_L("Could not delete P&S properties. Error = %d"), err);
SetTestStepResult(EAbort);
return TestStepResult();
}
INFO_PRINTF1(_L("Deleted P&S properties successfully."));
err = SetTestPath(ETrue);
if( err != KErrNone )
{
ERR_PRINTF2(_L("Could not turn test path off. Error = %d"), err);
SetTestStepResult(EAbort);
return TestStepResult();
}
INFO_PRINTF1(_L("Test path turned off."));
err = SysUtil::GetPRInformation( version );
if ( err != KErrNone )
{
ERR_PRINTF2(_L("Get PR Information failed. Error = %d"), err);
SetTestStepResult(EFail);
}
else
{
//Get the information from the ini file
_LIT(KPRInfo, "PRInfo");
TPtrC16 line;
TESTL( GetStringFromConfig(ConfigSection(), KPRInfo, line) );
TBuf16<KSysUtilVersionTextLength> testBuf(line);
//Parse the information from the ini file
//Replace new-line patterns with real ones
_LIT(KNewLinePattern, "\\n");
_LIT( KNewline, "\n" );
err = testBuf.Find(KNewLinePattern);
while (err != KErrNotFound)
{
// err is a position
testBuf.Replace(err, KNewLinePattern().Length(), KNewline );
err = testBuf.Find(KNewLinePattern);
}
if (version.Compare(testBuf)!=0)
{
ERR_PRINTF1(_L("PR Information formatted incorrectly"));
INFO_PRINTF1(_L("From ini file: "));
INFO_PRINTF1(testBuf);
INFO_PRINTF1(_L("From txt file: "));
INFO_PRINTF1(version);
INFO_PRINTF2(_L("Comparison returned value %d"), version.Compare(testBuf));
SetTestStepResult(EFail);
}
else
{
INFO_PRINTF1(_L("PR Information formatted correctly"));
INFO_PRINTF1(_L("from ini file "));
INFO_PRINTF1(testBuf);
INFO_PRINTF1(_L("from txt file "));
INFO_PRINTF1(version);
}
}
}
else
{
ERR_PRINTF1(_L("purpose.txt is missing, should be included to base packets"));
SetTestStepResult(EFail);
}
err = SetTestPath(EFalse);
return TestStepResult();
}
示例3: doTestStepL
/**
Test Broadcast Messaging Functions
This test step tests performs the following tests:
Test 1 - RMobileBroadcastMessaging::GetCaps (sync)
Test 2 - RMobileBroadcastMessaging::ReceiveMessage (test asynchronous call, then test call and cancel request)
Test 3 - RMobileBroadcastMessaging::ReceiveMessage using V2params (test asynchronous call, then test call and cancel request)
Test 4 - RMobileBroadcastMessaging::ReceiveMessage incorrect buffer size (buffer too big) (async call). Tests fix for INC072923.
Test 5 - RMobileBroadcastMessaging::ReceiveMessage incorrect buffer size (buffer too small) (async call). Tests fix for INC072923.
Test 6 - RMobileBroadcastMessaging::GetFilterSetting (sync)
Test 7 - RMobileBroadcastMessaging::NotifyFilterSettingChange (test asynchronous call, then test call and cancel request)
Test 8 - RMobileBroadcastMessaging::SetFilterSetting (test asynchronous call, then test call and cancel request)
Test 9 - RMobileBroadcastMessaging::GetLanguageFilter (test asynchronous call, then test call and cancel request)
Test 10 - RMobileBroadcastMessaging::SetLanguageFilter (test asynchronous call, then test call and cancel request)
Test 11 - RMobileBroadcastMessaging::NotifyLanguageFilterChange (test asynchronous call, then test call and cancel request)
Test 12 - Test CRetrieveMobilePhoneBroadcastIdList (test asynchronous call, then test call and cancel request)
Test 13 - Test StoreBroadcastIdListL (test asynchronous call, then test call and cancel request)
Test 14 - RMobileBroadcastMessaging::NotifyBroadcastIdListChange (test asynchronous call, then test call and cancel request)
@return The verdict of the test step.
*/
enum TVerdict CTestBroadcastMessaging::doTestStepL()
//
// Test Broadcast Messaging Functions
//
{
iTestCount=1;
INFO_PRINTF1(_L(""));
INFO_PRINTF1(_L("Test Mobile Broadcast Messaging Functionality"));
// LOGTEXT(_L8("Test Mobile Broadcast Messaging Functionality"));
RMobilePhone mmPhone;
TInt ret=mmPhone.Open(iTelServer,DMMTSY_PHONE_NAME);
TEST(ret==KErrNone);
RMobileBroadcastMessaging cbsMessaging;
ret=cbsMessaging.Open(mmPhone);
TEST(ret==KErrNone);
TRequestStatus reqStatus;
// Get Broadcast messaging caps
RMobileBroadcastMessaging::TMobileBroadcastCapsV1 cbsCaps;
RMobileBroadcastMessaging::TMobileBroadcastCapsV1Pckg cbsCapsPckg(cbsCaps);
TEST(cbsMessaging.GetCaps(cbsCapsPckg)==KErrNone);
TEST(cbsCaps.iModeCaps==DMMTSY_BROADCAST_MESSAGING_MODE_CAPS);
TEST(cbsCaps.iFilterCaps==DMMTSY_BROADCAST_MESSAGING_FILTER_CAPS);
INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::GetCaps (sync) passed"), iTestCount++);
// test.Next(_L("OK: RMobileBroadcastMessaging's Get Broadcast caps"));
// Receiving broadcast messages
RMobileBroadcastMessaging::TBroadcastPageData msgData;
RMobileBroadcastMessaging::TMobileBroadcastAttributesV1 msgAtts;
RMobileBroadcastMessaging::TMobileBroadcastAttributesV1Pckg msgAttsPckg(msgAtts);
cbsMessaging.ReceiveMessage(reqStatus, msgData, msgAttsPckg);
User::WaitForRequest(reqStatus);
TEST(reqStatus.Int()==KErrNone);
TEST(msgAtts.iFormat==DMMTSY_CBS_MESSAGE_PDU_FORMAT);
TEST(msgAtts.iFlags==DMMTSY_BROADCAST_MESSAGING_ATT_FLAGS);
TEST(msgData.Compare(DMMTSY_CBS_MESSAGE_PDU) == 0);
// Test cancel
cbsMessaging.ReceiveMessage(reqStatus, msgData, msgAttsPckg);
cbsMessaging.CancelAsyncRequest(EMobileBroadcastMessagingReceiveMessage);
User::WaitForRequest(reqStatus);
TEST(reqStatus.Int()==KErrNone || reqStatus.Int()==KErrCancel);
if (reqStatus.Int()==KErrCancel)
INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::ReceiveMessage (async & cancel (Cancelled Request)) passed"), iTestCount++);
else
{
TEST(msgAtts.iFormat==DMMTSY_CBS_MESSAGE_PDU_FORMAT);
TEST(msgAtts.iFlags==DMMTSY_BROADCAST_MESSAGING_ATT_FLAGS);
TEST(msgData.Compare(DMMTSY_CBS_MESSAGE_PDU) == 0);
INFO_PRINTF2(_L("Test %d - RMobileBroadcastMessaging::ReceiveMessage (async & cancel (Request Not Cancelled)) passed"), iTestCount++);
}
// test.Next(_L("OK: RMobileBroadcastMessaging's Receive Message"));
// Receiving broadcast messages V2
RMobileBroadcastMessaging::TBroadcastPageData msgPage;
RMobileBroadcastMessaging::TMobileBroadcastAttributesV2 msgAttsV2;
RMobileBroadcastMessaging::TMobileBroadcastAttributesV2Pckg msgAttsV2Pckg(msgAttsV2);
cbsMessaging.ReceiveMessage(reqStatus, msgPage, msgAttsV2Pckg);
User::WaitForRequest(reqStatus);
TEST(reqStatus.Int()==KErrNone);
TEST(msgAttsV2.iFormat==DMMTSY_CBS_MESSAGE_PDU_FORMAT);
TEST(msgAttsV2.iFlags==DMMTSY_BROADCAST_MESSAGING_ATT_FLAGS);
TEST(msgPage.Compare(DMMTSY_CBS_MESSAGE_PDU) == 0);
// Test cancel
//.........这里部分代码省略.........