ICE 3.4.2
[php5-ice-freebsdport.git] / rb / test / Ice / inheritance / AllTests.rb
blob196dcaf6210cb183b5fbe23a1c9d49b90fb4460c
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 def test(b)
11     if !b
12         raise RuntimeError, 'test assertion failed'
13     end
14 end
16 def allTests(communicator)
17     print "testing stringToProxy... "
18     STDOUT.flush
19     ref = "initial:default -p 12010"
20     base = communicator.stringToProxy(ref)
21     test(base)
22     puts "ok"
24     print "testing checked cast... "
25     STDOUT.flush
26     initial = Test::InitialPrx::checkedCast(base)
27     test(initial)
28     test(initial == base)
29     puts "ok"
31     print "getting proxies for class hierarchy... "
32     STDOUT.flush
33     ca = initial.caop()
34     cb = initial.cbop()
35     cc = initial.ccop()
36     cd = initial.cdop()
37     test(ca != cb)
38     test(ca != cc)
39     test(ca != cd)
40     test(cb != cc)
41     test(cb != cd)
42     test(cc != cd)
43     puts "ok"
45     print "getting proxies for interface hierarchy... "
46     STDOUT.flush
47     ia = initial.iaop()
48     ib1 = initial.ib1op()
49     ib2 = initial.ib2op()
50     ic = initial.icop()
51     test(ia != ib1)
52     test(ia != ib2)
53     test(ia != ic)
54     test(ib1 != ic)
55     test(ib2 != ic)
56     puts "ok"
58     print "invoking proxy operations on class hierarchy... "
59     STDOUT.flush
60     cao = ca.caop(ca)
61     test(cao == ca)
62     cao = ca.caop(cb)
63     test(cao == cb)
64     cao = ca.caop(cc)
65     test(cao == cc)
66     cao = cb.caop(ca)
67     test(cao == ca)
68     cao = cb.caop(cb)
69     test(cao == cb)
70     cao = cb.caop(cc)
71     test(cao == cc)
72     cao = cc.caop(ca)
73     test(cao == ca)
74     cao = cc.caop(cb)
75     test(cao == cb)
76     cao = cc.caop(cc)
77     test(cao == cc)
79     cao = cb.cbop(cb)
80     test(cao == cb)
81     cbo = cb.cbop(cb)
82     test(cbo == cb)
83     cao = cb.cbop(cc)
84     test(cao == cc)
85     cbo = cb.cbop(cc)
86     test(cbo == cc)
87     cao = cc.cbop(cb)
88     test(cao == cb)
89     cbo = cc.cbop(cb)
90     test(cbo == cb)
91     cao = cc.cbop(cc)
92     test(cao == cc)
93     cbo = cc.cbop(cc)
94     test(cbo == cc)
96     cao = cc.ccop(cc)
97     test(cao == cc)
98     cbo = cc.ccop(cc)
99     test(cbo == cc)
100     cco = cc.ccop(cc)
101     test(cco == cc)
102     puts "ok"
104     print "ditto, but for interface hierarchy... "
105     STDOUT.flush
106     iao = ia.iaop(ia)
107     test(iao == ia)
108     iao = ia.iaop(ib1)
109     test(iao == ib1)
110     iao = ia.iaop(ib2)
111     test(iao == ib2)
112     iao = ia.iaop(ic)
113     test(iao == ic)
114     iao = ib1.iaop(ia)
115     test(iao == ia)
116     iao = ib1.iaop(ib1)
117     test(iao == ib1)
118     iao = ib1.iaop(ib2)
119     test(iao == ib2)
120     iao = ib1.iaop(ic)
121     test(iao == ic)
122     iao = ib2.iaop(ia)
123     test(iao == ia)
124     iao = ib2.iaop(ib1)
125     test(iao == ib1)
126     iao = ib2.iaop(ib2)
127     test(iao == ib2)
128     iao = ib2.iaop(ic)
129     test(iao == ic)
130     iao = ic.iaop(ia)
131     test(iao == ia)
132     iao = ic.iaop(ib1)
133     test(iao == ib1)
134     iao = ic.iaop(ib2)
135     test(iao == ib2)
136     iao = ic.iaop(ic)
137     test(iao == ic)
139     iao = ib1.ib1op(ib1)
140     test(iao == ib1)
141     ib1o = ib1.ib1op(ib1)
142     test(ib1o == ib1)
143     iao = ib1.ib1op(ic)
144     test(iao == ic)
145     ib1o = ib1.ib1op(ic)
146     test(ib1o == ic)
147     iao = ic.ib1op(ib1)
148     test(iao == ib1)
149     ib1o = ic.ib1op(ib1)
150     test(ib1o == ib1)
151     iao = ic.ib1op(ic)
152     test(iao == ic)
153     ib1o = ic.ib1op(ic)
154     test(ib1o == ic)
156     iao = ib2.ib2op(ib2)
157     test(iao == ib2)
158     ib2o = ib2.ib2op(ib2)
159     test(ib2o == ib2)
160     iao = ib2.ib2op(ic)
161     test(iao == ic)
162     ib2o = ib2.ib2op(ic)
163     test(ib2o == ic)
164     iao = ic.ib2op(ib2)
165     test(iao == ib2)
166     ib2o = ic.ib2op(ib2)
167     test(ib2o == ib2)
168     iao = ic.ib2op(ic)
169     test(iao == ic)
170     ib2o = ic.ib2op(ic)
171     test(ib2o == ic)
173     iao = ic.icop(ic)
174     test(iao == ic)
175     ib1o = ic.icop(ic)
176     test(ib1o == ic)
177     ib2o = ic.icop(ic)
178     test(ib2o == ic)
179     ico = ic.icop(ic)
180     test(ico == ic)
182     puts "ok"
184     print "ditto, but for class implementing interfaces... "
185     STDOUT.flush
186     cao = cd.caop(cd)
187     test(cao == cd)
188     cbo = cd.cbop(cd)
189     test(cbo == cd)
190     cco = cd.ccop(cd)
191     test(cco == cd)
193     iao = cd.iaop(cd)
194     test(iao == cd)
195     ib1o = cd.ib1op(cd)
196     test(ib1o == cd)
197     ib2o = cd.ib2op(cd)
198     test(ib2o == cd)
200     cao = cd.cdop(cd)
201     test(cao == cd)
202     cbo = cd.cdop(cd)
203     test(cbo == cd)
204     cco = cd.cdop(cd)
205     test(cco == cd)
207     iao = cd.cdop(cd)
208     test(iao == cd)
209     ib1o = cd.cdop(cd)
210     test(ib1o == cd)
211     ib2o = cd.cdop(cd)
212     test(ib2o == cd)
214     puts "ok"
216     return initial