1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 #include <Ice/Ice.h>
6 #include <TestHelper.h>
7 #include <Test.h>
8 #include <limits>
9 
10 //
11 // Visual C++ defines min and max as macros
12 //
13 #ifdef min
14 #   undef min
15 #endif
16 #ifdef max
17 #   undef max
18 #endif
19 
20 //
21 // Work-around for GCC warning bug
22 //
23 #if defined(__GNUC__)
24 #   pragma GCC diagnostic ignored "-Wstrict-aliasing"
25 #endif
26 
27 using namespace std;
28 using namespace Test;
29 
30 namespace
31 {
32 
33 class PerThreadContextInvokeThread : public IceUtil::Thread
34 {
35 public:
36 
PerThreadContextInvokeThread(const Test::MyClassPrxPtr & proxy)37     PerThreadContextInvokeThread(const Test::MyClassPrxPtr& proxy) :
38         _proxy(proxy)
39     {
40     }
41 
42     virtual void
run()43     run()
44     {
45         Ice::Context ctx = _proxy->ice_getCommunicator()->getImplicitContext()->getContext();
46         test(ctx.empty());
47         ctx["one"] = "UN";
48         _proxy->ice_getCommunicator()->getImplicitContext()->setContext(ctx);
49         test(_proxy->opContext() == ctx);
50     }
51 
52 private:
53 
54     Test::MyClassPrxPtr _proxy;
55 };
56 
57 }
58 
59 void
twoways(const Ice::CommunicatorPtr & communicator,const Test::MyClassPrxPtr & p)60 twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& p)
61 {
62     Test::StringS literals = p->opStringLiterals();
63 
64     test(Test::s0 == "\\" &&
65          Test::s0 == Test::sw0 &&
66          Test::s0 == literals[0] &&
67          Test::s0 == literals[11]);
68 
69     test(Test::s1 == "A" &&
70          Test::s1 == Test::sw1 &&
71          Test::s1 == literals[1] &&
72          Test::s1 == literals[12]);
73 
74     test(Test::s2 == "Ice" &&
75          Test::s2 == Test::sw2 &&
76          Test::s2 == literals[2] &&
77          Test::s2 == literals[13]);
78 
79     test(Test::s3 == "A21" &&
80          Test::s3 == Test::sw3 &&
81          Test::s3 == literals[3] &&
82          Test::s3 == literals[14]);
83 
84     test(Test::s4 == "\\u0041 \\U00000041" &&
85          Test::s4 == Test::sw4 &&
86          Test::s4 == literals[4] &&
87          Test::s4 == literals[15]);
88 
89     test(Test::s5 == "\xc3\xbf" &&
90          Test::s5 == Test::sw5 &&
91          Test::s5 == literals[5] &&
92          Test::s5 == literals[16]);
93 
94     test(Test::s6 == "\xcf\xbf" &&
95          Test::s6 == Test::sw6 &&
96          Test::s6 == literals[6] &&
97          Test::s6 == literals[17]);
98 
99     test(Test::s7 == "\xd7\xb0" &&
100          Test::s7 == Test::sw7 &&
101          Test::s7 == literals[7] &&
102          Test::s7 == literals[18]);
103 
104     test(Test::s8 == "\xf0\x90\x80\x80" &&
105          Test::s8 == Test::sw8 &&
106          Test::s8 == literals[8] &&
107          Test::s8 == literals[19]);
108 
109     test(Test::s9 == "\xf0\x9f\x8d\x8c" &&
110          Test::s9 == Test::sw9 &&
111          Test::s9 == literals[9] &&
112          Test::s9 == literals[20]);
113 
114     test(Test::s10 == "\xe0\xb6\xa7" &&
115          Test::s10 == Test::sw10 &&
116          Test::s10 == literals[10] &&
117          Test::s10 == literals[21]);
118 
119     test(Test::s11 == "\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac");
120     test(Test::s12 == "\\101");
121 
122     test(Test::ss0 == "\'\"\?\\\a\b\f\n\r\t\v\006" &&
123          Test::ss0 == Test::ss1 &&
124          Test::ss0 == Test::ss2 &&
125          Test::ss0 == literals[22] &&
126          Test::ss0 == literals[23] &&
127          Test::ss0 == literals[24]);
128 
129     test(Test::ss3 == "\\\\U\\u\\" &&
130          Test::ss3 == literals[25]);
131 
132     test(Test::ss4 == "\\A\\" &&
133          Test::ss4 == literals[26]);
134 
135     test(Test::ss5 == "\\u0041\\" &&
136          Test::ss5 == literals[27]);
137 
138     test(Test::su0 == Test::su1);
139     test(Test::su0 == Test::su2);
140     test(Test::su0 == literals[28]);
141     test(Test::su0 == literals[29]);
142     test(Test::su0 == literals[30]);
143 
144     //
145     // Same but using wide strings
146     //
147     Test::WStringS wliterals = p->opWStringLiterals();
148 
149     test(Test::ws0 == L"\\" &&
150          Test::ws0 == Test::wsw0 &&
151          Test::ws0 == wliterals[0] &&
152          Test::ws0 == wliterals[11]);
153 
154     test(Test::ws1 == L"A" &&
155          Test::ws1 == Test::wsw1 &&
156          Test::ws1 == wliterals[1] &&
157          Test::ws1 == wliterals[12]);
158 
159     test(Test::ws2 == L"Ice" &&
160          Test::ws2 == Test::wsw2 &&
161          Test::ws2 == wliterals[2] &&
162          Test::ws2 == wliterals[13]);
163 
164     test(Test::ws3 == L"A21" &&
165          Test::ws3 == Test::wsw3 &&
166          Test::ws3 == wliterals[3] &&
167          Test::ws3 == wliterals[14]);
168 
169     test(Test::ws4 == L"\\u0041 \\U00000041" &&
170          Test::ws4 == Test::wsw4 &&
171          Test::ws4 == wliterals[4] &&
172          Test::ws4 == wliterals[15]);
173 
174     test(Test::ws5 == L"\u00FF" &&
175          Test::ws5 == Test::wsw5 &&
176          Test::ws5 == wliterals[5] &&
177          Test::ws5 == wliterals[16]);
178 
179     test(Test::ws6 == L"\u03FF" &&
180          Test::ws6 == Test::wsw6 &&
181          Test::ws6 == wliterals[6] &&
182          Test::ws6 == wliterals[17]);
183 
184     test(Test::ws7 == L"\u05F0" &&
185          Test::ws7 == Test::wsw7 &&
186          Test::ws7 == wliterals[7] &&
187          Test::ws7 == wliterals[18]);
188 
189     test(Test::ws8 == L"\U00010000" &&
190          Test::ws8 == Test::wsw8 &&
191          Test::ws8 == wliterals[8] &&
192          Test::ws8 == wliterals[19]);
193 
194     test(Test::ws9 == L"\U0001F34C" &&
195          Test::ws9 == Test::wsw9 &&
196          Test::ws9 == wliterals[9] &&
197          Test::ws9 == wliterals[20]);
198 
199     test(Test::ws10 == L"\u0DA7" &&
200          Test::ws10 == Test::wsw10 &&
201          Test::ws10 == wliterals[10] &&
202          Test::ws10 == wliterals[21]);
203 
204     test(Test::wss0 == L"\'\"\?\\\a\b\f\n\r\t\v\006" &&
205          Test::wss0 == Test::wss1 &&
206          Test::wss0 == Test::wss2 &&
207          Test::wss0 == wliterals[22] &&
208          Test::wss0 == wliterals[23] &&
209          Test::wss0 == wliterals[24]);
210 
211     test(Test::wss3 == L"\\\\U\\u\\" &&
212          Test::wss3 == wliterals[25]);
213 
214     test(Test::wss4 == L"\\A\\" &&
215          Test::wss4 == wliterals[26]);
216 
217     test(Test::wss5 == L"\\u0041\\" &&
218          Test::wss5 == wliterals[27]);
219 
220     test(Test::wsu0 == Test::wsu1 &&
221          Test::wsu0 == Test::wsu2 &&
222          Test::wsu0 == wliterals[28] &&
223          Test::wsu0 == wliterals[29] &&
224          Test::wsu0 == wliterals[30]);
225 
226     {
227         p->ice_ping();
228     }
229 
230     {
231         test(Test::MyClassPrx::ice_staticId() == Test::MyClass::ice_staticId());
232         test(Ice::ObjectPrx::ice_staticId() == Ice::Object::ice_staticId());
233     }
234 
235     {
236         test(p->ice_isA(Test::MyClass::ice_staticId()));
237     }
238 
239     {
240         test(p->ice_id() == Test::MyDerivedClass::ice_staticId());
241     }
242 
243     {
244         Ice::StringSeq ids = p->ice_ids();
245         test(ids.size() == 3);
246         test(ids[0] == "::Ice::Object");
247         test(ids[1] == "::Test::MyClass");
248         test(ids[2] == "::Test::MyDerivedClass");
249     }
250 
251     {
252         p->opVoid();
253     }
254 
255     {
256         Ice::Byte b;
257         Ice::Byte r;
258 
259         r = p->opByte(Ice::Byte(0xff), Ice::Byte(0x0f), b);
260         test(b == Ice::Byte(0xf0));
261         test(r == Ice::Byte(0xff));
262     }
263 
264     {
265         bool b;
266         bool r;
267 
268         r = p->opBool(true, false, b);
269         test(b);
270         test(!r);
271     }
272 
273     {
274         Ice::Short s;
275         Ice::Int i;
276         Ice::Long l;
277         Ice::Long r;
278 
279         r = p->opShortIntLong(10, 11, 12, s, i, l);
280         test(s == 10);
281         test(i == 11);
282         test(l == 12);
283         test(r == 12);
284 
285         r = p->opShortIntLong(numeric_limits<Ice::Short>::min(), numeric_limits<Ice::Int>::min(),
286                               numeric_limits<Ice::Long>::min(), s, i, l);
287         test(s == numeric_limits<Ice::Short>::min());
288         test(i == numeric_limits<Ice::Int>::min());
289         test(l == numeric_limits<Ice::Long>::min());
290         test(r == numeric_limits<Ice::Long>::min());
291 
292         r = p->opShortIntLong(numeric_limits<Ice::Short>::max(), numeric_limits<Ice::Int>::max(),
293                               numeric_limits<Ice::Long>::max(), s, i, l);
294         test(s == numeric_limits<Ice::Short>::max());
295         test(i == numeric_limits<Ice::Int>::max());
296         test(l == numeric_limits<Ice::Long>::max());
297         test(r == numeric_limits<Ice::Long>::max());
298     }
299 
300     {
301         Ice::Float f;
302         Ice::Double d;
303         Ice::Double r;
304 
305         r = p->opFloatDouble(Ice::Float(3.14), Ice::Double(1.1E10), f, d);
306         test(f == Ice::Float(3.14));
307         test(d == Ice::Double(1.1E10));
308         test(r == Ice::Double(1.1E10));
309 
310         r = p->opFloatDouble(numeric_limits<Ice::Float>::min(), numeric_limits<Ice::Double>::min(), f, d);
311         test(f == numeric_limits<Ice::Float>::min());
312         test(d == numeric_limits<Ice::Double>::min());
313         test(r == numeric_limits<Ice::Double>::min());
314 
315         r = p->opFloatDouble(numeric_limits<Ice::Float>::max(), numeric_limits<Ice::Double>::max(), f, d);
316         test(f == numeric_limits<Ice::Float>::max());
317         test(d == numeric_limits<Ice::Double>::max());
318         test(r == numeric_limits<Ice::Double>::max());
319     }
320 
321     {
322         string s;
323         string r;
324 
325         r = p->opString("hello", "world", s);
326         test(s == "world hello");
327         test(r == "hello world");
328     }
329 
330     {
331         Test::MyEnum e;
332         Test::MyEnum r;
333 
334         r = p->opMyEnum(ICE_ENUM(MyEnum, enum2), e);
335         test(e == ICE_ENUM(MyEnum, enum2));
336         test(r == ICE_ENUM(MyEnum, enum3));
337     }
338 
339     {
340         Test::MyClassPrxPtr c1;
341         Test::MyClassPrxPtr c2;
342         Test::MyClassPrxPtr r;
343 
344         r = p->opMyClass(p, c1, c2);
345         test(Ice::proxyIdentityAndFacetEqual(c1, p));
346         test(!Ice::proxyIdentityAndFacetEqual(c2, p));
347         test(Ice::proxyIdentityAndFacetEqual(r, p));
348         test(c1->ice_getIdentity() == Ice::stringToIdentity("test"));
349         test(c2->ice_getIdentity() == Ice::stringToIdentity("noSuchIdentity"));
350         test(r->ice_getIdentity() == Ice::stringToIdentity("test"));
351         r->opVoid();
352         c1->opVoid();
353         try
354         {
355             c2->opVoid();
356             test(false);
357         }
358         catch(const Ice::ObjectNotExistException&)
359         {
360         }
361 
362         r = p->opMyClass(0, c1, c2);
363         test(c1 == 0);
364         test(c2 != 0);
365         test(Ice::proxyIdentityAndFacetEqual(r, p));
366         r->opVoid();
367     }
368 
369     {
370         Test::Structure si1;
371         si1.p = p;
372         si1.e = ICE_ENUM(MyEnum, enum3);
373         si1.s.s = "abc";
374         Test::Structure si2;
375         si2.p = 0;
376         si2.e = ICE_ENUM(MyEnum, enum2);
377         si2.s.s = "def";
378 
379         Test::Structure so;
380         Test::Structure rso = p->opStruct(si1, si2, so);
381         test(rso.p == 0);
382         test(rso.e == ICE_ENUM(MyEnum, enum2));
383         test(rso.s.s == "def");
384 #ifdef ICE_CPP11_MAPPING
385         test(Ice::targetEqualTo(so.p, p));
386 #else
387         test(so.p == p);
388 #endif
389         test(so.e == ICE_ENUM(MyEnum, enum3));
390         test(so.s.s == "a new string");
391         so.p->opVoid();
392     }
393 
394     {
395         Test::ByteS bsi1;
396         Test::ByteS bsi2;
397 
398         bsi1.push_back(Ice::Byte(0x01));
399         bsi1.push_back(Ice::Byte(0x11));
400         bsi1.push_back(Ice::Byte(0x12));
401         bsi1.push_back(Ice::Byte(0x22));
402 
403         bsi2.push_back(Ice::Byte(0xf1));
404         bsi2.push_back(Ice::Byte(0xf2));
405         bsi2.push_back(Ice::Byte(0xf3));
406         bsi2.push_back(Ice::Byte(0xf4));
407 
408         Test::ByteS bso;
409         Test::ByteS rso;
410 
411         rso = p->opByteS(bsi1, bsi2, bso);
412         test(bso.size() == 4);
413         test(bso[0] == Ice::Byte(0x22));
414         test(bso[1] == Ice::Byte(0x12));
415         test(bso[2] == Ice::Byte(0x11));
416         test(bso[3] == Ice::Byte(0x01));
417         test(rso.size() == 8);
418         test(rso[0] == Ice::Byte(0x01));
419         test(rso[1] == Ice::Byte(0x11));
420         test(rso[2] == Ice::Byte(0x12));
421         test(rso[3] == Ice::Byte(0x22));
422         test(rso[4] == Ice::Byte(0xf1));
423         test(rso[5] == Ice::Byte(0xf2));
424         test(rso[6] == Ice::Byte(0xf3));
425         test(rso[7] == Ice::Byte(0xf4));
426     }
427 
428     {
429         Test::BoolS bsi1;
430         Test::BoolS bsi2;
431 
432         bsi1.push_back(true);
433         bsi1.push_back(true);
434         bsi1.push_back(false);
435 
436         bsi2.push_back(false);
437 
438         Test::BoolS bso;
439         Test::BoolS rso;
440 
441         rso = p->opBoolS(bsi1, bsi2, bso);
442         test(bso.size() == 4);
443         test(bso[0]);
444         test(bso[1]);
445         test(!bso[2]);
446         test(!bso[3]);
447         test(rso.size() == 3);
448         test(!rso[0]);
449         test(rso[1]);
450         test(rso[2]);
451     }
452 
453     {
454         Test::ShortS ssi;
455         Test::IntS isi;
456         Test::LongS lsi;
457 
458         ssi.push_back(1);
459         ssi.push_back(2);
460         ssi.push_back(3);
461 
462         isi.push_back(5);
463         isi.push_back(6);
464         isi.push_back(7);
465         isi.push_back(8);
466 
467         lsi.push_back(10);
468         lsi.push_back(30);
469         lsi.push_back(20);
470 
471         Test::ShortS sso;
472         Test::IntS iso;
473         Test::LongS lso;
474         Test::LongS rso;
475 
476         rso = p->opShortIntLongS(ssi, isi, lsi, sso, iso, lso);
477         test(sso.size() == 3);
478         test(sso[0] == 1);
479         test(sso[1] == 2);
480         test(sso[2] == 3);
481         test(iso.size() == 4);
482         test(iso[0] == 8);
483         test(iso[1] == 7);
484         test(iso[2] == 6);
485         test(iso[3] == 5);
486         test(lso.size() == 6);
487         test(lso[0] == 10);
488         test(lso[1] == 30);
489         test(lso[2] == 20);
490         test(lso[3] == 10);
491         test(lso[4] == 30);
492         test(lso[5] == 20);
493         test(rso.size() == 3);
494         test(rso[0] == 10);
495         test(rso[1] == 30);
496         test(rso[2] == 20);
497     }
498 
499     {
500         Test::FloatS fsi;
501         Test::DoubleS dsi;
502 
503         fsi.push_back(Ice::Float(3.14));
504         fsi.push_back(Ice::Float(1.11));
505 
506         dsi.push_back(Ice::Double(1.1E10));
507         dsi.push_back(Ice::Double(1.2E10));
508         dsi.push_back(Ice::Double(1.3E10));
509 
510         Test::FloatS fso;
511         Test::DoubleS dso;
512         Test::DoubleS rso;
513 
514         rso = p->opFloatDoubleS(fsi, dsi, fso, dso);
515         test(fso.size() == 2);
516         test(fso[0] == ::Ice::Float(3.14));
517         test(fso[1] == ::Ice::Float(1.11));
518         test(dso.size() == 3);
519         test(dso[0] == ::Ice::Double(1.3E10));
520         test(dso[1] == ::Ice::Double(1.2E10));
521         test(dso[2] == ::Ice::Double(1.1E10));
522         test(rso.size() == 5);
523         test(rso[0] == ::Ice::Double(1.1E10));
524         test(rso[1] == ::Ice::Double(1.2E10));
525         test(rso[2] == ::Ice::Double(1.3E10));
526         test(::Ice::Float(rso[3]) == ::Ice::Float(3.14));
527         test(::Ice::Float(rso[4]) == ::Ice::Float(1.11));
528     }
529 
530     {
531         Test::StringS ssi1;
532         Test::StringS ssi2;
533 
534         ssi1.push_back("abc");
535         ssi1.push_back("de");
536         ssi1.push_back("fghi");
537 
538         ssi2.push_back("xyz");
539 
540         Test::StringS sso;
541         Test::StringS rso;
542 
543         rso = p->opStringS(ssi1, ssi2, sso);
544         test(sso.size() == 4);
545         test(sso[0] == "abc");
546         test(sso[1] == "de");
547         test(sso[2] == "fghi");
548         test(sso[3] == "xyz");
549         test(rso.size() == 3);
550         test(rso[0] == "fghi");
551         test(rso[1] == "de");
552         test(rso[2] == "abc");
553     }
554 
555     {
556         Test::ByteSS bsi1;
557         bsi1.resize(2);
558         Test::ByteSS bsi2;
559         bsi2.resize(2);
560 
561         bsi1[0].push_back(Ice::Byte(0x01));
562         bsi1[0].push_back(Ice::Byte(0x11));
563         bsi1[0].push_back(Ice::Byte(0x12));
564         bsi1[1].push_back(Ice::Byte(0xff));
565 
566         bsi2[0].push_back(Ice::Byte(0x0e));
567         bsi2[1].push_back(Ice::Byte(0xf2));
568         bsi2[1].push_back(Ice::Byte(0xf1));
569 
570         Test::ByteSS bso;
571         Test::ByteSS rso;
572 
573         rso = p->opByteSS(bsi1, bsi2, bso);
574         test(bso.size() == 2);
575         test(bso[0].size() == 1);
576         test(bso[0][0] == Ice::Byte(0xff));
577         test(bso[1].size() == 3);
578         test(bso[1][0] == Ice::Byte(0x01));
579         test(bso[1][1] == Ice::Byte(0x11));
580         test(bso[1][2] == Ice::Byte(0x12));
581         test(rso.size() == 4);
582         test(rso[0].size() == 3);
583         test(rso[0][0] == Ice::Byte(0x01));
584         test(rso[0][1] == Ice::Byte(0x11));
585         test(rso[0][2] == Ice::Byte(0x12));
586         test(rso[1].size() == 1);
587         test(rso[1][0] == Ice::Byte(0xff));
588         test(rso[2].size() == 1);
589         test(rso[2][0] == Ice::Byte(0x0e));
590         test(rso[3].size() == 2);
591         test(rso[3][0] == Ice::Byte(0xf2));
592         test(rso[3][1] == Ice::Byte(0xf1));
593     }
594 
595     {
596         Test::BoolSS bsi1;
597         bsi1.resize(3);
598         Test::BoolSS bsi2;
599         bsi2.resize(1);
600 
601         bsi1[0].push_back(true);
602         bsi1[1].push_back(false);
603         bsi1[2].push_back(true);
604         bsi1[2].push_back(true);
605 
606         bsi2[0].push_back(false);
607         bsi2[0].push_back(false);
608         bsi2[0].push_back(true);
609 
610         Test::BoolSS bso;
611         Test::BoolSS rso;
612 
613         rso = p->opBoolSS(bsi1, bsi2, bso);
614         test(bso.size() == 4);
615         test(bso[0].size() == 1);
616         test(bso[0][0]);
617         test(bso[1].size() == 1);
618         test(!bso[1][0]);
619         test(bso[2].size() == 2);
620         test(bso[2][0]);
621         test(bso[2][1]);
622         test(bso[3].size() == 3);
623         test(!bso[3][0]);
624         test(!bso[3][1]);
625         test(bso[3][2]);
626         test(rso.size() == 3);
627         test(rso[0].size() == 2);
628         test(rso[0][0]);
629         test(rso[0][1]);
630         test(rso[1].size() == 1);
631         test(!rso[1][0]);
632         test(rso[2].size() == 1);
633         test(rso[2][0]);
634     }
635 
636     {
637         Test::ShortSS ssi;
638         ssi.resize(3);
639         Test::IntSS isi;
640         isi.resize(2);
641         Test::LongSS lsi;
642         lsi.resize(1);
643         ssi[0].push_back(1);
644         ssi[0].push_back(2);
645         ssi[0].push_back(5);
646         ssi[1].push_back(13);
647         isi[0].push_back(24);
648         isi[0].push_back(98);
649         isi[1].push_back(42);
650         lsi[0].push_back(496);
651         lsi[0].push_back(1729);
652 
653         Test::LongSS rso;
654         Test::ShortSS sso;
655         Test::IntSS iso;
656         Test::LongSS lso;
657 
658         rso = p->opShortIntLongSS(ssi, isi, lsi, sso, iso, lso);
659         test(rso.size() == 1);
660         test(rso[0].size() == 2);
661         test(rso[0][0] == 496);
662         test(rso[0][1] == 1729);
663         test(sso.size() == 3);
664         test(sso[0].size() == 3);
665         test(sso[0][0] == 1);
666         test(sso[0][1] == 2);
667         test(sso[0][2] == 5);
668         test(sso[1].size() == 1);
669         test(sso[1][0] == 13);
670         test(sso[2].size() == 0);
671         test(iso.size() == 2);
672         test(iso[0].size() == 1);
673         test(iso[0][0] == 42);
674         test(iso[1].size() == 2);
675         test(iso[1][0] == 24);
676         test(iso[1][1] == 98);
677         test(lso.size() == 2);
678         test(lso[0].size() == 2);
679         test(lso[0][0] == 496);
680         test(lso[0][1] == 1729);
681         test(lso[1].size() == 2);
682         test(lso[1][0] == 496);
683         test(lso[1][1] == 1729);
684     }
685 
686     {
687         Test::FloatSS fsi;
688         fsi.resize(3);
689         Test::DoubleSS dsi;
690         dsi.resize(1);
691 
692         fsi[0].push_back(Ice::Float(3.14));
693         fsi[1].push_back(Ice::Float(1.11));
694 
695         dsi[0].push_back(Ice::Double(1.1E10));
696         dsi[0].push_back(Ice::Double(1.2E10));
697         dsi[0].push_back(Ice::Double(1.3E10));
698 
699         Test::FloatSS fso;
700         Test::DoubleSS dso;
701         Test::DoubleSS rso;
702 
703         rso = p->opFloatDoubleSS(fsi, dsi, fso, dso);
704         test(fso.size() == 3);
705         test(fso[0].size() == 1);
706         test(fso[0][0] == ::Ice::Float(3.14));
707         test(fso[1].size() == 1);
708         test(fso[1][0] == ::Ice::Float(1.11));
709         test(fso[2].size() == 0);
710         test(dso.size() == 1);
711         test(dso[0].size() == 3);
712         test(dso[0][0] == ::Ice::Double(1.1E10));
713         test(dso[0][1] == ::Ice::Double(1.2E10));
714         test(dso[0][2] == ::Ice::Double(1.3E10));
715         test(rso.size() == 2);
716         test(rso[0].size() == 3);
717         test(rso[0][0] == ::Ice::Double(1.1E10));
718         test(rso[0][1] == ::Ice::Double(1.2E10));
719         test(rso[0][2] == ::Ice::Double(1.3E10));
720         test(rso[1].size() == 3);
721         test(rso[1][0] == ::Ice::Double(1.1E10));
722         test(rso[1][1] == ::Ice::Double(1.2E10));
723         test(rso[1][2] == ::Ice::Double(1.3E10));
724     }
725 
726     {
727         Test::StringSS ssi1;
728         ssi1.resize(2);
729         Test::StringSS ssi2;
730         ssi2.resize(3);
731 
732         ssi1[0].push_back("abc");
733         ssi1[1].push_back("de");
734         ssi1[1].push_back("fghi");
735 
736         ssi2[2].push_back("xyz");
737 
738         Test::StringSS sso;
739         Test::StringSS rso;
740 
741         rso = p->opStringSS(ssi1, ssi2, sso);
742         test(sso.size() == 5);
743         test(sso[0].size() == 1);
744         test(sso[0][0] == "abc");
745         test(sso[1].size() == 2);
746         test(sso[1][0] == "de");
747         test(sso[1][1] == "fghi");
748         test(sso[2].size() == 0);
749         test(sso[3].size() == 0);
750         test(sso[4].size() == 1);
751         test(sso[4][0] == "xyz");
752         test(rso.size() == 3);
753         test(rso[0].size() == 1);
754         test(rso[0][0] == "xyz");
755         test(rso[1].size() == 0);
756         test(rso[2].size() == 0);
757     }
758 
759     {
760         Test::StringSSS sssi1;
761         sssi1.resize(2);
762         sssi1[0].resize(2);
763         sssi1[0][0].push_back("abc");
764         sssi1[0][0].push_back("de");
765         sssi1[0][1].push_back("xyz");
766         sssi1[1].resize(1);
767         sssi1[1][0].push_back("hello");
768 
769         Test::StringSSS sssi2;
770         sssi2.resize(3);
771         sssi2[0].resize(2);
772         sssi2[0][0].push_back("");
773         sssi2[0][0].push_back("");
774         sssi2[0][1].push_back("abcd");
775         sssi2[1].resize(1);
776         sssi2[1][0].push_back("");
777 
778         Test::StringSSS ssso;
779         Test::StringSSS rsso;
780 
781         rsso = p->opStringSSS(sssi1, sssi2, ssso);
782         test(ssso.size() == 5);
783         test(ssso[0].size() == 2);
784         test(ssso[0][0].size() == 2);
785         test(ssso[0][1].size() == 1);
786         test(ssso[1].size() == 1);
787         test(ssso[1][0].size() == 1);
788         test(ssso[2].size() == 2);
789         test(ssso[2][0].size() == 2);
790         test(ssso[2][1].size() == 1);
791         test(ssso[3].size() == 1);
792         test(ssso[3][0].size() == 1);
793         test(ssso[4].size() == 0);
794         test(ssso[0][0][0] == "abc");
795         test(ssso[0][0][1] == "de");
796         test(ssso[0][1][0] == "xyz");
797         test(ssso[1][0][0] == "hello");
798         test(ssso[2][0][0] == "");
799         test(ssso[2][0][1] == "");
800         test(ssso[2][1][0] == "abcd");
801         test(ssso[3][0][0] == "");
802 
803         test(rsso.size() == 3);
804         test(rsso[0].size() == 0);
805         test(rsso[1].size() == 1);
806         test(rsso[1][0].size() == 1);
807         test(rsso[2].size() == 2);
808         test(rsso[2][0].size() == 2);
809         test(rsso[2][1].size() == 1);
810         test(rsso[1][0][0] == "");
811         test(rsso[2][0][0] == "");
812         test(rsso[2][0][1] == "");
813         test(rsso[2][1][0] == "abcd");
814     }
815 
816     {
817         Test::ByteBoolD di1;
818         di1[10] = true;
819         di1[100] = false;
820         Test::ByteBoolD di2;
821         di2[10] = true;
822         di2[11] = false;
823         di2[101] = true;
824 
825         Test::ByteBoolD _do;
826         Test::ByteBoolD ro = p->opByteBoolD(di1, di2, _do);
827 
828         test(_do == di1);
829         test(ro.size() == 4);
830         test(ro[10] == true);
831         test(ro[11] == false);
832         test(ro[100] == false);
833         test(ro[101] == true);
834     }
835 
836     {
837         Test::ShortIntD di1;
838         di1[110] = -1;
839         di1[1100] = 123123;
840         Test::ShortIntD di2;
841         di2[110] = -1;
842         di2[111] = -100;
843         di2[1101] = 0;
844 
845         Test::ShortIntD _do;
846         Test::ShortIntD ro = p->opShortIntD(di1, di2, _do);
847 
848         test(_do == di1);
849         test(ro.size() == 4);
850         test(ro[110] == -1);
851         test(ro[111] == -100);
852         test(ro[1100] == 123123);
853         test(ro[1101] == 0);
854     }
855 
856     {
857         Test::LongFloatD di1;
858         di1[999999110] = Ice::Float(-1.1);
859         di1[999999111] = Ice::Float(123123.2);
860         Test::LongFloatD di2;
861         di2[999999110] = Ice::Float(-1.1);
862         di2[999999120] = Ice::Float(-100.4);
863         di2[999999130] = Ice::Float(0.5);
864 
865         Test::LongFloatD _do;
866         Test::LongFloatD ro = p->opLongFloatD(di1, di2, _do);
867 
868         test(_do == di1);
869         test(ro.size() == 4);
870         test(ro[999999110] == Ice::Float(-1.1));
871         test(ro[999999120] == Ice::Float(-100.4));
872         test(ro[999999111] == Ice::Float(123123.2));
873         test(ro[999999130] == Ice::Float(0.5));
874     }
875 
876     {
877         Test::StringStringD di1;
878         di1["foo"] = "abc -1.1";
879         di1["bar"] = "abc 123123.2";
880         Test::StringStringD di2;
881         di2["foo"] = "abc -1.1";
882         di2["FOO"] = "abc -100.4";
883         di2["BAR"] = "abc 0.5";
884 
885         Test::StringStringD _do;
886         Test::StringStringD ro = p->opStringStringD(di1, di2, _do);
887 
888         test(_do == di1);
889         test(ro.size() == 4);
890         test(ro["foo"] == "abc -1.1");
891         test(ro["FOO"] == "abc -100.4");
892         test(ro["bar"] == "abc 123123.2");
893         test(ro["BAR"] == "abc 0.5");
894     }
895 
896     {
897         Test::StringMyEnumD di1;
898         di1["abc"] = ICE_ENUM(MyEnum, enum1);
899         di1[""] = ICE_ENUM(MyEnum, enum2);
900         Test::StringMyEnumD di2;
901         di2["abc"] = ICE_ENUM(MyEnum, enum1);
902         di2["qwerty"] = ICE_ENUM(MyEnum, enum3);
903         di2["Hello!!"] = ICE_ENUM(MyEnum, enum2);
904 
905         Test::StringMyEnumD _do;
906         Test::StringMyEnumD ro = p->opStringMyEnumD(di1, di2, _do);
907 
908         test(_do == di1);
909         test(ro.size() == 4);
910         test(ro["abc"] == ICE_ENUM(MyEnum, enum1));
911         test(ro["qwerty"] == ICE_ENUM(MyEnum, enum3));
912         test(ro[""] == ICE_ENUM(MyEnum, enum2));
913         test(ro["Hello!!"] == ICE_ENUM(MyEnum, enum2));
914     }
915 
916     {
917         Test::MyEnumStringD di1;
918         di1[ICE_ENUM(MyEnum, enum1)] = "abc";
919         Test::MyEnumStringD di2;
920         di2[ICE_ENUM(MyEnum, enum2)] = "Hello!!";
921         di2[ICE_ENUM(MyEnum, enum3)] = "qwerty";
922 
923         Test::MyEnumStringD _do;
924         Test::MyEnumStringD ro = p->opMyEnumStringD(di1, di2, _do);
925 
926         test(_do == di1);
927         test(ro.size() == 3);
928         test(ro[ICE_ENUM(MyEnum, enum1)] == "abc");
929         test(ro[ICE_ENUM(MyEnum, enum2)] == "Hello!!");
930         test(ro[ICE_ENUM(MyEnum, enum3)] == "qwerty");
931     }
932 
933     {
934         Test::MyStruct ms11 = { 1, 1 };
935         Test::MyStruct ms12 = { 1, 2 };
936         Test::MyStructMyEnumD di1;
937         di1[ms11] = ICE_ENUM(MyEnum, enum1);
938         di1[ms12] = ICE_ENUM(MyEnum, enum2);
939 
940         Test::MyStruct ms22 = { 2, 2 };
941         Test::MyStruct ms23 = { 2, 3 };
942         Test::MyStructMyEnumD di2;
943         di2[ms11] = ICE_ENUM(MyEnum, enum1);
944         di2[ms22] = ICE_ENUM(MyEnum, enum3);
945         di2[ms23] = ICE_ENUM(MyEnum, enum2);
946 
947         Test::MyStructMyEnumD _do;
948         Test::MyStructMyEnumD ro = p->opMyStructMyEnumD(di1, di2, _do);
949 
950         test(_do == di1);
951         test(ro.size() == 4);
952         test(ro[ms11] == ICE_ENUM(MyEnum, enum1));
953         test(ro[ms12] == ICE_ENUM(MyEnum, enum2));
954         test(ro[ms22] == ICE_ENUM(MyEnum, enum3));
955         test(ro[ms23] == ICE_ENUM(MyEnum, enum2));
956     }
957 
958     {
959         Test::ByteBoolDS dsi1;
960         dsi1.resize(2);
961         Test::ByteBoolDS dsi2;
962         dsi2.resize(1);
963 
964         Test::ByteBoolD di1;
965         di1[10] = true;
966         di1[100] = false;
967         Test::ByteBoolD di2;
968         di2[10] = true;
969         di2[11] = false;
970         di2[101] = true;
971         Test::ByteBoolD di3;
972         di3[100] = false;
973         di3[101] = false;
974 
975         dsi1[0] = di1;
976         dsi1[1] = di2;
977         dsi2[0] = di3;
978 
979         try {
980             Test::ByteBoolDS _do;
981             Test::ByteBoolDS ro = p->opByteBoolDS(dsi1, dsi2, _do);
982 
983             test(ro.size() == 2);
984             test(ro[0].size() == 3);
985             test(ro[0][10] == true);
986             test(ro[0][11] == false);
987             test(ro[0][101] == true);
988             test(ro[1].size() == 2);
989             test(ro[1][10] == true);
990             test(ro[1][100] == false);
991 
992             test(_do.size() == 3);
993             test(_do[0].size() == 2);
994             test(_do[0][100] == false);
995             test(_do[0][101] == false);
996             test(_do[1].size() == 2);
997             test(_do[1][10] == true);
998             test(_do[1][100] == false);
999             test(_do[2].size() == 3);
1000             test(_do[2][10] == true);
1001             test(_do[2][11] == false);
1002             test(_do[2][101] == true);
1003         }
1004         catch(const Ice::OperationNotExistException&)
1005         {
1006         }
1007     }
1008 
1009     {
1010         Test::ShortIntDS dsi1;
1011         dsi1.resize(2);
1012         Test::ShortIntDS dsi2;
1013         dsi2.resize(1);
1014 
1015         Test::ShortIntD di1;
1016         di1[110] = -1;
1017         di1[1100] = 123123;
1018         Test::ShortIntD di2;
1019         di2[110] = -1;
1020         di2[111] = -100;
1021         di2[1101] = 0;
1022         Test::ShortIntD di3;
1023         di3[100] = -1001;
1024 
1025         dsi1[0] = di1;
1026         dsi1[1] = di2;
1027         dsi2[0] = di3;
1028 
1029         try
1030         {
1031             Test::ShortIntDS _do;
1032             Test::ShortIntDS ro = p->opShortIntDS(dsi1, dsi2, _do);
1033 
1034             test(ro.size() == 2);
1035             test(ro[0].size() == 3);
1036             test(ro[0][110] == -1);
1037             test(ro[0][111] == -100);
1038             test(ro[0][1101] == 0);
1039             test(ro[1].size() == 2);
1040             test(ro[1][110] == -1);
1041             test(ro[1][1100] == 123123);
1042 
1043             test(_do.size() == 3);
1044             test(_do[0].size() == 1);
1045             test(_do[0][100] == -1001);
1046             test(_do[1].size() == 2);
1047             test(_do[1][110] == -1);
1048             test(_do[1][1100] == 123123);
1049             test(_do[2].size() == 3);
1050             test(_do[2][110] == -1);
1051             test(_do[2][111] == -100);
1052             test(_do[2][1101] == 0);
1053         }
1054         catch(const Ice::OperationNotExistException&)
1055         {
1056         }
1057     }
1058 
1059     {
1060         Test::LongFloatDS dsi1;
1061         dsi1.resize(2);
1062         Test::LongFloatDS dsi2;
1063         dsi2.resize(1);
1064 
1065         Test::LongFloatD di1;
1066         di1[999999110] = Ice::Float(-1.1);
1067         di1[999999111] = Ice::Float(123123.2);
1068         Test::LongFloatD di2;
1069         di2[999999110] = Ice::Float(-1.1);
1070         di2[999999120] = Ice::Float(-100.4);
1071         di2[999999130] = Ice::Float(0.5);
1072         Test::LongFloatD di3;
1073         di3[999999140] = Ice::Float(3.14);
1074 
1075         dsi1[0] = di1;
1076         dsi1[1] = di2;
1077         dsi2[0] = di3;
1078 
1079         try
1080         {
1081             Test::LongFloatDS _do;
1082             Test::LongFloatDS ro = p->opLongFloatDS(dsi1, dsi2, _do);
1083 
1084             test(ro.size() == 2);
1085             test(ro[0].size() == 3);
1086             test(ro[0][999999110] == Ice::Float(-1.1));
1087             test(ro[0][999999120] == Ice::Float(-100.4));
1088             test(ro[0][999999130] == Ice::Float(0.5));
1089             test(ro[1].size() == 2);
1090             test(ro[1][999999110] == Ice::Float(-1.1));
1091             test(ro[1][999999111] == Ice::Float(123123.2));
1092 
1093             test(_do.size() == 3);
1094             test(_do[0].size() == 1);
1095             test(_do[0][999999140] == Ice::Float(3.14));
1096             test(_do[1].size() == 2);
1097             test(_do[1][999999110] == Ice::Float(-1.1));
1098             test(_do[1][999999111] == Ice::Float(123123.2));
1099             test(_do[2].size() == 3);
1100             test(_do[2][999999110] == Ice::Float(-1.1));
1101             test(_do[2][999999120] == Ice::Float(-100.4));
1102             test(_do[2][999999130] == Ice::Float(0.5));
1103         }
1104         catch(const Ice::OperationNotExistException&)
1105         {
1106         }
1107     }
1108 
1109     {
1110         Test::StringStringDS dsi1;
1111         dsi1.resize(2);
1112         Test::StringStringDS dsi2;
1113         dsi2.resize(1);
1114 
1115         Test::StringStringD di1;
1116         di1["foo"] = "abc -1.1";
1117         di1["bar"] = "abc 123123.2";
1118         Test::StringStringD di2;
1119         di2["foo"] = "abc -1.1";
1120         di2["FOO"] = "abc -100.4";
1121         di2["BAR"] = "abc 0.5";
1122         Test::StringStringD di3;
1123         di3["f00"] = "ABC -3.14";
1124 
1125         dsi1[0] = di1;
1126         dsi1[1] = di2;
1127         dsi2[0] = di3;
1128 
1129         try
1130         {
1131             Test::StringStringDS _do;
1132             Test::StringStringDS ro = p->opStringStringDS(dsi1, dsi2, _do);
1133 
1134             test(ro.size() == 2);
1135             test(ro[0].size() == 3);
1136             test(ro[0]["foo"] == "abc -1.1");
1137             test(ro[0]["FOO"] == "abc -100.4");
1138             test(ro[0]["BAR"] == "abc 0.5");
1139             test(ro[1].size() == 2);
1140             test(ro[1]["foo"] == "abc -1.1");
1141             test(ro[1]["bar"] == "abc 123123.2");
1142 
1143             test(_do.size() == 3);
1144             test(_do[0].size() == 1);
1145             test(_do[0]["f00"] == "ABC -3.14");
1146             test(_do[1].size() == 2);
1147             test(_do[1]["foo"] == "abc -1.1");
1148             test(_do[1]["bar"] == "abc 123123.2");
1149             test(_do[2].size() == 3);
1150             test(_do[2]["foo"] == "abc -1.1");
1151             test(_do[2]["FOO"] == "abc -100.4");
1152             test(_do[2]["BAR"] == "abc 0.5");
1153         }
1154         catch(const Ice::OperationNotExistException&)
1155         {
1156         }
1157     }
1158 
1159     {
1160         Test::StringMyEnumDS dsi1;
1161         dsi1.resize(2);
1162         Test::StringMyEnumDS dsi2;
1163         dsi2.resize(1);
1164 
1165         Test::StringMyEnumD di1;
1166         di1["abc"] = ICE_ENUM(MyEnum, enum1);
1167         di1[""] = ICE_ENUM(MyEnum, enum2);
1168         Test::StringMyEnumD di2;
1169         di2["abc"] = ICE_ENUM(MyEnum, enum1);
1170         di2["qwerty"] = ICE_ENUM(MyEnum, enum3);
1171         di2["Hello!!"] = ICE_ENUM(MyEnum, enum2);
1172         Test::StringMyEnumD di3;
1173         di3["Goodbye"] = ICE_ENUM(MyEnum, enum1);
1174 
1175         dsi1[0] = di1;
1176         dsi1[1] = di2;
1177         dsi2[0] = di3;
1178 
1179         try
1180         {
1181             Test::StringMyEnumDS _do;
1182             Test::StringMyEnumDS ro = p->opStringMyEnumDS(dsi1, dsi2, _do);
1183 
1184             test(ro.size() == 2);
1185             test(ro[0].size() == 3);
1186             test(ro[0]["abc"] == ICE_ENUM(MyEnum, enum1));
1187             test(ro[0]["qwerty"] == ICE_ENUM(MyEnum, enum3));
1188             test(ro[0]["Hello!!"] == ICE_ENUM(MyEnum, enum2));
1189             test(ro[1].size() == 2);
1190             test(ro[1]["abc"] == ICE_ENUM(MyEnum, enum1));
1191             test(ro[1][""] == ICE_ENUM(MyEnum, enum2));
1192 
1193             test(_do.size() == 3);
1194             test(_do[0].size() == 1);
1195             test(_do[0]["Goodbye"] == ICE_ENUM(MyEnum, enum1));
1196             test(_do[1].size() == 2);
1197             test(_do[1]["abc"] == ICE_ENUM(MyEnum, enum1));
1198             test(_do[1][""] == ICE_ENUM(MyEnum, enum2));
1199             test(_do[2].size() == 3);
1200             test(_do[2]["abc"] == ICE_ENUM(MyEnum, enum1));
1201             test(_do[2]["qwerty"] == ICE_ENUM(MyEnum, enum3));
1202             test(_do[2]["Hello!!"] == ICE_ENUM(MyEnum, enum2));
1203         }
1204         catch(const Ice::OperationNotExistException&)
1205         {
1206         }
1207     }
1208 
1209     {
1210         Test::MyEnumStringDS dsi1;
1211         dsi1.resize(2);
1212         Test::MyEnumStringDS dsi2;
1213         dsi2.resize(1);
1214 
1215         Test::MyEnumStringD di1;
1216         di1[ICE_ENUM(MyEnum, enum1)] = "abc";
1217         Test::MyEnumStringD di2;
1218         di2[ICE_ENUM(MyEnum, enum2)] = "Hello!!";
1219         di2[ICE_ENUM(MyEnum, enum3)] = "qwerty";
1220         Test::MyEnumStringD di3;
1221         di3[ICE_ENUM(MyEnum, enum1)] = "Goodbye";
1222 
1223         dsi1[0] = di1;
1224         dsi1[1] = di2;
1225         dsi2[0] = di3;
1226 
1227         try
1228         {
1229             Test::MyEnumStringDS _do;
1230             Test::MyEnumStringDS ro = p->opMyEnumStringDS(dsi1, dsi2, _do);
1231 
1232             test(ro.size() == 2);
1233             test(ro[0].size() == 2);
1234             test(ro[0][ICE_ENUM(MyEnum, enum2)] == "Hello!!");
1235             test(ro[0][ICE_ENUM(MyEnum, enum3)] == "qwerty");
1236             test(ro[1].size() == 1);
1237             test(ro[1][ICE_ENUM(MyEnum, enum1)] == "abc");
1238 
1239             test(_do.size() == 3);
1240             test(_do[0].size() == 1);
1241             test(_do[0][ICE_ENUM(MyEnum, enum1)] == "Goodbye");
1242             test(_do[1].size() == 1);
1243             test(_do[1][ICE_ENUM(MyEnum, enum1)] == "abc");
1244             test(_do[2].size() == 2);
1245             test(_do[2][ICE_ENUM(MyEnum, enum2)] == "Hello!!");
1246             test(_do[2][ICE_ENUM(MyEnum, enum3)] == "qwerty");
1247         }
1248         catch(const Ice::OperationNotExistException&)
1249         {
1250         }
1251     }
1252 
1253     {
1254         Test::MyStructMyEnumDS dsi1;
1255         dsi1.resize(2);
1256         Test::MyStructMyEnumDS dsi2;
1257         dsi2.resize(1);
1258 
1259         Test::MyStruct ms11 = { 1, 1 };
1260         Test::MyStruct ms12 = { 1, 2 };
1261         Test::MyStructMyEnumD di1;
1262         di1[ms11] = ICE_ENUM(MyEnum, enum1);
1263         di1[ms12] = ICE_ENUM(MyEnum, enum2);
1264 
1265         Test::MyStruct ms22 = { 2, 2 };
1266         Test::MyStruct ms23 = { 2, 3 };
1267         Test::MyStructMyEnumD di2;
1268         di2[ms11] = ICE_ENUM(MyEnum, enum1);
1269         di2[ms22] = ICE_ENUM(MyEnum, enum3);
1270         di2[ms23] = ICE_ENUM(MyEnum, enum2);
1271 
1272         Test::MyStructMyEnumD di3;
1273         di3[ms23] = ICE_ENUM(MyEnum, enum3);
1274 
1275         dsi1[0] = di1;
1276         dsi1[1] = di2;
1277         dsi2[0] = di3;
1278 
1279         try
1280         {
1281             Test::MyStructMyEnumDS _do;
1282             Test::MyStructMyEnumDS ro = p->opMyStructMyEnumDS(dsi1, dsi2, _do);
1283 
1284             test(ro.size() == 2);
1285             test(ro[0].size() == 3);
1286             test(ro[0][ms11] == ICE_ENUM(MyEnum, enum1));
1287             test(ro[0][ms22] == ICE_ENUM(MyEnum, enum3));
1288             test(ro[0][ms23] == ICE_ENUM(MyEnum, enum2));
1289             test(ro[1].size() == 2);
1290             test(ro[1][ms11] == ICE_ENUM(MyEnum, enum1));
1291             test(ro[1][ms12] == ICE_ENUM(MyEnum, enum2));
1292 
1293             test(_do.size() == 3);
1294             test(_do[0].size() == 1);
1295             test(_do[0][ms23] == ICE_ENUM(MyEnum, enum3));
1296             test(_do[1].size() == 2);
1297             test(_do[1][ms11] == ICE_ENUM(MyEnum, enum1));
1298             test(_do[1][ms12] == ICE_ENUM(MyEnum, enum2));
1299             test(_do[2].size() == 3);
1300             test(_do[2][ms11] == ICE_ENUM(MyEnum, enum1));
1301             test(_do[2][ms22] == ICE_ENUM(MyEnum, enum3));
1302             test(_do[2][ms23] == ICE_ENUM(MyEnum, enum2));
1303         }
1304         catch(const Ice::OperationNotExistException&)
1305         {
1306         }
1307     }
1308 
1309     {
1310         Test::ByteByteSD sdi1;
1311         Test::ByteByteSD sdi2;
1312 
1313         Test::ByteS si1;
1314         Test::ByteS si2;
1315         Test::ByteS si3;
1316 
1317         si1.push_back(Ice::Byte(0x01));
1318         si1.push_back(Ice::Byte(0x11));
1319         si2.push_back(Ice::Byte(0x12));
1320         si3.push_back(Ice::Byte(0xf2));
1321         si3.push_back(Ice::Byte(0xf3));
1322 
1323         sdi1[Ice::Byte(0x01)] = si1;
1324         sdi1[Ice::Byte(0x22)] = si2;
1325         sdi2[Ice::Byte(0xf1)] = si3;
1326 
1327         try
1328         {
1329             Test::ByteByteSD _do;
1330             Test::ByteByteSD ro = p->opByteByteSD(sdi1, sdi2, _do);
1331 
1332             test(_do == sdi2);
1333             test(ro.size() == 3);
1334             test(ro[Ice::Byte(0x01)].size() == 2);
1335             test(ro[Ice::Byte(0x01)][0] == Ice::Byte(0x01));
1336             test(ro[Ice::Byte(0x01)][1] == Ice::Byte(0x11));
1337             test(ro[Ice::Byte(0x22)].size() == 1);
1338             test(ro[Ice::Byte(0x22)][0] == Ice::Byte(0x12));
1339             test(ro[Ice::Byte(0xf1)].size() == 2);
1340             test(ro[Ice::Byte(0xf1)][0] == Ice::Byte(0xf2));
1341             test(ro[Ice::Byte(0xf1)][1] == Ice::Byte(0xf3));
1342         }
1343         catch(const Ice::OperationNotExistException&)
1344         {
1345         }
1346     }
1347 
1348     {
1349         Test::BoolBoolSD sdi1;
1350         Test::BoolBoolSD sdi2;
1351 
1352         Test::BoolS si1;
1353         Test::BoolS si2;
1354 
1355         si1.push_back(true);
1356         si1.push_back(false);
1357         si2.push_back(false);
1358         si2.push_back(true);
1359         si2.push_back(true);
1360 
1361         sdi1[false] = si1;
1362         sdi1[true] = si2;
1363         sdi2[false] = si1;
1364 
1365         try
1366         {
1367             Test::BoolBoolSD _do;
1368             Test::BoolBoolSD ro = p->opBoolBoolSD(sdi1, sdi2, _do);
1369 
1370             test(_do == sdi2);
1371             test(ro.size() == 2);
1372             test(ro[false].size() == 2);
1373             test(ro[false][0] == true);
1374             test(ro[false][1] == false);
1375             test(ro[true].size() == 3);
1376             test(ro[true][0] == false);
1377             test(ro[true][1] == true);
1378             test(ro[true][2] == true);
1379         }
1380         catch(const Ice::OperationNotExistException&)
1381         {
1382         }
1383     }
1384 
1385     {
1386         Test::ShortShortSD sdi1;
1387         Test::ShortShortSD sdi2;
1388 
1389         Test::ShortS si1;
1390         Test::ShortS si2;
1391         Test::ShortS si3;
1392 
1393         si1.push_back(1);
1394         si1.push_back(2);
1395         si1.push_back(3);
1396         si2.push_back(4);
1397         si2.push_back(5);
1398         si3.push_back(6);
1399         si3.push_back(7);
1400 
1401         sdi1[1] = si1;
1402         sdi1[2] = si2;
1403         sdi2[4] = si3;
1404 
1405         try
1406         {
1407             Test::ShortShortSD _do;
1408             Test::ShortShortSD ro = p->opShortShortSD(sdi1, sdi2, _do);
1409 
1410             test(_do == sdi2);
1411             test(ro.size() == 3);
1412             test(ro[1].size() == 3);
1413             test(ro[1][0] == 1);
1414             test(ro[1][1] == 2);
1415             test(ro[1][2] == 3);
1416             test(ro[2].size() == 2);
1417             test(ro[2][0] == 4);
1418             test(ro[2][1] == 5);
1419             test(ro[4].size() == 2);
1420             test(ro[4][0] == 6);
1421             test(ro[4][1] == 7);
1422         }
1423         catch(const Ice::OperationNotExistException&)
1424         {
1425         }
1426     }
1427 
1428     {
1429         Test::IntIntSD sdi1;
1430         Test::IntIntSD sdi2;
1431 
1432         Test::IntS si1;
1433         Test::IntS si2;
1434         Test::IntS si3;
1435 
1436         si1.push_back(100);
1437         si1.push_back(200);
1438         si1.push_back(300);
1439         si2.push_back(400);
1440         si2.push_back(500);
1441         si3.push_back(600);
1442         si3.push_back(700);
1443 
1444         sdi1[100] = si1;
1445         sdi1[200] = si2;
1446         sdi2[400] = si3;
1447 
1448         try
1449         {
1450             Test::IntIntSD _do;
1451             Test::IntIntSD ro = p->opIntIntSD(sdi1, sdi2, _do);
1452 
1453             test(_do == sdi2);
1454             test(ro.size() == 3);
1455             test(ro[100].size() == 3);
1456             test(ro[100][0] == 100);
1457             test(ro[100][1] == 200);
1458             test(ro[100][2] == 300);
1459             test(ro[200].size() == 2);
1460             test(ro[200][0] == 400);
1461             test(ro[200][1] == 500);
1462             test(ro[400].size() == 2);
1463             test(ro[400][0] == 600);
1464             test(ro[400][1] == 700);
1465         }
1466         catch(const Ice::OperationNotExistException&)
1467         {
1468         }
1469     }
1470 
1471     {
1472         Test::LongLongSD sdi1;
1473         Test::LongLongSD sdi2;
1474 
1475         Test::LongS si1;
1476         Test::LongS si2;
1477         Test::LongS si3;
1478 
1479         si1.push_back(999999110);
1480         si1.push_back(999999111);
1481         si1.push_back(999999110);
1482         si2.push_back(999999120);
1483         si2.push_back(999999130);
1484         si3.push_back(999999110);
1485         si3.push_back(999999120);
1486 
1487         sdi1[999999990] = si1;
1488         sdi1[999999991] = si2;
1489         sdi2[999999992] = si3;
1490 
1491         try
1492         {
1493             Test::LongLongSD _do;
1494             Test::LongLongSD ro = p->opLongLongSD(sdi1, sdi2, _do);
1495 
1496             test(_do == sdi2);
1497             test(ro.size() == 3);
1498             test(ro[999999990].size() == 3);
1499             test(ro[999999990][0] == 999999110);
1500             test(ro[999999990][1] == 999999111);
1501             test(ro[999999990][2] == 999999110);
1502             test(ro[999999991].size() == 2);
1503             test(ro[999999991][0] == 999999120);
1504             test(ro[999999991][1] == 999999130);
1505             test(ro[999999992].size() == 2);
1506             test(ro[999999992][0] == 999999110);
1507             test(ro[999999992][1] == 999999120);
1508         }
1509         catch(const Ice::OperationNotExistException&)
1510         {
1511         }
1512     }
1513 
1514     {
1515         Test::StringFloatSD sdi1;
1516         Test::StringFloatSD sdi2;
1517 
1518         Test::FloatS si1;
1519         Test::FloatS si2;
1520         Test::FloatS si3;
1521 
1522         si1.push_back(Ice::Float(-1.1));
1523         si1.push_back(Ice::Float(123123.2));
1524         si1.push_back(Ice::Float(100.0));
1525         si2.push_back(Ice::Float(42.24));
1526         si2.push_back(Ice::Float(-1.61));
1527         si3.push_back(Ice::Float(-3.14));
1528         si3.push_back(Ice::Float(3.14));
1529 
1530         sdi1["abc"] = si1;
1531         sdi1["ABC"] = si2;
1532         sdi2["aBc"] = si3;
1533 
1534         try
1535         {
1536             Test::StringFloatSD _do;
1537             Test::StringFloatSD ro = p->opStringFloatSD(sdi1, sdi2, _do);
1538 
1539             test(_do == sdi2);
1540             test(ro.size() == 3);
1541             test(ro["abc"].size() == 3);
1542             test(ro["abc"][0] == Ice::Float(-1.1));
1543             test(ro["abc"][1] == Ice::Float(123123.2));
1544             test(ro["abc"][2] == Ice::Float(100.0));
1545             test(ro["ABC"].size() == 2);
1546             test(ro["ABC"][0] == Ice::Float(42.24));
1547             test(ro["ABC"][1] == Ice::Float(-1.61));
1548             test(ro["aBc"].size() == 2);
1549             test(ro["aBc"][0] == Ice::Float(-3.14));
1550             test(ro["aBc"][1] == Ice::Float(3.14));
1551         }
1552         catch(const Ice::OperationNotExistException&)
1553         {
1554         }
1555     }
1556 
1557     {
1558         Test::StringDoubleSD sdi1;
1559         Test::StringDoubleSD sdi2;
1560 
1561         Test::DoubleS si1;
1562         Test::DoubleS si2;
1563         Test::DoubleS si3;
1564 
1565         si1.push_back(Ice::Double(1.1E10));
1566         si1.push_back(Ice::Double(1.2E10));
1567         si1.push_back(Ice::Double(1.3E10));
1568         si2.push_back(Ice::Double(1.4E10));
1569         si2.push_back(Ice::Double(1.5E10));
1570         si3.push_back(Ice::Double(1.6E10));
1571         si3.push_back(Ice::Double(1.7E10));
1572 
1573         sdi1["Hello!!"] = si1;
1574         sdi1["Goodbye"] = si2;
1575         sdi2[""] = si3;
1576 
1577         try
1578         {
1579             Test::StringDoubleSD _do;
1580             Test::StringDoubleSD ro = p->opStringDoubleSD(sdi1, sdi2, _do);
1581 
1582             test(_do == sdi2);
1583             test(ro.size() == 3);
1584             test(ro["Hello!!"].size() == 3);
1585             test(ro["Hello!!"][0] == Ice::Double(1.1E10));
1586             test(ro["Hello!!"][1] == Ice::Double(1.2E10));
1587             test(ro["Hello!!"][2] == Ice::Double(1.3E10));
1588             test(ro["Goodbye"].size() == 2);
1589             test(ro["Goodbye"][0] == Ice::Double(1.4E10));
1590             test(ro["Goodbye"][1] == Ice::Double(1.5E10));
1591             test(ro[""].size() == 2);
1592             test(ro[""][0] == Ice::Double(1.6E10));
1593             test(ro[""][1] == Ice::Double(1.7E10));
1594         }
1595         catch(const Ice::OperationNotExistException&)
1596         {
1597         }
1598     }
1599 
1600     {
1601         Test::StringStringSD sdi1;
1602         Test::StringStringSD sdi2;
1603 
1604         Test::StringS si1;
1605         Test::StringS si2;
1606         Test::StringS si3;
1607 
1608         si1.push_back("abc");
1609         si1.push_back("de");
1610         si1.push_back("fghi");
1611 
1612         si2.push_back("xyz");
1613         si2.push_back("or");
1614 
1615         si3.push_back("and");
1616         si3.push_back("xor");
1617 
1618         sdi1["abc"] = si1;
1619         sdi1["def"] = si2;
1620         sdi2["ghi"] = si3;
1621 
1622         try
1623         {
1624             Test::StringStringSD _do;
1625             Test::StringStringSD ro = p->opStringStringSD(sdi1, sdi2, _do);
1626 
1627             test(_do == sdi2);
1628             test(ro.size() == 3);
1629             test(ro["abc"].size() == 3);
1630             test(ro["abc"][0] == "abc");
1631             test(ro["abc"][1] == "de");
1632             test(ro["abc"][2] == "fghi");
1633             test(ro["def"].size() == 2);
1634             test(ro["def"][0] == "xyz");
1635             test(ro["def"][1] == "or");
1636             test(ro["ghi"].size() == 2);
1637             test(ro["ghi"][0] == "and");
1638             test(ro["ghi"][1] == "xor");
1639         }
1640         catch(const Ice::OperationNotExistException&)
1641         {
1642         }
1643     }
1644 
1645     {
1646         Test::MyEnumMyEnumSD sdi1;
1647         Test::MyEnumMyEnumSD sdi2;
1648 
1649         Test::MyEnumS si1;
1650         Test::MyEnumS si2;
1651         Test::MyEnumS si3;
1652 
1653         si1.push_back(ICE_ENUM(MyEnum, enum1));
1654         si1.push_back(ICE_ENUM(MyEnum, enum1));
1655         si1.push_back(ICE_ENUM(MyEnum, enum2));
1656         si2.push_back(ICE_ENUM(MyEnum, enum1));
1657         si2.push_back(ICE_ENUM(MyEnum, enum2));
1658         si3.push_back(ICE_ENUM(MyEnum, enum3));
1659         si3.push_back(ICE_ENUM(MyEnum, enum3));
1660 
1661         sdi1[ICE_ENUM(MyEnum, enum3)] = si1;
1662         sdi1[ICE_ENUM(MyEnum, enum2)] = si2;
1663         sdi2[ICE_ENUM(MyEnum, enum1)] = si3;
1664 
1665         try
1666         {
1667             Test::MyEnumMyEnumSD _do;
1668             Test::MyEnumMyEnumSD ro = p->opMyEnumMyEnumSD(sdi1, sdi2, _do);
1669 
1670             test(_do == sdi2);
1671             test(ro.size() == 3);
1672             test(ro[ICE_ENUM(MyEnum, enum3)].size() == 3);
1673             test(ro[ICE_ENUM(MyEnum, enum3)][0] == ICE_ENUM(MyEnum, enum1));
1674             test(ro[ICE_ENUM(MyEnum, enum3)][1] == ICE_ENUM(MyEnum, enum1));
1675             test(ro[ICE_ENUM(MyEnum, enum3)][2] == ICE_ENUM(MyEnum, enum2));
1676             test(ro[ICE_ENUM(MyEnum, enum2)].size() == 2);
1677             test(ro[ICE_ENUM(MyEnum, enum2)][0] == ICE_ENUM(MyEnum, enum1));
1678             test(ro[ICE_ENUM(MyEnum, enum2)][1] == ICE_ENUM(MyEnum, enum2));
1679             test(ro[ICE_ENUM(MyEnum, enum1)].size() == 2);
1680             test(ro[ICE_ENUM(MyEnum, enum1)][0] == ICE_ENUM(MyEnum, enum3));
1681             test(ro[ICE_ENUM(MyEnum, enum1)][1] == ICE_ENUM(MyEnum, enum3));
1682         }
1683         catch(const Ice::OperationNotExistException&)
1684         {
1685         }
1686     }
1687 
1688     {
1689         const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
1690 
1691         for(unsigned int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l)
1692         {
1693             Test::IntS s;
1694             for(int i = 0; i < lengths[l]; ++i)
1695             {
1696                 s.push_back(i);
1697             }
1698             Test::IntS r = p->opIntS(s);
1699             test(r.size() == static_cast<size_t>(lengths[l]));
1700             for(int j = 0; j < static_cast<int>(r.size()); ++j)
1701             {
1702                 test(r[j] == -j);
1703             }
1704         }
1705     }
1706 
1707     {
1708         {
1709             Ice::Context ctx;
1710             ctx["one"] = "ONE";
1711             ctx["two"] = "TWO";
1712             ctx["three"] = "THREE";
1713             {
1714                 Test::StringStringD r = p->opContext();
1715                 test(p->ice_getContext().empty());
1716                 test(r != ctx);
1717             }
1718             {
1719                 Test::StringStringD r = p->opContext(ctx);
1720                 test(p->ice_getContext().empty());
1721                 test(r == ctx);
1722             }
1723             {
1724                 Test::MyClassPrxPtr p2 = ICE_CHECKED_CAST(Test::MyClassPrx, p->ice_context(ctx));
1725                 test(p2->ice_getContext() == ctx);
1726                 Test::StringStringD r = p2->opContext();
1727                 test(r == ctx);
1728                 r = p2->opContext(ctx);
1729                 test(r == ctx);
1730             }
1731         }
1732 
1733         if(p->ice_getConnection() && communicator->getProperties()->getProperty("Ice.Default.Protocol") != "bt")
1734         {
1735             //
1736             // Test implicit context propagation
1737             //
1738 
1739             string impls[] = {"Shared", "PerThread"};
1740             for(int i = 0; i < 2; i++)
1741             {
1742                 Ice::InitializationData initData;
1743                 initData.properties = communicator->getProperties()->clone();
1744                 initData.properties->setProperty("Ice.ImplicitContext", impls[i]);
1745 
1746                 Ice::CommunicatorPtr ic = Ice::initialize(initData);
1747 
1748                 Ice::Context ctx;
1749                 ctx["one"] = "ONE";
1750                 ctx["two"] = "TWO";
1751                 ctx["three"] = "THREE";
1752 
1753                 Ice::PropertiesPtr properties = ic->getProperties();
1754                 Test::MyClassPrxPtr q =
1755                     ICE_UNCHECKED_CAST(Test::MyClassPrx,
1756                                        ic->stringToProxy("test:" + TestHelper::getTestEndpoint(properties, 0)));
1757 
1758                 ic->getImplicitContext()->setContext(ctx);
1759                 test(ic->getImplicitContext()->getContext() == ctx);
1760                 test(q->opContext() == ctx);
1761 
1762                 test(ic->getImplicitContext()->containsKey("zero") == false);
1763                 string r = ic->getImplicitContext()->put("zero", "ZERO");
1764                 test(r == "");
1765                 test(ic->getImplicitContext()->containsKey("zero") == true);
1766                 test(ic->getImplicitContext()->get("zero") == "ZERO");
1767 
1768                 ctx = ic->getImplicitContext()->getContext();
1769                 test(q->opContext() == ctx);
1770                 Ice::Context prxContext;
1771                 prxContext["one"] = "UN";
1772                 prxContext["four"] = "QUATRE";
1773 
1774                 Ice::Context combined = prxContext;
1775                 combined.insert(ctx.begin(), ctx.end());
1776                 test(combined["one"] == "UN");
1777 
1778                 q = ICE_UNCHECKED_CAST(Test::MyClassPrx, q->ice_context(prxContext));
1779 
1780                 ic->getImplicitContext()->setContext(Ice::Context());
1781                 test(q->opContext() == prxContext);
1782 
1783                 ic->getImplicitContext()->setContext(ctx);
1784                 test(q->opContext() == combined);
1785 
1786                 test(ic->getImplicitContext()->remove("one") == "ONE");
1787 
1788                 if(impls[i] == "PerThread")
1789                 {
1790                     IceUtil::ThreadPtr thread = new PerThreadContextInvokeThread(q->ice_context(Ice::Context()));
1791                     thread->start();
1792                     thread->getThreadControl().join();
1793                 }
1794 
1795                 ic->getImplicitContext()->setContext(Ice::Context()); // Clear the context to avoid leak report.
1796                 ic->destroy();
1797             }
1798         }
1799     }
1800 
1801     {
1802         Ice::Double d = 1278312346.0 / 13.0;
1803         Test::DoubleS ds(5, d);
1804         p->opDoubleMarshaling(d, ds);
1805     }
1806 
1807     p->opIdempotent();
1808 
1809     p->opNonmutating();
1810 
1811     test(p->opByte1(0xFF) == 0xFF);
1812     test(p->opShort1(0x7FFF) == 0x7FFF);
1813     test(p->opInt1(0x7FFFFFFF) == 0x7FFFFFFF);
1814     test(p->opLong1(0x7FFFFFFFFFFFFFFFLL) == 0x7FFFFFFFFFFFFFFFLL);
1815     test(p->opFloat1(1.0) == 1.0);
1816     test(p->opDouble1(1.0) == 1.0);
1817     test(p->opString1("opString1") == "opString1");
1818 
1819     Test::MyDerivedClassPrxPtr d = ICE_UNCHECKED_CAST(Test::MyDerivedClassPrx, p);
1820 
1821     Test::MyStruct1 s;
1822     s.tesT = "Test::MyStruct1::s";
1823     s.myClass = 0;
1824     s.myStruct1 = "Test::MyStruct1::myStruct1";
1825     s = d->opMyStruct1(s);
1826     test(s.tesT == "Test::MyStruct1::s");
1827     test(s.myClass == 0);
1828     test(s.myStruct1 == "Test::MyStruct1::myStruct1");
1829 
1830     Test::MyClass1Ptr c = ICE_MAKE_SHARED(Test::MyClass1);
1831     c->tesT = "Test::MyClass1::testT";
1832     c->myClass = 0;
1833     c->myClass1 = "Test::MyClass1::myClass1";
1834     c = d->opMyClass1(c);
1835     test(c->tesT == "Test::MyClass1::testT");
1836     test(c->myClass == 0);
1837     test(c->myClass1 == "Test::MyClass1::myClass1");
1838 
1839     Test::StringS seq;
1840     p->opStringS1(seq);
1841 
1842     Test::ByteBoolD dict;
1843     p->opByteBoolD1(dict);
1844 
1845     {
1846         Test::Structure p1 = p->opMStruct1();
1847         p1.e = ICE_ENUM(MyEnum, enum3);
1848         Test::Structure p2, p3;
1849         p3 = p->opMStruct2(p1, p2);
1850         test(p2.e == p1.e && p3.e == p1.e);
1851     }
1852 
1853     {
1854         p->opMSeq1();
1855 
1856         StringS p1;
1857         p1.push_back("test");
1858         StringS p2, p3;
1859         p3 = p->opMSeq2(p1, p2);
1860         test(p2 == p1 && p3 == p1);
1861     }
1862 
1863     {
1864         p->opMDict1();
1865 
1866         map<string, string> p1;
1867         p1["test"] = "test";
1868         map<string, string> p2, p3;
1869         p3 = p->opMDict2(p1, p2);
1870         test(p2 == p1 && p3 == p1);
1871     }
1872 }
1873