diff options
Diffstat (limited to 'cpp/test/Ice/operations')
-rw-r--r-- | cpp/test/Ice/operations/Makefile | 8 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Oneways.cpp | 3 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Test.ice | 10 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestAMD.ice | 10 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestAMDI.cpp | 12 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestAMDI.h | 4 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestI.cpp | 12 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestI.h | 4 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Twoways.cpp | 27 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TwowaysAMI.cpp | 55 |
10 files changed, 137 insertions, 8 deletions
diff --git a/cpp/test/Ice/operations/Makefile b/cpp/test/Ice/operations/Makefile index 241830419fd..d3b7650d124 100644 --- a/cpp/test/Ice/operations/Makefile +++ b/cpp/test/Ice/operations/Makefile @@ -56,18 +56,18 @@ CPPFLAGS := -I. -I../../include $(CPPFLAGS) $(CLIENT): $(COBJS) rm -f $@ - $(CXX) $(LDFLAGS) $(STATICLIBSTDFLAG) -o $@ $(COBJS) $(LIBS) + $(CXX) $(LDFLAGS) -o $@ $(COBJS) $(LIBS) $(SERVER): $(SOBJS) rm -f $@ - $(CXX) $(LDFLAGS) $(STATICLIBSTDFLAG) -o $@ $(SOBJS) $(LIBS) + $(CXX) $(LDFLAGS) -o $@ $(SOBJS) $(LIBS) $(SERVERAMD): $(SAMDOBJS) rm -f $@ - $(CXX) $(LDFLAGS) $(STATICLIBSTDFLAG) -o $@ $(SAMDOBJS) $(LIBS) + $(CXX) $(LDFLAGS) -o $@ $(SAMDOBJS) $(LIBS) $(COLLOCATED): $(COLOBJS) rm -f $@ - $(CXX) $(LDFLAGS) $(STATICLIBSTDFLAG) -o $@ $(COLOBJS) $(LIBS) + $(CXX) $(LDFLAGS) -o $@ $(COLOBJS) $(LIBS) include .depend diff --git a/cpp/test/Ice/operations/Oneways.cpp b/cpp/test/Ice/operations/Oneways.cpp index 84f1f4cf826..9e385e31ae6 100644 --- a/cpp/test/Ice/operations/Oneways.cpp +++ b/cpp/test/Ice/operations/Oneways.cpp @@ -24,11 +24,10 @@ oneways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& proxy) { Ice::Byte b; - Ice::Byte r; try { - r = p->opByte(Ice::Byte(0xff), Ice::Byte(0x0f), b); + p->opByte(Ice::Byte(0xff), Ice::Byte(0x0f), b); test(false); } catch(const Ice::TwowayOnlyException&) diff --git a/cpp/test/Ice/operations/Test.ice b/cpp/test/Ice/operations/Test.ice index 447b3c8b17b..ea771c12ff3 100644 --- a/cpp/test/Ice/operations/Test.ice +++ b/cpp/test/Ice/operations/Test.ice @@ -60,11 +60,18 @@ sequence<MyClassS> MyClassSS; sequence<StringSS> StringSSS; +struct MyStruct +{ + int i; + int j; +}; + dictionary<byte, bool> ByteBoolD; dictionary<short, int> ShortIntD; dictionary<long, float> LongFloatD; dictionary<string, string> StringStringD; dictionary<string, MyEnum> StringMyEnumD; +dictionary<MyStruct, MyEnum> MyStructMyEnumD; ["ami"] class MyClass { @@ -143,6 +150,9 @@ dictionary<string, MyEnum> StringMyEnumD; StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2, out StringMyEnumD p3); + MyStructMyEnumD opMyStructMyEnumD(MyStructMyEnumD p1, MyStructMyEnumD p2, + out MyStructMyEnumD p3); + IntS opIntS(IntS s); void opByteSOneway(ByteS s); diff --git a/cpp/test/Ice/operations/TestAMD.ice b/cpp/test/Ice/operations/TestAMD.ice index 384a7d3c4e4..a44c923e1fa 100644 --- a/cpp/test/Ice/operations/TestAMD.ice +++ b/cpp/test/Ice/operations/TestAMD.ice @@ -60,11 +60,18 @@ sequence<MyClassS> MyClassSS; sequence<StringSS> StringSSS; +struct MyStruct +{ + int i; + int j; +}; + dictionary<byte, bool> ByteBoolD; dictionary<short, int> ShortIntD; dictionary<long, float> LongFloatD; dictionary<string, string> StringStringD; dictionary<string, MyEnum> StringMyEnumD; +dictionary<MyStruct, MyEnum> MyStructMyEnumD; ["ami", "amd"] class MyClass { @@ -143,6 +150,9 @@ dictionary<string, MyEnum> StringMyEnumD; StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2, out StringMyEnumD p3); + MyStructMyEnumD opMyStructMyEnumD(MyStructMyEnumD p1, MyStructMyEnumD p2, + out MyStructMyEnumD p3); + IntS opIntS(IntS s); void opByteSOneway(ByteS s); diff --git a/cpp/test/Ice/operations/TestAMDI.cpp b/cpp/test/Ice/operations/TestAMDI.cpp index f79c036a9e1..fd56b7f596a 100644 --- a/cpp/test/Ice/operations/TestAMDI.cpp +++ b/cpp/test/Ice/operations/TestAMDI.cpp @@ -361,6 +361,18 @@ MyDerivedClassI::opStringMyEnumD_async(const Test::AMD_MyClass_opStringMyEnumDPt } void +MyDerivedClassI::opMyStructMyEnumD_async(const Test::AMD_MyClass_opMyStructMyEnumDPtr& cb, + const Test::MyStructMyEnumD& p1, + const Test::MyStructMyEnumD& p2, + const Ice::Current&) +{ + Test::MyStructMyEnumD p3 = p1; + Test::MyStructMyEnumD r = p1; + std::set_union(p1.begin(), p1.end(), p2.begin(), p2.end(), std::inserter(r, r.end())); + cb->ice_response(r, p3); +} + +void MyDerivedClassI::opIntS_async(const Test::AMD_MyClass_opIntSPtr& cb, const Test::IntS& s, const Ice::Current&) { Test::IntS r; diff --git a/cpp/test/Ice/operations/TestAMDI.h b/cpp/test/Ice/operations/TestAMDI.h index 66221ddbede..efbcf319e7e 100644 --- a/cpp/test/Ice/operations/TestAMDI.h +++ b/cpp/test/Ice/operations/TestAMDI.h @@ -119,6 +119,10 @@ public: const Test::StringMyEnumD&, const Test::StringMyEnumD&, const Ice::Current&); + virtual void opMyStructMyEnumD_async(const Test::AMD_MyClass_opMyStructMyEnumDPtr&, + const Test::MyStructMyEnumD&, const Test::MyStructMyEnumD&, + const Ice::Current&); + virtual void opIntS_async(const Test::AMD_MyClass_opIntSPtr&, const Test::IntS&, const Ice::Current&); virtual void opByteSOneway_async(const Test::AMD_MyClass_opByteSOnewayPtr&, const Test::ByteS&, diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp index a12e1ee1f38..09c9ab409c1 100644 --- a/cpp/test/Ice/operations/TestI.cpp +++ b/cpp/test/Ice/operations/TestI.cpp @@ -336,6 +336,18 @@ MyDerivedClassI::opStringMyEnumD(const Test::StringMyEnumD& p1, return r; } +Test::MyStructMyEnumD +MyDerivedClassI::opMyStructMyEnumD(const Test::MyStructMyEnumD& p1, + const Test::MyStructMyEnumD& p2, + Test::MyStructMyEnumD& p3, + const Ice::Current&) +{ + p3 = p1; + Test::MyStructMyEnumD r = p1; + std::set_union(p1.begin(), p1.end(), p2.begin(), p2.end(), std::inserter(r, r.end())); + return r; +} + Test::IntS MyDerivedClassI::opIntS(const Test::IntS& s, const Ice::Current&) { diff --git a/cpp/test/Ice/operations/TestI.h b/cpp/test/Ice/operations/TestI.h index 9aba20231aa..fc374a02c17 100644 --- a/cpp/test/Ice/operations/TestI.h +++ b/cpp/test/Ice/operations/TestI.h @@ -144,6 +144,10 @@ public: Test::StringMyEnumD&, const Ice::Current&); + virtual Test::MyStructMyEnumD opMyStructMyEnumD(const Test::MyStructMyEnumD&, const Test::MyStructMyEnumD&, + Test::MyStructMyEnumD&, + const Ice::Current&); + virtual Test::IntS opIntS(const Test::IntS&, const Ice::Current&); virtual void opByteSOneway(const Test::ByteS&, const Ice::Current&); diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index d91636c0458..ed6945dc735 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -627,9 +627,34 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) } { + Test::MyStruct s11 = { 1, 1 }; + Test::MyStruct s12 = { 1, 2 }; + Test::MyStructMyEnumD di1; + di1[s11] = Test::enum1; + di1[s12] = Test::enum2; + + Test::MyStruct s22 = { 2, 2 }; + Test::MyStruct s23 = { 2, 3 }; + Test::MyStructMyEnumD di2; + di2[s11] = Test::enum1; + di2[s22] = Test::enum3; + di2[s23] = Test::enum2; + + Test::MyStructMyEnumD _do; + Test::MyStructMyEnumD ro = p->opMyStructMyEnumD(di1, di2, _do); + + test(_do == di1); + test(ro.size() == 4); + test(ro[s11] == Test::enum1); + test(ro[s12] == Test::enum2); + test(ro[s22] == Test::enum3); + test(ro[s23] == Test::enum2); + } + + { const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; - for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l) + for(unsigned int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l) { Test::IntS s; for(int i = 0; i < lengths[l]; ++i) diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp index 8ec3c58a02f..f2809dda31e 100644 --- a/cpp/test/Ice/operations/TwowaysAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysAMI.cpp @@ -757,6 +757,40 @@ public: typedef IceUtil::Handle<AMI_MyClass_opStringMyEnumDI> AMI_MyClass_opStringMyEnumDIPtr; +class AMI_MyClass_opMyStructMyEnumDI : public Test::AMI_MyClass_opMyStructMyEnumD, public CallbackBase +{ +public: + + virtual void ice_response(const ::Test::MyStructMyEnumD& ro, const ::Test::MyStructMyEnumD& _do) + { + Test::MyStruct s11 = { 1, 1 }; + Test::MyStruct s12 = { 1, 2 }; + Test::MyStructMyEnumD di1; + di1[s11] = Test::enum1; + di1[s12] = Test::enum2; + test(_do == di1); + Test::MyStruct s22 = { 2, 2 }; + Test::MyStruct s23 = { 2, 3 }; + test(ro.size() == 4); + test(ro.find(s11) != ro.end()); + test(ro.find(s11)->second == Test::enum1); + test(ro.find(s12) != ro.end()); + test(ro.find(s12)->second == Test::enum2); + test(ro.find(s22) != ro.end()); + test(ro.find(s22)->second == Test::enum3); + test(ro.find(s23) != ro.end()); + test(ro.find(s23)->second == Test::enum2); + called(); + } + + virtual void ice_exception(const ::Ice::Exception&) + { + test(false); + } +}; + +typedef IceUtil::Handle<AMI_MyClass_opMyStructMyEnumDI> AMI_MyClass_opMyStructMyEnumDIPtr; + class AMI_MyClass_opIntSI : public Test::AMI_MyClass_opIntS, public CallbackBase { public: @@ -1211,9 +1245,28 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) } { + Test::MyStruct s11 = { 1, 1 }; + Test::MyStruct s12 = { 1, 2 }; + Test::MyStructMyEnumD di1; + di1[s11] = Test::enum1; + di1[s12] = Test::enum2; + + Test::MyStruct s22 = { 2, 2 }; + Test::MyStruct s23 = { 2, 3 }; + Test::MyStructMyEnumD di2; + di2[s11] = Test::enum1; + di2[s22] = Test::enum3; + di2[s23] = Test::enum2; + + AMI_MyClass_opMyStructMyEnumDIPtr cb = new AMI_MyClass_opMyStructMyEnumDI; + p->opMyStructMyEnumD_async(cb, di1, di2); + test(cb->check()); + } + + { const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; - for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l) + for(unsigned int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l) { Test::IntS s; for(int i = 0; i < lengths[l]; ++i) |