diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2006-02-02 16:10:39 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2006-02-02 16:10:39 +0000 |
commit | b494fd0916481569662b766f8ab9f91c48d580b8 (patch) | |
tree | 5d00fff4b2801cfe2f7a73945d6e6766e6b240ba /cppe/test | |
parent | Fixed bug 782 (diff) | |
download | ice-b494fd0916481569662b766f8ab9f91c48d580b8.tar.bz2 ice-b494fd0916481569662b766f8ab9f91c48d580b8.tar.xz ice-b494fd0916481569662b766f8ab9f91c48d580b8.zip |
Added support for ["cpp:range"]
Diffstat (limited to 'cppe/test')
-rw-r--r-- | cppe/test/IceE/custom/AllTests.cpp | 55 | ||||
-rw-r--r-- | cppe/test/IceE/custom/Test.ice | 10 | ||||
-rw-r--r-- | cppe/test/IceE/custom/TestI.cpp | 30 | ||||
-rw-r--r-- | cppe/test/IceE/custom/TestI.h | 15 |
4 files changed, 107 insertions, 3 deletions
diff --git a/cppe/test/IceE/custom/AllTests.cpp b/cppe/test/IceE/custom/AllTests.cpp index 307ecb6d4c1..d59771071ac 100644 --- a/cppe/test/IceE/custom/AllTests.cpp +++ b/cppe/test/IceE/custom/AllTests.cpp @@ -33,6 +33,61 @@ allTests(const Ice::CommunicatorPtr& communicator) test(t == base); tprintf("ok\n"); + tprintf("testing ranges... "); + + { + Test::BoolSeq in(5); + in[0] = false; + in[1] = true; + in[2] = true; + in[3] = false; + in[4] = true; + pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator> inPair(in.begin(), in.end()); + + Test::BoolSeq out; + Test::BoolSeq ret = t->opBoolRange(inPair, out); + test(out == in); + test(ret == in); + } + + { + Test::ByteList in(5); + in.push_back('1'); + in.push_back('2'); + in.push_back('3'); + in.push_back('4'); + in.push_back('5'); + pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end()); + + Test::ByteList out; + Test::ByteList ret = t->opByteRange(inPair, out); + test(out == in); + test(ret == in); + } + + { + Test::VariableList in; + Test::Variable v; + v.s = "These"; + in.push_back(v); + v.s = "are"; + in.push_back(v); + v.s = "five"; + in.push_back(v); + v.s = "short"; + in.push_back(v); + v.s = "strings."; + in.push_back(v); + pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator> inPair(in.begin(), in.end()); + + Test::VariableList out; + Test::VariableList ret = t->opVariableRange(inPair, out); + test(out == in); + test(ret == in); + } + + tprintf("ok\n"); + tprintf("testing custom bool sequences... "); { diff --git a/cppe/test/IceE/custom/Test.ice b/cppe/test/IceE/custom/Test.ice index 853734ec0fe..1950771b174 100644 --- a/cppe/test/IceE/custom/Test.ice +++ b/cppe/test/IceE/custom/Test.ice @@ -60,8 +60,6 @@ sequence<Variable> VariableSeq; sequence<VariableList> VariableListSeq; ["cpp:type:std::list< ::Test::VariableSeq>"] sequence<VariableSeq> VariableSeqList; -["cpp:array"] sequence<byte> ByteArray; - dictionary<string, string> StringStringDict; sequence<StringStringDict> StringStringDictSeq; ["cpp:type:std::list< ::Test::StringStringDict>"] sequence<StringStringDict> StringStringDictList; @@ -88,7 +86,13 @@ sequence<CPrxList> CPrxListSeq; class TestIntf { - ["cpp:array"] ByteSeq opByteArray(["cpp:array"] ByteSeq inSeq, out ["cpp:array"] ByteSeq outSeq); + //BoolSeq opBoolArray(["cpp:array"] BoolSeq inSeq, BoolSeq outSeq); + //ByteList opByteArray(["cpp:array"] ByteList inSeq, ByteList outSeq); + //VariableList opVariableArray(["cpp:array"] VariableList inSeq, VariableList outSeq); + + BoolSeq opBoolRange(["cpp:range"] BoolSeq inSeq, out BoolSeq outSeq); + ByteList opByteRange(["cpp:range"] ByteList inSeq, out ByteList outSeq); + VariableList opVariableRange(["cpp:range"] VariableList inSeq, out VariableList outSeq); ["cpp:type:std::deque<bool>"] BoolSeq opBoolSeq(["cpp:type:std::deque<bool>"] BoolSeq inSeq, out ["cpp:type:std::deque<bool>"]BoolSeq outSeq); diff --git a/cppe/test/IceE/custom/TestI.cpp b/cppe/test/IceE/custom/TestI.cpp index cde9ee7af97..2a9630a4f72 100644 --- a/cppe/test/IceE/custom/TestI.cpp +++ b/cppe/test/IceE/custom/TestI.cpp @@ -19,6 +19,7 @@ TestIntfI::TestIntfI(const Ice::CommunicatorPtr& communicator) { } +/* Test::ByteSeq TestIntfI::opByteArray(const std::pair<const Ice::Byte*, const Ice::Byte*>& inSeq, Test::ByteSeq& outSeq, @@ -26,6 +27,35 @@ TestIntfI::opByteArray(const std::pair<const Ice::Byte*, const Ice::Byte*>& inSe { return outSeq; } +*/ + +Test::BoolSeq +TestIntfI::opBoolRange(const std::pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator>& inSeq, + Test::BoolSeq& outSeq, + const Ice::Current&) +{ + Test::BoolSeq(inSeq.first, inSeq.second).swap(outSeq); + return outSeq; +} + +Test::ByteList +TestIntfI::opByteRange(const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& inSeq, + Test::ByteList& outSeq, + const Ice::Current&) +{ + Test::ByteList(inSeq.first, inSeq.second).swap(outSeq); + return outSeq; +} + +Test::VariableList +TestIntfI::opVariableRange( + const std::pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator>& inSeq, + Test::VariableList& outSeq, + const Ice::Current&) +{ + Test::VariableList(inSeq.first, inSeq.second).swap(outSeq); + return outSeq; +} std::deque<bool> TestIntfI::opBoolSeq(const std::deque<bool>& inSeq, diff --git a/cppe/test/IceE/custom/TestI.h b/cppe/test/IceE/custom/TestI.h index 0ddc469173a..e4f87d95a12 100644 --- a/cppe/test/IceE/custom/TestI.h +++ b/cppe/test/IceE/custom/TestI.h @@ -18,9 +18,24 @@ public: TestIntfI(const Ice::CommunicatorPtr&); +/* virtual Test::ByteSeq opByteArray(const std::pair<const Ice::Byte*, const Ice::Byte*>&, Test::ByteSeq&, const Ice::Current&); +*/ + + virtual Test::BoolSeq opBoolRange(const std::pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator>&, + Test::BoolSeq&, + const Ice::Current&); + + virtual Test::ByteList opByteRange(const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>&, + Test::ByteList&, + const Ice::Current&); + + virtual Test::VariableList + opVariableRange(const std::pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator>&, + Test::VariableList&, + const Ice::Current&); virtual std::deque<bool> opBoolSeq(const std::deque<bool>&, std::deque<bool>&, |