本文整理汇总了C++中TTEST2函数的典型用法代码示例。如果您正苦于以下问题:C++ TTEST2函数的具体用法?C++ TTEST2怎么用?C++ TTEST2使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TTEST2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ThreadFunc
TInt ThreadFunc(void* aData)
{
__UHEAP_MARK;
CTrapCleanup* tc = CTrapCleanup::New();
TTEST(tc != NULL);
TThreadData* data = static_cast<TThreadData*> (aData);
TTEST(data != NULL);
RSqlDatabase db;
TInt err = db.Open(KTestDbName1);
TTEST2(err, KErrNone);
err = db.SetIsolationLevel(data->iIsolationLevel);
TTEST2(err, KErrNone);
if(data->iTransType == 1)
{
_LIT8(KBeginTrans, "BEGIN");
err = db.Exec(KBeginTrans);
TTEST(err >= 0);
}
_LIT8(KInsertSql, "INSERT INTO A(Id) VALUES(");
for(TInt id=data->iLowRecNo;id<=data->iHighRecNo;++id)
{
TBuf8<128> sql(KInsertSql);
sql.AppendNum((TInt64)id);
sql.Append(_L(")"));
err = KSqlErrBusy;
const TInt KAttempts = 20;
for(TInt i=0;i<KAttempts&&err==KSqlErrBusy;++i)
{
err = db.Exec(sql);
if(err == KSqlErrBusy)
{
RThread th;
TName name = th.Name();
RDebug::Print(_L("!!!Database locked, Thread: %S, Attempt %d, column value %d\r\n"), &name, i + 1, id);
User::After(1000000);
}
}
TTEST2(err, 1);
}
if(data->iTransType == 1)
{
_LIT8(KCommitTrans, "COMMIT");
err = db.Exec(KCommitTrans);
TTEST(err >= 0);
}
db.Close();
delete tc;
__UHEAP_MARKEND;
return KErrNone;
}
示例2: ns_nskip
/* skip over a domain name */
static const u_char *
ns_nskip(register const u_char *cp)
{
register u_char i;
if (!TTEST2(*cp, 1))
return (NULL);
i = *cp++;
while (i) {
if ((i & INDIR_MASK) == INDIR_MASK)
return (cp + 1);
if ((i & INDIR_MASK) == EDNS0_MASK) {
int bitlen, bytelen;
if ((i & ~INDIR_MASK) != EDNS0_ELT_BITLABEL)
return(NULL); /* unknown ELT */
if (!TTEST2(*cp, 1))
return (NULL);
if ((bitlen = *cp++) == 0)
bitlen = 256;
bytelen = (bitlen + 7) / 8;
cp += bytelen;
} else
cp += i;
if (!TTEST2(*cp, 1))
return (NULL);
i = *cp++;
}
return (cp);
}
示例3: TestThreadL
TInt TestThreadL(void*)
{
__UHEAP_MARK;
CTrapCleanup* tc = CTrapCleanup::New();
RFeatureControl rfc;
TTEST2( rfc.Connect(), KErrNone );
// During restore, feature manager server should be responsive and return KErrServerBusy for write request
TInt err = rfc.EnableFeature( TUid::Uid(0x00000001) );
TTEST2(err, KErrServerBusy);
// During restore, feature manager server should be responsive and NOT return KErrServerBusy for read request
err = rfc.FeatureSupported( TUid::Uid(0x00000001) );
TTEST(err != KErrServerBusy);
rfc.Close();
featMgrIsResponsive = ETrue;
RDebug::Print(_L("+++:TestThread: Query and Modification completed\r\n"));
MainThreadCrS.Signal();
delete tc;
__UHEAP_MARKEND;
return KErrNone;
}
示例4: UpdateThreadFunc
TInt UpdateThreadFunc(void*)
{
__UHEAP_MARK;
CTrapCleanup* tc = CTrapCleanup::New();
TTEST(tc != NULL);
RSqlDatabase db;
TInt err = db.Open(KTestDbName1);
TTEST2(err, KErrNone);
RDebug::Print(_L("---:UpdThread: Set the isolation level to \"Read uncommitted\"\r\n"));
err = db.SetIsolationLevel(RSqlDatabase::EReadUncommitted);
TTEST2(err, KErrNone);
RDebug::Print(_L("---:UpdThread: Begin a write transaction\r\n"));
_LIT8(KBeginTransSql, "BEGIN IMMEDIATE TRANSACTION");
err = db.Exec(KBeginTransSql);
TTEST(err >= 0);
RDebug::Print(_L("---:UpdThread: Update the record\r\n"));
_LIT8(KUpdateSql, "UPDATE A SET Id = ");
TBuf8<64> sql(KUpdateSql);
sql.AppendNum((TInt64)KUpdatedValue);
err = db.Exec(sql);
TTEST(err >= 0);
RDebug::Print(_L("---:UpdThread: Notify the main thread about the update\r\n"));
MainThreadCrS.Signal();
RDebug::Print(_L("---:UpdThread: Wait for permisson to continue...\r\n"));
UpdateThreadCrS.Wait();
RDebug::Print(_L("---:UpdThread: Rollback the update\r\n"));
_LIT8(KRollBackTransSql, "ROLLBACK TRANSACTION");
err = db.Exec(KRollBackTransSql);
TTEST(err >= 0);
RDebug::Print(_L("---:UpdThread: Notify the main thread about the rollback\r\n"));
MainThreadCrS.Signal();
db.Close();
delete tc;
__UHEAP_MARKEND;
return KErrNone;
}
示例5: handle_action
static int
handle_action(const struct mgmt_header_t *pmh, const u_char *p, u_int length)
{
if (!TTEST2(*p, 2))
return 0;
if (length < 2)
return 0;
if (eflag) {
printf(": ");
} else {
printf(" (%s): ", etheraddr_string(pmh->sa));
}
switch (p[0]) {
case 0: printf("Spectrum Management Act#%d", p[1]); break;
case 1: printf("QoS Act#%d", p[1]); break;
case 2: printf("DLS Act#%d", p[1]); break;
case 3: printf("BA "); PRINT_BA_ACTION(p[1]); break;
case 7: printf("HT "); PRINT_HT_ACTION(p[1]); break;
case 13: printf("MeshLMetric "); PRINT_MESHLINK_ACTION(p[1]); break;
case 15: printf("Interwork Act#%d", p[1]); break;
case 16: printf("Resource Act#%d", p[1]); break;
case 17: printf("Proxy Act#%d", p[1]); break;
case 30: printf("MeshPeering "); PRINT_MESHPEERING_ACTION(p[1]); break;
case 32: printf("MeshPath "); PRINT_MESHPATH_ACTION(p[1]); break;
case 127: printf("Vendor Act#%d", p[1]); break;
default:
printf("Reserved(%d) Act#%d", p[0], p[1]);
break;
}
return 1;
}
示例6: handle_deauth
static int
handle_deauth(const struct mgmt_header_t *pmh, const u_char *p)
{
struct mgmt_body_t pbody;
int offset = 0;
const char *reason = NULL;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_REASON_LEN))
return 0;
pbody.reason_code = EXTRACT_LE_16BITS(p);
offset += IEEE802_11_REASON_LEN;
reason = (pbody.reason_code < NUM_REASONS)
? reason_text[pbody.reason_code]
: "Reserved";
if (eflag) {
printf(": %s", reason);
} else {
printf(" (%s): %s", etheraddr_string(pmh->sa), reason);
}
return 1;
}
示例7: handle_reassoc_request
static int
handle_reassoc_request(const u_char *p)
{
struct mgmt_body_t pbody;
int offset = 0;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN +
IEEE802_11_AP_LEN))
return 0;
pbody.capability_info = EXTRACT_LE_16BITS(p);
offset += IEEE802_11_CAPINFO_LEN;
pbody.listen_interval = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_LISTENINT_LEN;
memcpy(&pbody.ap, p+offset, IEEE802_11_AP_LEN);
offset += IEEE802_11_AP_LEN;
parse_elements(&pbody, p, offset);
PRINT_SSID(pbody);
printf(" AP : %s", etheraddr_string( pbody.ap ));
return 1;
}
示例8: handle_probe_response
static int
handle_probe_response(const u_char *p)
{
struct mgmt_body_t pbody;
int offset = 0;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
IEEE802_11_CAPINFO_LEN))
return 0;
memcpy(&pbody.timestamp, p, IEEE802_11_TSTAMP_LEN);
offset += IEEE802_11_TSTAMP_LEN;
pbody.beacon_interval = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_BCNINT_LEN;
pbody.capability_info = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_CAPINFO_LEN;
parse_elements(&pbody, p, offset);
PRINT_SSID(pbody);
PRINT_RATES(pbody);
PRINT_DS_CHANNEL(pbody);
return 1;
}
示例9: carp_print
void
carp_print(register const u_char *bp, register u_int len, int ttl)
{
int version, type;
char *type_s;
TCHECK(bp[0]);
version = (bp[0] & 0xf0) >> 4;
type = bp[0] & 0x0f;
if (type == 1)
type_s = "advertise";
else
type_s = "unknown";
printf("CARPv%d-%s %d: ", version, type_s, len);
if (ttl != 255)
printf("[ttl=%d!] ", ttl);
if (version != 2 || type != 1)
return;
TCHECK(bp[2]);
TCHECK(bp[5]);
printf("vhid=%d advbase=%d advskew=%d demote=%d",
bp[1], bp[5], bp[2], bp[4]);
if (vflag) {
if (TTEST2(bp[0], len) && in_cksum((const u_short*)bp, len, 0))
printf(" (bad carp cksum %x!)",
EXTRACT_16BITS(&bp[6]));
}
return;
trunc:
printf("[|carp]");
}
示例10: handle_assoc_response
static int
handle_assoc_response(const u_char *p)
{
struct mgmt_body_t pbody;
int offset = 0;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_CAPINFO_LEN + IEEE802_11_STATUS_LEN +
IEEE802_11_AID_LEN))
return 0;
pbody.capability_info = EXTRACT_LE_16BITS(p);
offset += IEEE802_11_CAPINFO_LEN;
pbody.status_code = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_STATUS_LEN;
pbody.aid = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_AID_LEN;
parse_elements(&pbody, p, offset);
printf(" AID(%x) :%s: %s", ((u_int16_t)(pbody.aid << 2 )) >> 2 ,
CAPABILITY_PRIVACY(pbody.capability_info) ? " PRIVACY " : "",
(pbody.status_code < NUM_STATUSES
? status_text[pbody.status_code]
: "n/a"));
return 1;
}
示例11: blabel_print
/* print a <domain-name> */
static const u_char *
blabel_print(const u_char *cp)
{
int bitlen, slen, b;
const u_char *bitp, *lim;
char tc;
if (!TTEST2(*cp, 1))
return(NULL);
if ((bitlen = *cp) == 0)
bitlen = 256;
slen = (bitlen + 3) / 4;
lim = cp + 1 + slen;
/* print the bit string as a hex string */
printf("\\[x");
for (bitp = cp + 1, b = bitlen; bitp < lim && b > 7; b -= 8, bitp++) {
TCHECK(*bitp);
printf("%02x", *bitp);
}
if (b > 4) {
TCHECK(*bitp);
tc = *bitp++;
printf("%02x", tc & (0xff << (8 - b)));
} else if (b > 0) {
TCHECK(*bitp);
tc = *bitp++;
printf("%1x", ((tc >> 4) & 0x0f) & (0x0f << (4 - b)));
}
示例12: response
/**
@SYMTestCaseID PDS-EFM-CT-4058
@SYMTestCaseDesc Querying and modifying a feature during restore operation.
Verify that a response is returned from the server during restore.
@SYMTestPriority High
@SYMTestActions Start simulating restore operation
Create a thread that will:
Modify a feature and verify that a response (KErrServerBusy) is received
Query a feature and verify that a response is received (doesn't matter what the result is)
The thread should finished in less than 2 seconds.
Otherwise the test fail.
@SYMTestExpectedResults Test must not fail
@SYMREQ
*/
void TestRestoreResponseL()
{
_LIT(KThreadName, "RstTh");
featMgrIsResponsive = EFalse;
CFeatMgrBURSim* simulate = CFeatMgrBURSim::NewLC();
RThread testThread;
TRequestStatus testStatus;
CleanupClosePushL( testThread );
//Needs to ensure server is started before simulating backup operation
RFeatureControl rfc;
TTEST2( rfc.Connect(), KErrNone ); //This will start the server if not already started
rfc.Close();
simulate->Simulate_CheckRegFileL();
// Simulate a restore
RDebug::Print(_L("Simulating Restore of FeatMgr\r\n"));
simulate->Simulate_StartRestoreL();
TEST2( testThread.Create(KThreadName, &TestThreadL, 0x2000, 0x1000, 0x10000, NULL, EOwnerProcess), KErrNone );
testThread.Logon(testStatus);
TEST2( testStatus.Int(), KRequestPending );
testThread.Resume();
// Wait for 1.5 second for the query thread to finish.
RDebug::Print(_L("+++:MainThread: Wait for query and modification completion...\r\n"));
MainThreadCrS.Wait(threadTimeout);
// If query is responsive within the 1.5 second frame the following check should pass.
TEST (featMgrIsResponsive);
simulate->Simulate_EndRestoreL();
CleanupStack::PopAndDestroy(&testThread);
CleanupStack::PopAndDestroy(simulate);
}
示例13: handle_probe_response
static int
handle_probe_response(const u_char *p)
{
struct mgmt_body_t pbody;
int offset = 0;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
IEEE802_11_CAPINFO_LEN))
return 0;
memcpy(&pbody.timestamp, p, IEEE802_11_TSTAMP_LEN);
offset += IEEE802_11_TSTAMP_LEN;
pbody.beacon_interval = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_BCNINT_LEN;
pbody.capability_info = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_CAPINFO_LEN;
if (!parse_elements(&pbody, p, offset))
return 0;
printf(" (");
fn_print(pbody.ssid.ssid, NULL);
printf(") ");
PRINT_RATES(pbody);
printf(" CH: %u%s", pbody.ds.channel,
CAPABILITY_PRIVACY(pbody.capability_info) ? ", PRIVACY" : "" );
return 1;
}
示例14: handle_assoc_request
static int
handle_assoc_request(const u_char *p, u_int length)
{
struct mgmt_body_t pbody;
int offset = 0;
int ret;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN))
return 0;
if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN)
return 0;
pbody.capability_info = EXTRACT_LE_16BITS(p);
offset += IEEE802_11_CAPINFO_LEN;
length -= IEEE802_11_CAPINFO_LEN;
pbody.listen_interval = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_LISTENINT_LEN;
length -= IEEE802_11_LISTENINT_LEN;
ret = parse_elements(&pbody, p, offset, length);
PRINT_SSID(pbody);
PRINT_RATES(pbody);
return ret;
}
示例15: handle_beacon
static int
handle_beacon(const u_char *p, u_int length)
{
struct mgmt_body_t pbody;
int offset = 0;
int ret;
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
IEEE802_11_CAPINFO_LEN))
return 0;
if (length < IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
IEEE802_11_CAPINFO_LEN)
return 0;
memcpy(&pbody.timestamp, p, IEEE802_11_TSTAMP_LEN);
offset += IEEE802_11_TSTAMP_LEN;
length -= IEEE802_11_TSTAMP_LEN;
pbody.beacon_interval = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_BCNINT_LEN;
length -= IEEE802_11_BCNINT_LEN;
pbody.capability_info = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_CAPINFO_LEN;
length -= IEEE802_11_CAPINFO_LEN;
ret = parse_elements(&pbody, p, offset, length);
PRINT_SSID(pbody);
PRINT_RATES(pbody);
printf(" %s",
CAPABILITY_ESS(pbody.capability_info) ? "ESS" : "IBSS");
PRINT_DS_CHANNEL(pbody);
return ret;
}