本文整理汇总了C++中TestIntfPrx::opSimple方法的典型用法代码示例。如果您正苦于以下问题:C++ TestIntfPrx::opSimple方法的具体用法?C++ TestIntfPrx::opSimple怎么用?C++ TestIntfPrx::opSimple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestIntfPrx
的用法示例。
在下文中一共展示了TestIntfPrx::opSimple方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test
//.........这里部分代码省略.........
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);
test(proxy->opInt(ienum11, intEnum) == ienum11);
test(intEnum == ienum11);
test(proxy->opInt(ienum12, intEnum) == ienum12);
test(intEnum == ienum12);
SimpleEnum s;
test(proxy->opSimple(green, s) == green);
test(s == green);
cout << "ok" << endl;
cout << "testing enum exceptions... " << flush;
try
{
proxy->opByte(static_cast<ByteEnum>(-1), byteEnum); // Negative enumerators are not supported
test(false);
}
catch(const Ice::MarshalException&)
{
}
try
{
proxy->opByte(static_cast<ByteEnum>(127), byteEnum); // Invalid enumerator
test(false);
}
catch(const Ice::MarshalException&)
{
}
try
{
proxy->opShort(static_cast<ShortEnum>(-1), shortEnum); // Negative enumerators are not supported
test(false);
}
catch(const Ice::MarshalException&)
{
}
try
{
proxy->opShort(static_cast<ShortEnum>(0), shortEnum); // Invalid enumerator
test(false);
}
catch(const Ice::MarshalException&)
{
}
try
{
proxy->opShort(static_cast<ShortEnum>(32767), shortEnum); // Invalid enumerator
test(false);
}
catch(const Ice::MarshalException&)
{
}
try
{
proxy->opInt(static_cast<IntEnum>(-1), intEnum); // Negative enumerators are not supported
test(false);
}
catch(const Ice::MarshalException&)
{
}
cout << "ok" << endl;
return proxy;
}