ICE 3.4.2
[php5-ice-freebsdport.git] / py / test / Ice / inheritance / AllTests.py
blob3a2f243b1f39ffcea85654a9c0c2259dccae4950
1 # **********************************************************************
3 # Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
5 # This copy of Ice is licensed to you under the terms described in the
6 # ICE_LICENSE file included in this distribution.
8 # **********************************************************************
10 import Ice, Test
12 def test(b):
13 if not b:
14 raise RuntimeError('test assertion failed')
16 def allTests(communicator):
17 print "testing stringToProxy... ",
18 ref = "initial:default -p 12010"
19 base = communicator.stringToProxy(ref)
20 test(base)
21 print "ok"
23 print "testing checked cast... ",
24 initial = Test.InitialPrx.checkedCast(base)
25 test(initial)
26 test(initial == base)
27 print "ok"
29 print "getting proxies for class hierarchy... ",
30 ca = initial.caop()
31 cb = initial.cbop()
32 cc = initial.ccop()
33 cd = initial.cdop()
34 test(ca != cb)
35 test(ca != cc)
36 test(ca != cd)
37 test(cb != cc)
38 test(cb != cd)
39 test(cc != cd)
40 print "ok"
42 print "getting proxies for interface hierarchy... ",
43 ia = initial.iaop()
44 ib1 = initial.ib1op()
45 ib2 = initial.ib2op()
46 ic = initial.icop()
47 test(ia != ib1)
48 test(ia != ib2)
49 test(ia != ic)
50 test(ib1 != ic)
51 test(ib2 != ic)
52 print "ok"
54 print "invoking proxy operations on class hierarchy... ",
55 cao = ca.caop(ca)
56 test(cao == ca)
57 cao = ca.caop(cb)
58 test(cao == cb)
59 cao = ca.caop(cc)
60 test(cao == cc)
61 cao = cb.caop(ca)
62 test(cao == ca)
63 cao = cb.caop(cb)
64 test(cao == cb)
65 cao = cb.caop(cc)
66 test(cao == cc)
67 cao = cc.caop(ca)
68 test(cao == ca)
69 cao = cc.caop(cb)
70 test(cao == cb)
71 cao = cc.caop(cc)
72 test(cao == cc)
74 cao = cb.cbop(cb)
75 test(cao == cb)
76 cbo = cb.cbop(cb)
77 test(cbo == cb)
78 cao = cb.cbop(cc)
79 test(cao == cc)
80 cbo = cb.cbop(cc)
81 test(cbo == cc)
82 cao = cc.cbop(cb)
83 test(cao == cb)
84 cbo = cc.cbop(cb)
85 test(cbo == cb)
86 cao = cc.cbop(cc)
87 test(cao == cc)
88 cbo = cc.cbop(cc)
89 test(cbo == cc)
91 cao = cc.ccop(cc)
92 test(cao == cc)
93 cbo = cc.ccop(cc)
94 test(cbo == cc)
95 cco = cc.ccop(cc)
96 test(cco == cc)
97 print "ok"
99 print "ditto, but for interface hierarchy... ",
100 iao = ia.iaop(ia)
101 test(iao == ia)
102 iao = ia.iaop(ib1)
103 test(iao == ib1)
104 iao = ia.iaop(ib2)
105 test(iao == ib2)
106 iao = ia.iaop(ic)
107 test(iao == ic)
108 iao = ib1.iaop(ia)
109 test(iao == ia)
110 iao = ib1.iaop(ib1)
111 test(iao == ib1)
112 iao = ib1.iaop(ib2)
113 test(iao == ib2)
114 iao = ib1.iaop(ic)
115 test(iao == ic)
116 iao = ib2.iaop(ia)
117 test(iao == ia)
118 iao = ib2.iaop(ib1)
119 test(iao == ib1)
120 iao = ib2.iaop(ib2)
121 test(iao == ib2)
122 iao = ib2.iaop(ic)
123 test(iao == ic)
124 iao = ic.iaop(ia)
125 test(iao == ia)
126 iao = ic.iaop(ib1)
127 test(iao == ib1)
128 iao = ic.iaop(ib2)
129 test(iao == ib2)
130 iao = ic.iaop(ic)
131 test(iao == ic)
133 iao = ib1.ib1op(ib1)
134 test(iao == ib1)
135 ib1o = ib1.ib1op(ib1)
136 test(ib1o == ib1)
137 iao = ib1.ib1op(ic)
138 test(iao == ic)
139 ib1o = ib1.ib1op(ic)
140 test(ib1o == ic)
141 iao = ic.ib1op(ib1)
142 test(iao == ib1)
143 ib1o = ic.ib1op(ib1)
144 test(ib1o == ib1)
145 iao = ic.ib1op(ic)
146 test(iao == ic)
147 ib1o = ic.ib1op(ic)
148 test(ib1o == ic)
150 iao = ib2.ib2op(ib2)
151 test(iao == ib2)
152 ib2o = ib2.ib2op(ib2)
153 test(ib2o == ib2)
154 iao = ib2.ib2op(ic)
155 test(iao == ic)
156 ib2o = ib2.ib2op(ic)
157 test(ib2o == ic)
158 iao = ic.ib2op(ib2)
159 test(iao == ib2)
160 ib2o = ic.ib2op(ib2)
161 test(ib2o == ib2)
162 iao = ic.ib2op(ic)
163 test(iao == ic)
164 ib2o = ic.ib2op(ic)
165 test(ib2o == ic)
167 iao = ic.icop(ic)
168 test(iao == ic)
169 ib1o = ic.icop(ic)
170 test(ib1o == ic)
171 ib2o = ic.icop(ic)
172 test(ib2o == ic)
173 ico = ic.icop(ic)
174 test(ico == ic)
176 print "ok"
178 print "ditto, but for class implementing interfaces... ",
179 cao = cd.caop(cd)
180 test(cao == cd)
181 cbo = cd.cbop(cd)
182 test(cbo == cd)
183 cco = cd.ccop(cd)
184 test(cco == cd)
186 iao = cd.iaop(cd)
187 test(iao == cd)
188 ib1o = cd.ib1op(cd)
189 test(ib1o == cd)
190 ib2o = cd.ib2op(cd)
191 test(ib2o == cd)
193 cao = cd.cdop(cd)
194 test(cao == cd)
195 cbo = cd.cdop(cd)
196 test(cbo == cd)
197 cco = cd.cdop(cd)
198 test(cco == cd)
200 iao = cd.cdop(cd)
201 test(iao == cd)
202 ib1o = cd.cdop(cd)
203 test(ib1o == cd)
204 ib2o = cd.cdop(cd)
205 test(ib2o == cd)
207 print "ok"
209 return initial