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


C++ TestIntfPrx::opInt方法代码示例

本文整理汇总了C++中TestIntfPrx::opInt方法的典型用法代码示例。如果您正苦于以下问题:C++ TestIntfPrx::opInt方法的具体用法?C++ TestIntfPrx::opInt怎么用?C++ TestIntfPrx::opInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestIntfPrx的用法示例。


在下文中一共展示了TestIntfPrx::opInt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test

TestIntfPrx
allTests(const Ice::CommunicatorPtr& communicator)
{
    string ref = "test:default -p 12010";
    Ice::ObjectPrx obj = communicator->stringToProxy(ref);
    test(obj);
    TestIntfPrx proxy = TestIntfPrx::checkedCast(obj);
    test(proxy);

    cout << "testing enum values... " << flush;

    test(static_cast<int>(benum1) == 0);
    test(static_cast<int>(benum2) == 1);
    test(static_cast<int>(benum3) == ByteConst1);
    test(static_cast<int>(benum4) == ByteConst1 + 1);
    test(static_cast<int>(benum5) == ShortConst1);
    test(static_cast<int>(benum6) == ShortConst1 + 1);
    test(static_cast<int>(benum7) == IntConst1);
    test(static_cast<int>(benum8) == IntConst1 + 1);
    test(static_cast<int>(benum9) == LongConst1);
    test(static_cast<int>(benum10) == LongConst1 + 1);
    test(static_cast<int>(benum11) == ByteConst2);

    test(static_cast<int>(senum1) == 3);
    test(static_cast<int>(senum2) == 4);
    test(static_cast<int>(senum3) == ByteConst1);
    test(static_cast<int>(senum4) == ByteConst1 + 1);
    test(static_cast<int>(senum5) == ShortConst1);
    test(static_cast<int>(senum6) == ShortConst1 + 1);
    test(static_cast<int>(senum7) == IntConst1);
    test(static_cast<int>(senum8) == IntConst1 + 1);
    test(static_cast<int>(senum9) == LongConst1);
    test(static_cast<int>(senum10) == LongConst1 + 1);
    test(static_cast<int>(senum11) == ShortConst2);

    test(static_cast<int>(ienum1) == 0);
    test(static_cast<int>(ienum2) == 1);
    test(static_cast<int>(ienum3) == ByteConst1);
    test(static_cast<int>(ienum4) == ByteConst1 + 1);
    test(static_cast<int>(ienum5) == ShortConst1);
    test(static_cast<int>(ienum6) == ShortConst1 + 1);
    test(static_cast<int>(ienum7) == IntConst1);
    test(static_cast<int>(ienum8) == IntConst1 + 1);
    test(static_cast<int>(ienum9) == LongConst1);
    test(static_cast<int>(ienum10) == LongConst1 + 1);
    test(static_cast<int>(ienum11) == IntConst2);
    test(static_cast<int>(ienum12) == LongConst2);

    test(static_cast<int>(red) == 0);
    test(static_cast<int>(green) == 1);
    test(static_cast<int>(blue) == 2);

    cout << "ok" << endl;

    cout << "testing enum streaming... " << flush;

    Ice::OutputStreamPtr out;
    Ice::ByteSeq bytes;

    const bool encoding_1_0 = communicator->getProperties()->getProperty("Ice.Default.EncodingVersion") == "1.0";

    out = Ice::createOutputStream(communicator);
    out->write(benum11);
    out->finished(bytes);
    test(bytes.size() == 1); // ByteEnum should require one byte

    out = Ice::createOutputStream(communicator);
    out->write(senum11);
    out->finished(bytes);
    test(bytes.size() == (encoding_1_0 ? 2 : 5));

    out = Ice::createOutputStream(communicator);
    out->write(ienum11);
    out->finished(bytes);
    test(bytes.size() == (encoding_1_0 ? 4 : 5));

    out = Ice::createOutputStream(communicator);
    out->write(blue);
    out->finished(bytes);
    test(bytes.size() == 1); // SimpleEnum should require one byte

    cout << "ok" << endl;

    cout << "testing enum operations... " << flush;

    ByteEnum byteEnum;
    test(proxy->opByte(benum1, byteEnum) == benum1);
    test(byteEnum == benum1);
    test(proxy->opByte(benum11, byteEnum) == benum11);
    test(byteEnum == benum11);

    ShortEnum shortEnum;
    test(proxy->opShort(senum1, shortEnum) == senum1);
    test(shortEnum == senum1);
    test(proxy->opShort(senum11, shortEnum) == senum11);
    test(shortEnum == senum11);

    IntEnum intEnum;
    test(proxy->opInt(ienum1, intEnum) == ienum1);
    test(intEnum == ienum1);
//.........这里部分代码省略.........
开发者ID:dayongxie,项目名称:zeroc-ice-androidndk,代码行数:101,代码来源:AllTests.cpp


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