本文整理汇总了C++中CTupleBase::getServer方法的典型用法代码示例。如果您正苦于以下问题:C++ CTupleBase::getServer方法的具体用法?C++ CTupleBase::getServer怎么用?C++ CTupleBase::getServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTupleBase
的用法示例。
在下文中一共展示了CTupleBase::getServer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printf
/* tuple generator using CClientInfoL*/
TEST(tuple_gen_2,GenerateTuple) {
CTupleGeneratorSmart gen;
gen.Create(1, 1);
gen.add_client_pool(cdSEQ_DIST,0x10000001,0x10000f01,64000,4,NULL,0,0);
gen.add_server_pool(cdSEQ_DIST,0x30000001,0x40000001,64000,4,false);
CTupleTemplateGeneratorSmart template_1;
template_1.Create(&gen,0,0);
CTupleBase result;
uint32_t result_src;
uint32_t result_dest;
uint16_t result_port;
for(int i=0;i<10;i++) {
template_1.GenerateTuple(result);
printf(" C:%x S:%x P:%d \n",result.getClient(),result.getServer(),result.getClientPort());
result_src = result.getClient();
result_dest = result.getServer();
result_port = result.getClientPort();
EXPECT_EQ(result_src, (uint32_t)(0x10000001+i));
EXPECT_EQ(result_dest, (uint32_t) (((0x30000001+i)) ) );
EXPECT_EQ(result_port, 1024);
}
gen.Delete();
// EXPECT_EQ((size_t)0, gen.m_clients.size());
}
示例2:
TEST(tuple_gen,GenerateTuple2) {
CClientPool c_gen;
CClientPool c_gen_2;
c_gen.Create(cdSEQ_DIST,
0x10000001, 0x1000000f, 64000,4,NULL,false,
0,0);
CServerPool s_gen;
CServerPool s_gen_2;
s_gen.Create(cdSEQ_DIST,
0x30000001, 0x30000ff1, 64000,10);
CTupleBase result;
uint32_t result_src;
uint32_t result_dest;
uint16_t result_port;
for(int i=0;i<200;i++) {
c_gen.GenerateTuple(result);
s_gen.GenerateTuple(result);
// gen.Dump(stdout);
// fprintf(stdout, "i:%d\n",i);
result_src = result.getClient();
result_dest = result.getServer();
result_port = result.getClientPort();
EXPECT_EQ(result_src, (uint32_t)(0x10000001+i%15));
EXPECT_EQ(result_dest, (uint32_t)((0x30000001+i) ) );
EXPECT_EQ(result_port, 1024+i/15);
}
s_gen.Delete();
c_gen.Delete();
// EXPECT_EQ((size_t)0, gen.m_clients.size());
c_gen.Create(cdSEQ_DIST,
0x10000001, 0x1000000f, 64000,400,NULL,false,
0,0);
s_gen.Create(cdSEQ_DIST,
0x30000001, 0x30000001, 64000,10);
for(int i=0;i<200;i++) {
s_gen.GenerateTuple(result);
c_gen.GenerateTuple(result);
// gen.Dump(stdout);
// fprintf(stdout, "i:%d\n",i);
result_src = result.getClient();
result_dest = result.getServer();
result_port = result.getClientPort();
EXPECT_EQ(result_src, (uint32_t)(0x10000001+i%15));
EXPECT_EQ(result_dest, (uint32_t) (((0x30000001)) ) );
EXPECT_EQ(result_port, 1024+i/15);
}
s_gen.Delete();
c_gen.Delete();
}
示例3:
TEST(tuple_gen_2,GenerateTuple2) {
CTupleGeneratorSmart gen;
gen.Create(1, 1);
gen.add_client_pool(cdSEQ_DIST,0x10000001,0x1000000f,64000,4,g_dummy,0,0);
gen.add_server_pool(cdSEQ_DIST,0x30000001,0x40000001,64000,4,false);
CTupleTemplateGeneratorSmart template_1;
template_1.Create(&gen,0,0);
CTupleBase result;
uint32_t result_src;
uint32_t result_dest;
uint16_t result_port;
for(int i=0;i<200;i++) {
template_1.GenerateTuple(result);
// gen.Dump(stdout);
// fprintf(stdout, "i:%d\n",i);
result_src = result.getClient();
result_dest = result.getServer();
result_port = result.getClientPort();
EXPECT_EQ(result_src, (uint32_t)(0x10000001+i%15));
EXPECT_EQ(result_dest, (uint32_t)((0x30000001+i) ) );
EXPECT_EQ(result_port, 1024+i/15);
}
gen.Delete();
// EXPECT_EQ((size_t)0, gen.m_clients.size());
gen.Create(1, 1);
gen.add_client_pool(cdSEQ_DIST,0x10000001,0x1000000f,64000,4,g_dummy,0,0);
gen.add_server_pool(cdSEQ_DIST,0x30000001,0x40000001,64000,4,false);
template_1.Create(&gen,0,0);
for(int i=0;i<200;i++) {
template_1.GenerateTuple(result);
// gen.Dump(stdout);
// fprintf(stdout, "i:%d\n",i);
result_src = result.getClient();
result_dest = result.getServer();
result_port = result.getClientPort();
EXPECT_EQ(result_src, (uint32_t)(0x10000001+i%15));
EXPECT_EQ(result_dest, (uint32_t) (((0x30000001+i)) ) );
EXPECT_EQ(result_port, 1024+i/15);
}
}