当前位置: 首页>>代码示例>>C++>>正文


C++ CTupleBase::getServer方法代码示例

本文整理汇总了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());
}
开发者ID:Meghana-S,项目名称:trex-core,代码行数:28,代码来源:tuple_gen_test.cpp

示例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();


}
开发者ID:Meghana-S,项目名称:trex-core,代码行数:55,代码来源:tuple_gen_test.cpp

示例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);
    }



}
开发者ID:cisco-system-traffic-generator,项目名称:trex-core,代码行数:45,代码来源:tuple_gen_test.cpp


注:本文中的CTupleBase::getServer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。