| 30 |
ashish |
1 |
/*
|
|
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one
|
|
|
3 |
* or more contributor license agreements. See the NOTICE file
|
|
|
4 |
* distributed with this work for additional information
|
|
|
5 |
* regarding copyright ownership. The ASF licenses this file
|
|
|
6 |
* to you under the Apache License, Version 2.0 (the
|
|
|
7 |
* "License"); you may not use this file except in compliance
|
|
|
8 |
* with the License. You may obtain a copy of the License at
|
|
|
9 |
*
|
|
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
11 |
*
|
|
|
12 |
* Unless required by applicable law or agreed to in writing,
|
|
|
13 |
* software distributed under the License is distributed on an
|
|
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
15 |
* KIND, either express or implied. See the License for the
|
|
|
16 |
* specific language governing permissions and limitations
|
|
|
17 |
* under the License.
|
|
|
18 |
*/
|
|
|
19 |
|
|
|
20 |
/*
|
|
|
21 |
This program was generated by the following Python script:
|
|
|
22 |
|
|
|
23 |
#!/usr/bin/python2.5
|
|
|
24 |
|
|
|
25 |
# Remove this when Python 2.6 hits the streets.
|
|
|
26 |
from __future__ import with_statement
|
|
|
27 |
|
|
|
28 |
import sys
|
|
|
29 |
import os.path
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
# Quines the easy way.
|
|
|
33 |
with open(sys.argv[0], 'r') as handle:
|
|
|
34 |
source = handle.read()
|
|
|
35 |
|
|
|
36 |
with open(os.path.join(os.path.dirname(sys.argv[0]), 'EqualityTest.java'), 'w') as out:
|
|
|
37 |
print >> out, ("/""*" r"""
|
|
|
38 |
* Licensed to the Apache Software Foundation (ASF) under one
|
|
|
39 |
* or more contributor license agreements. See the NOTICE file
|
|
|
40 |
* distributed with this work for additional information
|
|
|
41 |
* regarding copyright ownership. The ASF licenses this file
|
|
|
42 |
* to you under the Apache License, Version 2.0 (the
|
|
|
43 |
* "License"); you may not use this file except in compliance
|
|
|
44 |
* with the License. You may obtain a copy of the License at
|
|
|
45 |
*
|
|
|
46 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
47 |
*
|
|
|
48 |
* Unless required by applicable law or agreed to in writing,
|
|
|
49 |
* software distributed under the License is distributed on an
|
|
|
50 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
51 |
* KIND, either express or implied. See the License for the
|
|
|
52 |
* specific language governing permissions and limitations
|
|
|
53 |
* under the License.
|
|
|
54 |
""" "*""/")
|
|
|
55 |
print >> out
|
|
|
56 |
print >> out, "/""*"
|
|
|
57 |
print >> out, "This program was generated by the following Python script:"
|
|
|
58 |
print >> out
|
|
|
59 |
out.write(source)
|
|
|
60 |
print >> out, "*""/"
|
|
|
61 |
|
|
|
62 |
print >> out, r'''
|
|
|
63 |
package org.apache.thrift.test;
|
|
|
64 |
|
|
|
65 |
// Generated code
|
|
|
66 |
import thrift.test.*;
|
|
|
67 |
|
|
|
68 |
/'''r'''**
|
|
|
69 |
*'''r'''/
|
|
|
70 |
public class EqualityTest {
|
|
|
71 |
public static void main(String[] args) throws Exception {
|
|
|
72 |
JavaTestHelper lhs, rhs;
|
|
|
73 |
'''
|
|
|
74 |
|
|
|
75 |
vals = {
|
|
|
76 |
'int': ("1", "2"),
|
|
|
77 |
'obj': ("\"foo\"", "\"bar\""),
|
|
|
78 |
'bin': ("new byte[]{1,2}", "new byte[]{3,4}"),
|
|
|
79 |
}
|
|
|
80 |
matrix = (
|
|
|
81 |
(False,False),
|
|
|
82 |
(False,True ),
|
|
|
83 |
(True ,False),
|
|
|
84 |
(True ,True ),
|
|
|
85 |
)
|
|
|
86 |
|
|
|
87 |
for type in ('int', 'obj', 'bin'):
|
|
|
88 |
for option in ('req', 'opt'):
|
|
|
89 |
nulls = matrix[0:1] if type == 'int' else matrix[-1::-1]
|
|
|
90 |
issets = matrix
|
|
|
91 |
for is_null in nulls:
|
|
|
92 |
for is_set in issets:
|
|
|
93 |
# isset is implied for non-primitives, so only consider the case
|
|
|
94 |
# where isset and non-null match.
|
|
|
95 |
if type != 'int' and list(is_set) != [ not null for null in is_null ]:
|
|
|
96 |
continue
|
|
|
97 |
for equal in (True, False):
|
|
|
98 |
print >> out
|
|
|
99 |
print >> out, " lhs = new JavaTestHelper();"
|
|
|
100 |
print >> out, " rhs = new JavaTestHelper();"
|
|
|
101 |
print >> out, " lhs." + option + "_" + type, "=", vals[type][0] + ";"
|
|
|
102 |
print >> out, " rhs." + option + "_" + type, "=", vals[type][0 if equal else 1] + ";"
|
|
|
103 |
isset_setter = "set" + option[0].upper() + option[1:] + "_" + type + "IsSet"
|
|
|
104 |
if (type == 'int' and is_set[0]): print >> out, " lhs." + isset_setter + "(true);"
|
|
|
105 |
if (type == 'int' and is_set[1]): print >> out, " rhs." + isset_setter + "(true);"
|
|
|
106 |
if (is_null[0]): print >> out, " lhs." + option + "_" + type, "= null;"
|
|
|
107 |
if (is_null[1]): print >> out, " rhs." + option + "_" + type, "= null;"
|
|
|
108 |
this_present = not is_null[0] and (option == 'req' or is_set[0])
|
|
|
109 |
that_present = not is_null[1] and (option == 'req' or is_set[1])
|
|
|
110 |
print >> out, " // this_present = " + repr(this_present)
|
|
|
111 |
print >> out, " // that_present = " + repr(that_present)
|
|
|
112 |
is_equal = \
|
|
|
113 |
(not this_present and not that_present) or \
|
|
|
114 |
(this_present and that_present and equal)
|
|
|
115 |
eq_str = 'true' if is_equal else 'false'
|
|
|
116 |
|
|
|
117 |
print >> out, " if (lhs.equals(rhs) != "+eq_str+")"
|
|
|
118 |
print >> out, " throw new RuntimeException(\"Failure\");"
|
|
|
119 |
if is_equal:
|
|
|
120 |
print >> out, " if (lhs.hashCode() != rhs.hashCode())"
|
|
|
121 |
print >> out, " throw new RuntimeException(\"Failure\");"
|
|
|
122 |
|
|
|
123 |
print >> out, r'''
|
|
|
124 |
}
|
|
|
125 |
}
|
|
|
126 |
'''
|
|
|
127 |
*/
|
|
|
128 |
|
|
|
129 |
package org.apache.thrift.test;
|
|
|
130 |
|
|
|
131 |
// Generated code
|
|
|
132 |
import thrift.test.*;
|
|
|
133 |
|
|
|
134 |
/**
|
|
|
135 |
*/
|
|
|
136 |
public class EqualityTest {
|
|
|
137 |
public static void main(String[] args) throws Exception {
|
|
|
138 |
JavaTestHelper lhs, rhs;
|
|
|
139 |
|
|
|
140 |
|
|
|
141 |
lhs = new JavaTestHelper();
|
|
|
142 |
rhs = new JavaTestHelper();
|
|
|
143 |
lhs.req_int = 1;
|
|
|
144 |
rhs.req_int = 1;
|
|
|
145 |
// this_present = True
|
|
|
146 |
// that_present = True
|
|
|
147 |
if (lhs.equals(rhs) != true)
|
|
|
148 |
throw new RuntimeException("Failure");
|
|
|
149 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
150 |
throw new RuntimeException("Failure");
|
|
|
151 |
|
|
|
152 |
lhs = new JavaTestHelper();
|
|
|
153 |
rhs = new JavaTestHelper();
|
|
|
154 |
lhs.req_int = 1;
|
|
|
155 |
rhs.req_int = 2;
|
|
|
156 |
// this_present = True
|
|
|
157 |
// that_present = True
|
|
|
158 |
if (lhs.equals(rhs) != false)
|
|
|
159 |
throw new RuntimeException("Failure");
|
|
|
160 |
|
|
|
161 |
lhs = new JavaTestHelper();
|
|
|
162 |
rhs = new JavaTestHelper();
|
|
|
163 |
lhs.req_int = 1;
|
|
|
164 |
rhs.req_int = 1;
|
|
|
165 |
rhs.setReq_intIsSet(true);
|
|
|
166 |
// this_present = True
|
|
|
167 |
// that_present = True
|
|
|
168 |
if (lhs.equals(rhs) != true)
|
|
|
169 |
throw new RuntimeException("Failure");
|
|
|
170 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
171 |
throw new RuntimeException("Failure");
|
|
|
172 |
|
|
|
173 |
lhs = new JavaTestHelper();
|
|
|
174 |
rhs = new JavaTestHelper();
|
|
|
175 |
lhs.req_int = 1;
|
|
|
176 |
rhs.req_int = 2;
|
|
|
177 |
rhs.setReq_intIsSet(true);
|
|
|
178 |
// this_present = True
|
|
|
179 |
// that_present = True
|
|
|
180 |
if (lhs.equals(rhs) != false)
|
|
|
181 |
throw new RuntimeException("Failure");
|
|
|
182 |
|
|
|
183 |
lhs = new JavaTestHelper();
|
|
|
184 |
rhs = new JavaTestHelper();
|
|
|
185 |
lhs.req_int = 1;
|
|
|
186 |
rhs.req_int = 1;
|
|
|
187 |
lhs.setReq_intIsSet(true);
|
|
|
188 |
// this_present = True
|
|
|
189 |
// that_present = True
|
|
|
190 |
if (lhs.equals(rhs) != true)
|
|
|
191 |
throw new RuntimeException("Failure");
|
|
|
192 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
193 |
throw new RuntimeException("Failure");
|
|
|
194 |
|
|
|
195 |
lhs = new JavaTestHelper();
|
|
|
196 |
rhs = new JavaTestHelper();
|
|
|
197 |
lhs.req_int = 1;
|
|
|
198 |
rhs.req_int = 2;
|
|
|
199 |
lhs.setReq_intIsSet(true);
|
|
|
200 |
// this_present = True
|
|
|
201 |
// that_present = True
|
|
|
202 |
if (lhs.equals(rhs) != false)
|
|
|
203 |
throw new RuntimeException("Failure");
|
|
|
204 |
|
|
|
205 |
lhs = new JavaTestHelper();
|
|
|
206 |
rhs = new JavaTestHelper();
|
|
|
207 |
lhs.req_int = 1;
|
|
|
208 |
rhs.req_int = 1;
|
|
|
209 |
lhs.setReq_intIsSet(true);
|
|
|
210 |
rhs.setReq_intIsSet(true);
|
|
|
211 |
// this_present = True
|
|
|
212 |
// that_present = True
|
|
|
213 |
if (lhs.equals(rhs) != true)
|
|
|
214 |
throw new RuntimeException("Failure");
|
|
|
215 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
216 |
throw new RuntimeException("Failure");
|
|
|
217 |
|
|
|
218 |
lhs = new JavaTestHelper();
|
|
|
219 |
rhs = new JavaTestHelper();
|
|
|
220 |
lhs.req_int = 1;
|
|
|
221 |
rhs.req_int = 2;
|
|
|
222 |
lhs.setReq_intIsSet(true);
|
|
|
223 |
rhs.setReq_intIsSet(true);
|
|
|
224 |
// this_present = True
|
|
|
225 |
// that_present = True
|
|
|
226 |
if (lhs.equals(rhs) != false)
|
|
|
227 |
throw new RuntimeException("Failure");
|
|
|
228 |
|
|
|
229 |
lhs = new JavaTestHelper();
|
|
|
230 |
rhs = new JavaTestHelper();
|
|
|
231 |
lhs.opt_int = 1;
|
|
|
232 |
rhs.opt_int = 1;
|
|
|
233 |
// this_present = False
|
|
|
234 |
// that_present = False
|
|
|
235 |
if (lhs.equals(rhs) != true)
|
|
|
236 |
throw new RuntimeException("Failure");
|
|
|
237 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
238 |
throw new RuntimeException("Failure");
|
|
|
239 |
|
|
|
240 |
lhs = new JavaTestHelper();
|
|
|
241 |
rhs = new JavaTestHelper();
|
|
|
242 |
lhs.opt_int = 1;
|
|
|
243 |
rhs.opt_int = 2;
|
|
|
244 |
// this_present = False
|
|
|
245 |
// that_present = False
|
|
|
246 |
if (lhs.equals(rhs) != true)
|
|
|
247 |
throw new RuntimeException("Failure");
|
|
|
248 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
249 |
throw new RuntimeException("Failure");
|
|
|
250 |
|
|
|
251 |
lhs = new JavaTestHelper();
|
|
|
252 |
rhs = new JavaTestHelper();
|
|
|
253 |
lhs.opt_int = 1;
|
|
|
254 |
rhs.opt_int = 1;
|
|
|
255 |
rhs.setOpt_intIsSet(true);
|
|
|
256 |
// this_present = False
|
|
|
257 |
// that_present = True
|
|
|
258 |
if (lhs.equals(rhs) != false)
|
|
|
259 |
throw new RuntimeException("Failure");
|
|
|
260 |
|
|
|
261 |
lhs = new JavaTestHelper();
|
|
|
262 |
rhs = new JavaTestHelper();
|
|
|
263 |
lhs.opt_int = 1;
|
|
|
264 |
rhs.opt_int = 2;
|
|
|
265 |
rhs.setOpt_intIsSet(true);
|
|
|
266 |
// this_present = False
|
|
|
267 |
// that_present = True
|
|
|
268 |
if (lhs.equals(rhs) != false)
|
|
|
269 |
throw new RuntimeException("Failure");
|
|
|
270 |
|
|
|
271 |
lhs = new JavaTestHelper();
|
|
|
272 |
rhs = new JavaTestHelper();
|
|
|
273 |
lhs.opt_int = 1;
|
|
|
274 |
rhs.opt_int = 1;
|
|
|
275 |
lhs.setOpt_intIsSet(true);
|
|
|
276 |
// this_present = True
|
|
|
277 |
// that_present = False
|
|
|
278 |
if (lhs.equals(rhs) != false)
|
|
|
279 |
throw new RuntimeException("Failure");
|
|
|
280 |
|
|
|
281 |
lhs = new JavaTestHelper();
|
|
|
282 |
rhs = new JavaTestHelper();
|
|
|
283 |
lhs.opt_int = 1;
|
|
|
284 |
rhs.opt_int = 2;
|
|
|
285 |
lhs.setOpt_intIsSet(true);
|
|
|
286 |
// this_present = True
|
|
|
287 |
// that_present = False
|
|
|
288 |
if (lhs.equals(rhs) != false)
|
|
|
289 |
throw new RuntimeException("Failure");
|
|
|
290 |
|
|
|
291 |
lhs = new JavaTestHelper();
|
|
|
292 |
rhs = new JavaTestHelper();
|
|
|
293 |
lhs.opt_int = 1;
|
|
|
294 |
rhs.opt_int = 1;
|
|
|
295 |
lhs.setOpt_intIsSet(true);
|
|
|
296 |
rhs.setOpt_intIsSet(true);
|
|
|
297 |
// this_present = True
|
|
|
298 |
// that_present = True
|
|
|
299 |
if (lhs.equals(rhs) != true)
|
|
|
300 |
throw new RuntimeException("Failure");
|
|
|
301 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
302 |
throw new RuntimeException("Failure");
|
|
|
303 |
|
|
|
304 |
lhs = new JavaTestHelper();
|
|
|
305 |
rhs = new JavaTestHelper();
|
|
|
306 |
lhs.opt_int = 1;
|
|
|
307 |
rhs.opt_int = 2;
|
|
|
308 |
lhs.setOpt_intIsSet(true);
|
|
|
309 |
rhs.setOpt_intIsSet(true);
|
|
|
310 |
// this_present = True
|
|
|
311 |
// that_present = True
|
|
|
312 |
if (lhs.equals(rhs) != false)
|
|
|
313 |
throw new RuntimeException("Failure");
|
|
|
314 |
|
|
|
315 |
lhs = new JavaTestHelper();
|
|
|
316 |
rhs = new JavaTestHelper();
|
|
|
317 |
lhs.req_obj = "foo";
|
|
|
318 |
rhs.req_obj = "foo";
|
|
|
319 |
lhs.req_obj = null;
|
|
|
320 |
rhs.req_obj = null;
|
|
|
321 |
// this_present = False
|
|
|
322 |
// that_present = False
|
|
|
323 |
if (lhs.equals(rhs) != true)
|
|
|
324 |
throw new RuntimeException("Failure");
|
|
|
325 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
326 |
throw new RuntimeException("Failure");
|
|
|
327 |
|
|
|
328 |
lhs = new JavaTestHelper();
|
|
|
329 |
rhs = new JavaTestHelper();
|
|
|
330 |
lhs.req_obj = "foo";
|
|
|
331 |
rhs.req_obj = "bar";
|
|
|
332 |
lhs.req_obj = null;
|
|
|
333 |
rhs.req_obj = null;
|
|
|
334 |
// this_present = False
|
|
|
335 |
// that_present = False
|
|
|
336 |
if (lhs.equals(rhs) != true)
|
|
|
337 |
throw new RuntimeException("Failure");
|
|
|
338 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
339 |
throw new RuntimeException("Failure");
|
|
|
340 |
|
|
|
341 |
lhs = new JavaTestHelper();
|
|
|
342 |
rhs = new JavaTestHelper();
|
|
|
343 |
lhs.req_obj = "foo";
|
|
|
344 |
rhs.req_obj = "foo";
|
|
|
345 |
lhs.req_obj = null;
|
|
|
346 |
// this_present = False
|
|
|
347 |
// that_present = True
|
|
|
348 |
if (lhs.equals(rhs) != false)
|
|
|
349 |
throw new RuntimeException("Failure");
|
|
|
350 |
|
|
|
351 |
lhs = new JavaTestHelper();
|
|
|
352 |
rhs = new JavaTestHelper();
|
|
|
353 |
lhs.req_obj = "foo";
|
|
|
354 |
rhs.req_obj = "bar";
|
|
|
355 |
lhs.req_obj = null;
|
|
|
356 |
// this_present = False
|
|
|
357 |
// that_present = True
|
|
|
358 |
if (lhs.equals(rhs) != false)
|
|
|
359 |
throw new RuntimeException("Failure");
|
|
|
360 |
|
|
|
361 |
lhs = new JavaTestHelper();
|
|
|
362 |
rhs = new JavaTestHelper();
|
|
|
363 |
lhs.req_obj = "foo";
|
|
|
364 |
rhs.req_obj = "foo";
|
|
|
365 |
rhs.req_obj = null;
|
|
|
366 |
// this_present = True
|
|
|
367 |
// that_present = False
|
|
|
368 |
if (lhs.equals(rhs) != false)
|
|
|
369 |
throw new RuntimeException("Failure");
|
|
|
370 |
|
|
|
371 |
lhs = new JavaTestHelper();
|
|
|
372 |
rhs = new JavaTestHelper();
|
|
|
373 |
lhs.req_obj = "foo";
|
|
|
374 |
rhs.req_obj = "bar";
|
|
|
375 |
rhs.req_obj = null;
|
|
|
376 |
// this_present = True
|
|
|
377 |
// that_present = False
|
|
|
378 |
if (lhs.equals(rhs) != false)
|
|
|
379 |
throw new RuntimeException("Failure");
|
|
|
380 |
|
|
|
381 |
lhs = new JavaTestHelper();
|
|
|
382 |
rhs = new JavaTestHelper();
|
|
|
383 |
lhs.req_obj = "foo";
|
|
|
384 |
rhs.req_obj = "foo";
|
|
|
385 |
// this_present = True
|
|
|
386 |
// that_present = True
|
|
|
387 |
if (lhs.equals(rhs) != true)
|
|
|
388 |
throw new RuntimeException("Failure");
|
|
|
389 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
390 |
throw new RuntimeException("Failure");
|
|
|
391 |
|
|
|
392 |
lhs = new JavaTestHelper();
|
|
|
393 |
rhs = new JavaTestHelper();
|
|
|
394 |
lhs.req_obj = "foo";
|
|
|
395 |
rhs.req_obj = "bar";
|
|
|
396 |
// this_present = True
|
|
|
397 |
// that_present = True
|
|
|
398 |
if (lhs.equals(rhs) != false)
|
|
|
399 |
throw new RuntimeException("Failure");
|
|
|
400 |
|
|
|
401 |
lhs = new JavaTestHelper();
|
|
|
402 |
rhs = new JavaTestHelper();
|
|
|
403 |
lhs.opt_obj = "foo";
|
|
|
404 |
rhs.opt_obj = "foo";
|
|
|
405 |
lhs.opt_obj = null;
|
|
|
406 |
rhs.opt_obj = null;
|
|
|
407 |
// this_present = False
|
|
|
408 |
// that_present = False
|
|
|
409 |
if (lhs.equals(rhs) != true)
|
|
|
410 |
throw new RuntimeException("Failure");
|
|
|
411 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
412 |
throw new RuntimeException("Failure");
|
|
|
413 |
|
|
|
414 |
lhs = new JavaTestHelper();
|
|
|
415 |
rhs = new JavaTestHelper();
|
|
|
416 |
lhs.opt_obj = "foo";
|
|
|
417 |
rhs.opt_obj = "bar";
|
|
|
418 |
lhs.opt_obj = null;
|
|
|
419 |
rhs.opt_obj = null;
|
|
|
420 |
// this_present = False
|
|
|
421 |
// that_present = False
|
|
|
422 |
if (lhs.equals(rhs) != true)
|
|
|
423 |
throw new RuntimeException("Failure");
|
|
|
424 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
425 |
throw new RuntimeException("Failure");
|
|
|
426 |
|
|
|
427 |
lhs = new JavaTestHelper();
|
|
|
428 |
rhs = new JavaTestHelper();
|
|
|
429 |
lhs.opt_obj = "foo";
|
|
|
430 |
rhs.opt_obj = "foo";
|
|
|
431 |
lhs.opt_obj = null;
|
|
|
432 |
// this_present = False
|
|
|
433 |
// that_present = True
|
|
|
434 |
if (lhs.equals(rhs) != false)
|
|
|
435 |
throw new RuntimeException("Failure");
|
|
|
436 |
|
|
|
437 |
lhs = new JavaTestHelper();
|
|
|
438 |
rhs = new JavaTestHelper();
|
|
|
439 |
lhs.opt_obj = "foo";
|
|
|
440 |
rhs.opt_obj = "bar";
|
|
|
441 |
lhs.opt_obj = null;
|
|
|
442 |
// this_present = False
|
|
|
443 |
// that_present = True
|
|
|
444 |
if (lhs.equals(rhs) != false)
|
|
|
445 |
throw new RuntimeException("Failure");
|
|
|
446 |
|
|
|
447 |
lhs = new JavaTestHelper();
|
|
|
448 |
rhs = new JavaTestHelper();
|
|
|
449 |
lhs.opt_obj = "foo";
|
|
|
450 |
rhs.opt_obj = "foo";
|
|
|
451 |
rhs.opt_obj = null;
|
|
|
452 |
// this_present = True
|
|
|
453 |
// that_present = False
|
|
|
454 |
if (lhs.equals(rhs) != false)
|
|
|
455 |
throw new RuntimeException("Failure");
|
|
|
456 |
|
|
|
457 |
lhs = new JavaTestHelper();
|
|
|
458 |
rhs = new JavaTestHelper();
|
|
|
459 |
lhs.opt_obj = "foo";
|
|
|
460 |
rhs.opt_obj = "bar";
|
|
|
461 |
rhs.opt_obj = null;
|
|
|
462 |
// this_present = True
|
|
|
463 |
// that_present = False
|
|
|
464 |
if (lhs.equals(rhs) != false)
|
|
|
465 |
throw new RuntimeException("Failure");
|
|
|
466 |
|
|
|
467 |
lhs = new JavaTestHelper();
|
|
|
468 |
rhs = new JavaTestHelper();
|
|
|
469 |
lhs.opt_obj = "foo";
|
|
|
470 |
rhs.opt_obj = "foo";
|
|
|
471 |
// this_present = True
|
|
|
472 |
// that_present = True
|
|
|
473 |
if (lhs.equals(rhs) != true)
|
|
|
474 |
throw new RuntimeException("Failure");
|
|
|
475 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
476 |
throw new RuntimeException("Failure");
|
|
|
477 |
|
|
|
478 |
lhs = new JavaTestHelper();
|
|
|
479 |
rhs = new JavaTestHelper();
|
|
|
480 |
lhs.opt_obj = "foo";
|
|
|
481 |
rhs.opt_obj = "bar";
|
|
|
482 |
// this_present = True
|
|
|
483 |
// that_present = True
|
|
|
484 |
if (lhs.equals(rhs) != false)
|
|
|
485 |
throw new RuntimeException("Failure");
|
|
|
486 |
|
|
|
487 |
lhs = new JavaTestHelper();
|
|
|
488 |
rhs = new JavaTestHelper();
|
|
|
489 |
lhs.req_bin = new byte[]{1,2};
|
|
|
490 |
rhs.req_bin = new byte[]{1,2};
|
|
|
491 |
lhs.req_bin = null;
|
|
|
492 |
rhs.req_bin = null;
|
|
|
493 |
// this_present = False
|
|
|
494 |
// that_present = False
|
|
|
495 |
if (lhs.equals(rhs) != true)
|
|
|
496 |
throw new RuntimeException("Failure");
|
|
|
497 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
498 |
throw new RuntimeException("Failure");
|
|
|
499 |
|
|
|
500 |
lhs = new JavaTestHelper();
|
|
|
501 |
rhs = new JavaTestHelper();
|
|
|
502 |
lhs.req_bin = new byte[]{1,2};
|
|
|
503 |
rhs.req_bin = new byte[]{3,4};
|
|
|
504 |
lhs.req_bin = null;
|
|
|
505 |
rhs.req_bin = null;
|
|
|
506 |
// this_present = False
|
|
|
507 |
// that_present = False
|
|
|
508 |
if (lhs.equals(rhs) != true)
|
|
|
509 |
throw new RuntimeException("Failure");
|
|
|
510 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
511 |
throw new RuntimeException("Failure");
|
|
|
512 |
|
|
|
513 |
lhs = new JavaTestHelper();
|
|
|
514 |
rhs = new JavaTestHelper();
|
|
|
515 |
lhs.req_bin = new byte[]{1,2};
|
|
|
516 |
rhs.req_bin = new byte[]{1,2};
|
|
|
517 |
lhs.req_bin = null;
|
|
|
518 |
// this_present = False
|
|
|
519 |
// that_present = True
|
|
|
520 |
if (lhs.equals(rhs) != false)
|
|
|
521 |
throw new RuntimeException("Failure");
|
|
|
522 |
|
|
|
523 |
lhs = new JavaTestHelper();
|
|
|
524 |
rhs = new JavaTestHelper();
|
|
|
525 |
lhs.req_bin = new byte[]{1,2};
|
|
|
526 |
rhs.req_bin = new byte[]{3,4};
|
|
|
527 |
lhs.req_bin = null;
|
|
|
528 |
// this_present = False
|
|
|
529 |
// that_present = True
|
|
|
530 |
if (lhs.equals(rhs) != false)
|
|
|
531 |
throw new RuntimeException("Failure");
|
|
|
532 |
|
|
|
533 |
lhs = new JavaTestHelper();
|
|
|
534 |
rhs = new JavaTestHelper();
|
|
|
535 |
lhs.req_bin = new byte[]{1,2};
|
|
|
536 |
rhs.req_bin = new byte[]{1,2};
|
|
|
537 |
rhs.req_bin = null;
|
|
|
538 |
// this_present = True
|
|
|
539 |
// that_present = False
|
|
|
540 |
if (lhs.equals(rhs) != false)
|
|
|
541 |
throw new RuntimeException("Failure");
|
|
|
542 |
|
|
|
543 |
lhs = new JavaTestHelper();
|
|
|
544 |
rhs = new JavaTestHelper();
|
|
|
545 |
lhs.req_bin = new byte[]{1,2};
|
|
|
546 |
rhs.req_bin = new byte[]{3,4};
|
|
|
547 |
rhs.req_bin = null;
|
|
|
548 |
// this_present = True
|
|
|
549 |
// that_present = False
|
|
|
550 |
if (lhs.equals(rhs) != false)
|
|
|
551 |
throw new RuntimeException("Failure");
|
|
|
552 |
|
|
|
553 |
lhs = new JavaTestHelper();
|
|
|
554 |
rhs = new JavaTestHelper();
|
|
|
555 |
lhs.req_bin = new byte[]{1,2};
|
|
|
556 |
rhs.req_bin = new byte[]{1,2};
|
|
|
557 |
// this_present = True
|
|
|
558 |
// that_present = True
|
|
|
559 |
if (lhs.equals(rhs) != true)
|
|
|
560 |
throw new RuntimeException("Failure");
|
|
|
561 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
562 |
throw new RuntimeException("Failure");
|
|
|
563 |
|
|
|
564 |
lhs = new JavaTestHelper();
|
|
|
565 |
rhs = new JavaTestHelper();
|
|
|
566 |
lhs.req_bin = new byte[]{1,2};
|
|
|
567 |
rhs.req_bin = new byte[]{3,4};
|
|
|
568 |
// this_present = True
|
|
|
569 |
// that_present = True
|
|
|
570 |
if (lhs.equals(rhs) != false)
|
|
|
571 |
throw new RuntimeException("Failure");
|
|
|
572 |
|
|
|
573 |
lhs = new JavaTestHelper();
|
|
|
574 |
rhs = new JavaTestHelper();
|
|
|
575 |
lhs.opt_bin = new byte[]{1,2};
|
|
|
576 |
rhs.opt_bin = new byte[]{1,2};
|
|
|
577 |
lhs.opt_bin = null;
|
|
|
578 |
rhs.opt_bin = null;
|
|
|
579 |
// this_present = False
|
|
|
580 |
// that_present = False
|
|
|
581 |
if (lhs.equals(rhs) != true)
|
|
|
582 |
throw new RuntimeException("Failure");
|
|
|
583 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
584 |
throw new RuntimeException("Failure");
|
|
|
585 |
|
|
|
586 |
lhs = new JavaTestHelper();
|
|
|
587 |
rhs = new JavaTestHelper();
|
|
|
588 |
lhs.opt_bin = new byte[]{1,2};
|
|
|
589 |
rhs.opt_bin = new byte[]{3,4};
|
|
|
590 |
lhs.opt_bin = null;
|
|
|
591 |
rhs.opt_bin = null;
|
|
|
592 |
// this_present = False
|
|
|
593 |
// that_present = False
|
|
|
594 |
if (lhs.equals(rhs) != true)
|
|
|
595 |
throw new RuntimeException("Failure");
|
|
|
596 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
597 |
throw new RuntimeException("Failure");
|
|
|
598 |
|
|
|
599 |
lhs = new JavaTestHelper();
|
|
|
600 |
rhs = new JavaTestHelper();
|
|
|
601 |
lhs.opt_bin = new byte[]{1,2};
|
|
|
602 |
rhs.opt_bin = new byte[]{1,2};
|
|
|
603 |
lhs.opt_bin = null;
|
|
|
604 |
// this_present = False
|
|
|
605 |
// that_present = True
|
|
|
606 |
if (lhs.equals(rhs) != false)
|
|
|
607 |
throw new RuntimeException("Failure");
|
|
|
608 |
|
|
|
609 |
lhs = new JavaTestHelper();
|
|
|
610 |
rhs = new JavaTestHelper();
|
|
|
611 |
lhs.opt_bin = new byte[]{1,2};
|
|
|
612 |
rhs.opt_bin = new byte[]{3,4};
|
|
|
613 |
lhs.opt_bin = null;
|
|
|
614 |
// this_present = False
|
|
|
615 |
// that_present = True
|
|
|
616 |
if (lhs.equals(rhs) != false)
|
|
|
617 |
throw new RuntimeException("Failure");
|
|
|
618 |
|
|
|
619 |
lhs = new JavaTestHelper();
|
|
|
620 |
rhs = new JavaTestHelper();
|
|
|
621 |
lhs.opt_bin = new byte[]{1,2};
|
|
|
622 |
rhs.opt_bin = new byte[]{1,2};
|
|
|
623 |
rhs.opt_bin = null;
|
|
|
624 |
// this_present = True
|
|
|
625 |
// that_present = False
|
|
|
626 |
if (lhs.equals(rhs) != false)
|
|
|
627 |
throw new RuntimeException("Failure");
|
|
|
628 |
|
|
|
629 |
lhs = new JavaTestHelper();
|
|
|
630 |
rhs = new JavaTestHelper();
|
|
|
631 |
lhs.opt_bin = new byte[]{1,2};
|
|
|
632 |
rhs.opt_bin = new byte[]{3,4};
|
|
|
633 |
rhs.opt_bin = null;
|
|
|
634 |
// this_present = True
|
|
|
635 |
// that_present = False
|
|
|
636 |
if (lhs.equals(rhs) != false)
|
|
|
637 |
throw new RuntimeException("Failure");
|
|
|
638 |
|
|
|
639 |
lhs = new JavaTestHelper();
|
|
|
640 |
rhs = new JavaTestHelper();
|
|
|
641 |
lhs.opt_bin = new byte[]{1,2};
|
|
|
642 |
rhs.opt_bin = new byte[]{1,2};
|
|
|
643 |
// this_present = True
|
|
|
644 |
// that_present = True
|
|
|
645 |
if (lhs.equals(rhs) != true)
|
|
|
646 |
throw new RuntimeException("Failure");
|
|
|
647 |
if (lhs.hashCode() != rhs.hashCode())
|
|
|
648 |
throw new RuntimeException("Failure");
|
|
|
649 |
|
|
|
650 |
lhs = new JavaTestHelper();
|
|
|
651 |
rhs = new JavaTestHelper();
|
|
|
652 |
lhs.opt_bin = new byte[]{1,2};
|
|
|
653 |
rhs.opt_bin = new byte[]{3,4};
|
|
|
654 |
// this_present = True
|
|
|
655 |
// that_present = True
|
|
|
656 |
if (lhs.equals(rhs) != false)
|
|
|
657 |
throw new RuntimeException("Failure");
|
|
|
658 |
|
|
|
659 |
}
|
|
|
660 |
}
|
|
|
661 |
|