diff options
-rw-r--r-- | cpp/test/Ice/operations/Twoways.cpp | 12 | ||||
-rw-r--r-- | objective-c/test/Ice/operations/OperationsTest.ice | 42 | ||||
-rw-r--r-- | objective-c/test/Ice/operations/TestI.m | 66 | ||||
-rw-r--r-- | objective-c/test/Ice/operations/Twoways.m | 27 |
4 files changed, 134 insertions, 13 deletions
diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index 7fd78ad7a30..9193c246627 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -1649,9 +1649,9 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) test(p->opFloat1(1.0) == 1.0); test(p->opDouble1(1.0) == 1.0); test(p->opString1("opString1") == "opString1"); - + Test::MyDerivedClassPrx d = Test::MyDerivedClassPrx::uncheckedCast(p); - + Test::MyStruct1 s; s.tesT = "Test::MyStruct1::s"; s.myClass = 0; @@ -1660,7 +1660,7 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) test(s.tesT == "Test::MyStruct1::s"); test(s.myClass == 0); test(s.myStruct1 == "Test::MyStruct1::myStruct1"); - + Test::MyClass1Ptr c = new Test::MyClass1(); c->tesT = "Test::MyClass1::testT"; c->myClass = 0; @@ -1669,12 +1669,12 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) test(c->tesT == "Test::MyClass1::testT"); test(c->myClass == 0); test(c->myClass1 == "Test::MyClass1::myClass1"); - + Test::StringS seq; p->opStringS1(seq); Test::ByteBoolD dict; p->opByteBoolD1(dict); - - + + } diff --git a/objective-c/test/Ice/operations/OperationsTest.ice b/objective-c/test/Ice/operations/OperationsTest.ice index 7f8a084184b..1014c86f54a 100644 --- a/objective-c/test/Ice/operations/OperationsTest.ice +++ b/objective-c/test/Ice/operations/OperationsTest.ice @@ -252,19 +252,31 @@ class MyClass MyEnumMyEnumSD opMyEnumMyEnumSD(MyEnumMyEnumSD p1, MyEnumMyEnumSD p2, out MyEnumMyEnumSD p3); - IntS opIntS(IntS s); + IntS opIntS(IntS s); - void opByteSOneway(ByteS s); + void opByteSOneway(ByteS s); - int opByteSOnewayCallCount(); + int opByteSOnewayCallCount(); - Ice::Context opContext(); + Ice::Context opContext(); - void opDoubleMarshaling(double p1, DoubleS p2); + void opDoubleMarshaling(double p1, DoubleS p2); - idempotent void opIdempotent(); + idempotent void opIdempotent(); - ["nonmutating"] idempotent void opNonmutating(); + ["nonmutating"] idempotent void opNonmutating(); + + byte opByte1(byte opByte1); + short opShort1(short opShort1); + int opInt1(int opInt1); + long opLong1(long opLong1); + float opFloat1(float opFloat1); + double opDouble1(double opDouble1); + string opString1(string opString1); + StringS opStringS1(StringS opStringS1); + ByteBoolD opByteBoolD1(ByteBoolD opByteBoolD1); + StringS opStringS2(StringS stringS); + ByteBoolD opByteBoolD2(ByteBoolD byteBoolD); // // Operations below are specific to Objective-C @@ -281,9 +293,25 @@ class MyClass void putNSNullStringMyEnumDict(StringMyEnumD d); }; +struct MyStruct1 +{ + string tesT; // Same name as the enclosing module + MyClass myClass; // Same name as an already defined class + string myStruct1; // Same name as the enclosing struct +}; + +class MyClass1 +{ + string tesT; // Same name as the enclosing module + MyClass myClass; // Same name as an already defined class + string myClass1; // Same name as the enclosing class +}; + class MyDerivedClass extends MyClass { void opDerived(); + MyClass1 opMyClass1(MyClass1 c); + MyStruct1 opMyStruct1(MyStruct1 c); }; }; diff --git a/objective-c/test/Ice/operations/TestI.m b/objective-c/test/Ice/operations/TestI.m index e04a68e8c37..a84fff8ad15 100644 --- a/objective-c/test/Ice/operations/TestI.m +++ b/objective-c/test/Ice/operations/TestI.m @@ -663,6 +663,72 @@ test([current mode] == ICENonmutating); } +-(ICEByte) opByte1:(ICEByte)p current:(ICECurrent*)current +{ + return p; +} + +-(ICEShort) opShort1:(ICEShort)p current:(ICECurrent*)current +{ + return p; +} + +-(ICEInt) opInt1:(ICEInt)p current:(ICECurrent*)current +{ + return p; +} + +-(ICELong) opLong1:(ICELong)p current:(ICECurrent*)current +{ + return p; +} + + +-(ICEFloat) opFloat1:(ICEFloat)p current:(ICECurrent*)current +{ + return p; +} + +-(ICEDouble) opDouble1:(ICEDouble)p current:(ICECurrent*)current +{ + return p; +} + +-(NSString*) opString1:(NSString*)p current:(ICECurrent*)current +{ + return p; +} + +-(TestOperationsStringS*) opStringS1:(TestOperationsStringS*)p current:(ICECurrent*)current +{ + return p; +} + +-(TestOperationsByteBoolD*) opByteBoolD1:(TestOperationsByteBoolD*)p current:(ICECurrent*)current +{ + return p; +} + +-(TestOperationsStringS*) opStringS2:(TestOperationsStringS*)p current:(ICECurrent*)current +{ + return p; +} + +-(TestOperationsByteBoolD*) opByteBoolD2:(TestOperationsByteBoolD*)p current:(ICECurrent*)current +{ + return p; +} + +-(TestOperationsMyClass1*) opMyClass1:(TestOperationsMyClass1*)p current:(ICECurrent*)current +{ + return p; +} + +-(TestOperationsMyStruct1*) opMyStruct1:(TestOperationsMyStruct1*)p current:(ICECurrent*)current +{ + return p; +} + -(TestOperationsStringS *) getNSNullStringSeq:(ICECurrent *)current { return [NSArray arrayWithObjects:@"first", [NSNull null], nil]; diff --git a/objective-c/test/Ice/operations/Twoways.m b/objective-c/test/Ice/operations/Twoways.m index f067dbe0159..55c5a702989 100644 --- a/objective-c/test/Ice/operations/Twoways.m +++ b/objective-c/test/Ice/operations/Twoways.m @@ -1679,6 +1679,33 @@ twoways(id<ICECommunicator> communicator, id<TestOperationsMyClassPrx> p) [p opNonmutating]; + test([p opByte1:0xFF] == 0xFF); + test([p opShort1:0x7FFF] == 0x7FFF); + test([p opInt1:0x7FFFFFFF] == 0x7FFFFFFF); + test([p opLong1:0x7FFFFFFFFFFFFFFF] == 0x7FFFFFFFFFFFFFFF); + test([p opFloat1:1.0] == 1.0); + test([p opDouble1:1.0] == 1.0); + test([[p opString1:@"opString1"] isEqualToString:@"opString1"]); + + id<TestOperationsMyDerivedClassPrx> d = [TestOperationsMyDerivedClassPrx uncheckedCast:p]; + + TestOperationsMyStruct1* s = + [TestOperationsMyStruct1 myStruct1:@"Test::MyStruct1::s" myClass:nil myStruct1:@"Test::MyStruct1::myStruct1"]; + s = [d opMyStruct1:s]; + test([s.tesT isEqualToString:@"Test::MyStruct1::s"]); + test(s.myClass == 0); + test([s.myStruct1 isEqualToString:@"Test::MyStruct1::myStruct1"]); + + TestOperationsMyClass1* c = + [TestOperationsMyClass1 myClass1:@"Test::MyClass1::testT" myClass:nil myClass1:@"Test::MyClass1::myClass1"]; + c = [d opMyClass1:c]; + test([c.tesT isEqualToString:@"Test::MyClass1::testT"]); + test(c.myClass == nil); + test([c.myClass1 isEqualToString:@"Test::MyClass1::myClass1"]); + + [p opStringS1:[TestOperationsStringS array]]; + [p opByteBoolD1:[TestOperationsByteBoolD dictionary]]; + // // TestOperationss below are for Objective-C only. They test that we do the right thing if NSNull // is passed as part of the sequence or dictionary. |