~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/ic/test/java_client_erl_server_SUITE_data/JavaClient.java

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * %CopyrightBegin%
 
3
 * 
 
4
 * Copyright Ericsson AB 2003-2011. All Rights Reserved.
 
5
 * 
 
6
 * The contents of this file are subject to the Erlang Public License,
 
7
 * Version 1.1, (the "License"); you may not use this file except in
 
8
 * compliance with the License. You should have received a copy of the
 
9
 * Erlang Public License along with this software. If not, it can be
 
10
 * retrieved online at http://www.erlang.org/.
 
11
 * 
 
12
 * Software distributed under the License is distributed on an "AS IS"
 
13
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
14
 * the License for the specific language governing rights and limitations
 
15
 * under the License.
 
16
 * 
 
17
 * %CopyrightEnd%
 
18
 *
 
19
 */
 
20
public class JavaClient {
 
21
 
 
22
    public static void main(String[] argv) 
 
23
    {
 
24
        System.out.println("Hello World!");
 
25
        if (argv.length < 4) {
 
26
            System.out.println("Too few arguments!");
 
27
            System.exit(1);
 
28
        }
 
29
        //      for (int j = 0; j < argv.length; j++)
 
30
        //        System.out.println(argv[j]);
 
31
        try {
 
32
            if (argv[3].equals("marshal_ll")) {
 
33
                System.out.println("marshal_ll");
 
34
                marshal_ll(argv[0], argv[1], argv[2], argv[3]);
 
35
            } 
 
36
            else if (argv[3].equals("marshal_ull")) {
 
37
                marshal_ull(argv[0], argv[1], argv[2], argv[3]);
 
38
            } 
 
39
            else if (argv[3].equals("marshal_l")) {
 
40
                marshal_l(argv[0], argv[1], argv[2], argv[3]);
 
41
            } 
 
42
            else if (argv[3].equals("marshal_ul")) {
 
43
                marshal_ul(argv[0], argv[1], argv[2], argv[3]);
 
44
            } 
 
45
            else if (argv[3].equals("marshal_s")) {
 
46
                marshal_s(argv[0], argv[1], argv[2], argv[3]);
 
47
            } 
 
48
            else if (argv[3].equals("marshal_us")) {
 
49
                marshal_us(argv[0], argv[1], argv[2], argv[3]);
 
50
            } 
 
51
            else if (argv[3].equals("marshal_c")) {
 
52
                marshal_c(argv[0], argv[1], argv[2], argv[3]);
 
53
            } 
 
54
            else if (argv[3].equals("marshal_wc")) {
 
55
                marshal_wc(argv[0], argv[1], argv[2], argv[3]);
 
56
            } 
 
57
            else if (argv[3].equals("marshal_str")) {
 
58
                marshal_str(argv[0], argv[1], argv[2], argv[3]);
 
59
            } 
 
60
            else if (argv[3].equals("marshal_any_3")) {
 
61
                marshal_any_3(argv[0], argv[1], argv[2], argv[3]);
 
62
            } 
 
63
            else if (argv[3].equals("marshal_any_2")) {
 
64
                marshal_any_2(argv[0], argv[1], argv[2], argv[3]);
 
65
            } 
 
66
            else {
 
67
                System.out.println("Unknown test: "+argv[3]);
 
68
                System.exit(2);
 
69
            }
 
70
        } catch (java.lang.Exception e) {
 
71
            System.out.println("Exception!: "+e);
 
72
            System.exit(3);
 
73
        }
 
74
        System.exit(0);
 
75
    }
 
76
 
 
77
 
 
78
 
 
79
    static void marshal_ll(String selfNode, String peerNode,
 
80
                           String cookie, String serverName)
 
81
        throws java.lang.Exception
 
82
    {
 
83
        m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName);
 
84
        // Just warming up..
 
85
        System.out.println("Just warming up.."+i);
 
86
        verify_ll(i, 3, 2, 1);
 
87
        verify_ll(i, 5, 4, 3);
 
88
        verify_ll(i, -128, 0, 1);
 
89
        // The small integer border
 
90
        verify_ll(i, 255, 0, 1);
 
91
        verify_ll(i, 256, 0, 1);
 
92
        // The integer border
 
93
        verify_ll(i, (1L<<26)-1L, 0L, 1);
 
94
        verify_ll(i, 1L<<26, 0L, 1);
 
95
        verify_ll(i, -(1L<<26), 0L, 1);
 
96
        verify_ll(i, (1L<<27)-1L, 0L, 1);
 
97
        verify_ll(i, 1L<<27, 0L, 1);
 
98
        verify_ll(i, -(1L<<27), 0L, 1);
 
99
        // Bignum byte borders
 
100
        verify_ll(i, (1L<<32)-1L, 0L, 1);
 
101
        verify_ll(i, 1L<<32, 0L, 1);
 
102
        verify_ll(i, -(1L<<32)+1L, 0L, 1);
 
103
        verify_ll(i, -(1L<<32), 0L, 1);
 
104
        verify_ll(i, (1L<<40)-1L, 0L, 1);
 
105
        verify_ll(i, 1L<<40, 0L, 1);
 
106
        verify_ll(i, -(1L<<40)+1L, 0L, 1);
 
107
        verify_ll(i, -(1L<<40), 0L, 1);
 
108
        verify_ll(i, (1L<<48)-1L, 0L, 1);
 
109
        verify_ll(i, 1L<<48, 0L, 1);
 
110
        verify_ll(i, -(1L<<48)+1L, 0L, 1);
 
111
        verify_ll(i, -(1L<<48), 0L, 1);
 
112
        // Java long border
 
113
        verify_ll(i, java.lang.Long.MAX_VALUE, 0L, 1);
 
114
        verify_ll(i, java.lang.Long.MIN_VALUE, 0L, 1);
 
115
        verify_ll(i, -1L, 0L, 1);
 
116
        // Impossible decodes
 
117
        verify_ll_bad(i, java.lang.Long.MAX_VALUE, -1L, 1);
 
118
        verify_ll_bad(i, java.lang.Long.MIN_VALUE, 1L, 1);
 
119
        verify_ll_bad(i, java.lang.Long.MIN_VALUE, 0L, -1);
 
120
        verify_ll_bad(i, java.lang.Long.MAX_VALUE, -1L, 2);
 
121
        verify_ll_bad(i, java.lang.Long.MIN_VALUE, 0L, 2);
 
122
    }
 
123
 
 
124
    static void marshal_ull(String selfNode, String peerNode,
 
125
                            String cookie, String serverName)
 
126
        throws java.lang.Exception
 
127
    {
 
128
        m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName);
 
129
        // Just warming up..
 
130
        verify_ull(i, 3, 2, 1);
 
131
        verify_ull(i, 5, 4, 3);
 
132
        // The small integer border
 
133
        verify_ull(i, 255, 0, 1);
 
134
        verify_ull(i, 256, 0, 1);
 
135
        // The integer border
 
136
        verify_ull(i, (1L<<26)-1L, 0L, 1);
 
137
        verify_ull(i, 1L<<26, 0L, 1);
 
138
        verify_ull(i, (1L<<27)-1L, 0L, 1);
 
139
        verify_ull(i, 1L<<27, 0L, 1);
 
140
        // Bignum byte borders
 
141
        verify_ull(i, (1L<<32)-1L, 0L, 1);
 
142
        verify_ull(i, 1L<<32, 0L, 1);
 
143
        verify_ull(i, (1L<<40)-1L, 0L, 1);
 
144
        verify_ull(i, 1L<<40, 0L, 1);
 
145
        verify_ull(i, (1L<<48)-1L, 0L, 1);
 
146
        verify_ull(i, 1L<<48, 0L, 1);
 
147
        // Java long border
 
148
        verify_ull(i, java.lang.Long.MAX_VALUE, 0L, 1);
 
149
        verify_ull(i, java.lang.Long.MIN_VALUE, 0L, 1);
 
150
        verify_ull(i, -1L, 0L, 1);
 
151
        verify_ull(i, java.lang.Long.MAX_VALUE, 
 
152
                   java.lang.Long.MIN_VALUE, 1);
 
153
        // Impossible decodes
 
154
        verify_ull_bad(i, -1L, -1L, 1);
 
155
        verify_ull_bad(i, java.lang.Long.MAX_VALUE, -1L, 2);
 
156
    }
 
157
 
 
158
    static void marshal_l(String selfNode, String peerNode,
 
159
                          String cookie, String serverName)
 
160
        throws java.lang.Exception
 
161
    {
 
162
        m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName);
 
163
        // Just warming up..
 
164
        verify_l(i, 3, 2, 1);
 
165
        verify_l(i, 5, 4, 3);
 
166
        verify_l(i, -128, 0, 1);
 
167
        // The small integer border
 
168
        verify_l(i, 255, 0, 1);
 
169
        verify_l(i, 256, 0, 1);
 
170
        // The integer border
 
171
        verify_l(i, (1<<26)-1, 0, 1);
 
172
        verify_l(i, 1<<26, 0, 1);
 
173
        verify_l(i, -(1<<26), 0, 1);
 
174
        verify_l(i, (1<<27)-1, 0, 1);
 
175
        verify_l(i, 1<<27, 0, 1);
 
176
        verify_l(i, -(1<<27), 0, 1);
 
177
        // Java int border
 
178
        verify_l(i, java.lang.Integer.MAX_VALUE, 0, 1);
 
179
        verify_l(i, java.lang.Integer.MIN_VALUE, 0, 1);
 
180
        // Impossible decodes
 
181
        verify_l_bad(i, java.lang.Integer.MAX_VALUE, -1, 1);
 
182
        verify_l_bad(i, java.lang.Integer.MIN_VALUE, 1, 1);
 
183
        verify_l_bad(i, java.lang.Integer.MIN_VALUE, 0, -1);
 
184
    }
 
185
 
 
186
    static void marshal_ul(String selfNode, String peerNode,
 
187
                           String cookie, String serverName)
 
188
        throws java.lang.Exception
 
189
    {
 
190
        m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName);
 
191
        // Just warming up..
 
192
        verify_ul(i, 3, 2, 1);
 
193
        verify_ul(i, 5, 4, 3);
 
194
        // The small integer border
 
195
        verify_ul(i, 255, 0, 1);
 
196
        verify_ul(i, 256, 0, 1);
 
197
        // The integer border
 
198
        verify_ul(i, (1<<26)-1, 0, 1);
 
199
        verify_ul(i, 1<<26, 0, 1);
 
200
        verify_ul(i, (1<<27)-1, 0, 1);
 
201
        verify_ul(i, 1<<27, 0, 1);
 
202
        // Java int border
 
203
        verify_ul(i, java.lang.Integer.MAX_VALUE, 0, 1);
 
204
        verify_ul(i, java.lang.Integer.MIN_VALUE, 0, 1);
 
205
        verify_ul(i, -1, 0, 1);
 
206
        verify_ul(i, java.lang.Integer.MAX_VALUE, 
 
207
                  java.lang.Integer.MIN_VALUE, 1);
 
208
        // Impossible decodes
 
209
        verify_ul_bad(i, -1, -1, 1);
 
210
    }
 
211
 
 
212
    static void marshal_s(String selfNode, String peerNode,
 
213
                          String cookie, String serverName)
 
214
        throws java.lang.Exception
 
215
    {
 
216
        m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName);
 
217
        // Just warming up..
 
218
        verify_s(i, 3, 2, 1);
 
219
        verify_s(i, 5, 4, 3);
 
220
        verify_s(i, -128, 0, 1);
 
221
        // The small integer border
 
222
        verify_s(i, 255, 0, 1);
 
223
        verify_s(i, 256, 0, 1);
 
224
        // Java short border
 
225
        verify_s(i, java.lang.Short.MAX_VALUE, 0, 1);
 
226
        verify_s(i, java.lang.Short.MIN_VALUE, 0, 1);
 
227
        // Impossible decodes
 
228
        verify_s_bad(i, java.lang.Short.MAX_VALUE, -1, 1);
 
229
        verify_s_bad(i, java.lang.Short.MIN_VALUE, 1, 1);
 
230
        verify_s_bad(i, java.lang.Short.MIN_VALUE, 0, -1);
 
231
    }
 
232
 
 
233
    static void marshal_us(String selfNode, String peerNode,
 
234
                           String cookie, String serverName)
 
235
        throws java.lang.Exception
 
236
    {
 
237
        m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName);
 
238
        // Just warming up..
 
239
        verify_us(i, 3, 2, 1);
 
240
        verify_us(i, 5, 4, 3);
 
241
        // The small integer border
 
242
        verify_us(i, 255, 0, 1);
 
243
        verify_us(i, 256, 0, 1);
 
244
        // Java short border
 
245
        verify_us(i, java.lang.Short.MAX_VALUE, 0, 1);
 
246
        verify_us(i, java.lang.Short.MIN_VALUE, 0, 1);
 
247
        verify_us(i, -1, 0, 1);
 
248
        verify_us(i, java.lang.Short.MAX_VALUE, 
 
249
                  java.lang.Short.MIN_VALUE, 1);
 
250
        // Impossible decodes
 
251
        verify_us_bad(i, -1, -1, 1);
 
252
    }
 
253
 
 
254
    static void marshal_c(String selfNode, String peerNode,
 
255
                           String cookie, String serverName)
 
256
        throws java.lang.Exception
 
257
    {
 
258
        m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName);
 
259
        // Just warming up..
 
260
        verify_c(i, '\3', '\2', 1);
 
261
        verify_c(i, '\5', '\4', 3);
 
262
        // The small integer border
 
263
        verify_c(i, '\u00FF', '\0', 1);
 
264
        verify_c(i, '\u0100', '\0', 1);
 
265
        // Java char border
 
266
        verify_c(i, java.lang.Character.MAX_VALUE, '\0', 1);
 
267
        verify_c(i, java.lang.Character.MIN_VALUE, '\0', 1);
 
268
        verify_c(i, java.lang.Character.MAX_VALUE, 
 
269
                  java.lang.Character.MIN_VALUE, 1);
 
270
        // Impossible decodes
 
271
        verify_c_bad(i, '\u8000', '\0', 2);
 
272
    }
 
273
 
 
274
    static void marshal_wc(String selfNode, String peerNode,
 
275
                           String cookie, String serverName)
 
276
        throws java.lang.Exception
 
277
    {
 
278
        m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName);
 
279
        // Just warming up..
 
280
        verify_wc(i, '\3', '\2', 1);
 
281
        verify_wc(i, '\5', '\4', 3);
 
282
        // The small integer border
 
283
        verify_wc(i, '\u00FF', '\0', 1);
 
284
        verify_wc(i, '\u0100', '\0', 1);
 
285
        // Java char border
 
286
        verify_wc(i, java.lang.Character.MAX_VALUE, '\0', 1);
 
287
        verify_wc(i, java.lang.Character.MIN_VALUE, '\0', 1);
 
288
        verify_wc(i, java.lang.Character.MAX_VALUE, 
 
289
                  java.lang.Character.MIN_VALUE, 1);
 
290
        // Impossible decodes
 
291
        verify_c_bad(i, '\u8000', '\0', 2);
 
292
    }
 
293
 
 
294
    static void marshal_str(String selfNode, String peerNode,
 
295
                            String cookie, String serverName)
 
296
        throws java.lang.Exception
 
297
    {
 
298
        m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName);
 
299
        // Just warming up..
 
300
        verify_str(i, 100, 100);
 
301
        verify_str(i, 100, 1);
 
302
        // Erlang string border
 
303
        verify_str(i, 65535, 1);
 
304
        verify_str(i, 2, 65535);
 
305
        // Erlang string border out
 
306
        verify_str(i, 65536, 1);
 
307
        verify_str(i, 65536, 65536);
 
308
    }
 
309
 
 
310
    static void marshal_any_3(String selfNode, String peerNode,
 
311
                              String cookie, String serverName)
 
312
        throws java.lang.Exception
 
313
    {
 
314
        m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName);
 
315
        com.ericsson.otp.ic.Any x = new com.ericsson.otp.ic.Any();
 
316
        com.ericsson.otp.ic.Any y = new com.ericsson.otp.ic.Any();
 
317
        com.ericsson.otp.ic.Any z = new com.ericsson.otp.ic.Any();
 
318
        
 
319
        x.insert_longlong(java.lang.Long.MAX_VALUE);
 
320
        y.insert_longlong(1L);
 
321
        z.insert_longlong(java.lang.Long.MAX_VALUE-1L);
 
322
        System.out.println("verify_any_3 longlong max");
 
323
        verify_any_3(i, x, y, 1, z);
 
324
        
 
325
        x.insert_longlong(java.lang.Long.MIN_VALUE);
 
326
        y.insert_longlong(-1L);
 
327
        z.insert_longlong(java.lang.Long.MIN_VALUE+1L);
 
328
        System.out.println("verify_any_3 longlong min");
 
329
        verify_any_3(i, x, y, 1, z);
 
330
        
 
331
        x.insert_ulonglong(-1L);
 
332
        y.insert_longlong(1L);
 
333
        z.insert_ulonglong(-2L);
 
334
        System.out.println("verify_any_3 ulonglong max");
 
335
        verify_any_3(i, x, y, 1, z);
 
336
        
 
337
        x.insert_ulonglong(0L);
 
338
        y.insert_longlong(-1L);
 
339
        z.insert_ulonglong(1L);
 
340
        System.out.println("verify_any_3 ulonglong min");
 
341
        verify_any_3(i, x, y, 1, z);
 
342
        
 
343
        x.insert_long(java.lang.Integer.MAX_VALUE);
 
344
        y.insert_long(1);
 
345
        z.insert_long(java.lang.Integer.MAX_VALUE-1);
 
346
        System.out.println("verify_any_3 long max");
 
347
        verify_any_3(i, x, y, 1, z);
 
348
        
 
349
        x.insert_long(java.lang.Integer.MIN_VALUE);
 
350
        y.insert_long(-1);
 
351
        z.insert_long(java.lang.Integer.MIN_VALUE+1);
 
352
        System.out.println("verify_any_3 long min");
 
353
        verify_any_3(i, x, y, 1, z);
 
354
        
 
355
        x.insert_ulong(-1);
 
356
        y.insert_long(1);
 
357
        z.insert_ulong(-2);
 
358
        System.out.println("verify_any_3 ulong max");
 
359
        verify_any_3(i, x, y, 1, z);
 
360
        
 
361
        x.insert_ulong(0);
 
362
        y.insert_long(-1);
 
363
        z.insert_ulong(1);
 
364
        System.out.println("verify_any_3 ulong min");
 
365
        verify_any_3(i, x, y, 1, z);
 
366
        
 
367
        x.insert_short(java.lang.Short.MAX_VALUE);
 
368
        y.insert_short((short)1);
 
369
        z.insert_short((short)(java.lang.Short.MAX_VALUE-1));
 
370
        System.out.println("verify_any_3 short max");
 
371
        verify_any_3(i, x, y, 1, z);
 
372
        
 
373
        x.insert_short(java.lang.Short.MIN_VALUE);
 
374
        y.insert_short((short)-1);
 
375
        z.insert_short((short)(java.lang.Short.MIN_VALUE+1));
 
376
        System.out.println("verify_any_3 short min");
 
377
        verify_any_3(i, x, y, 1, z);
 
378
        
 
379
        x.insert_ushort((short)-1);
 
380
        y.insert_short((short)1);
 
381
        z.insert_ushort((short)-2);
 
382
        System.out.println("verify_any_3 ushort max");
 
383
        verify_any_3(i, x, y, 1, z);
 
384
        
 
385
        x.insert_ushort((short)0);
 
386
        y.insert_short((short)-1);
 
387
        z.insert_ushort((short)1);
 
388
        System.out.println("verify_any_3 ushort min");
 
389
        verify_any_3(i, x, y, 1, z);
 
390
        
 
391
        x.insert_char('\377');
 
392
        y.insert_char('\1');
 
393
        z.insert_char('\376');
 
394
        System.out.println("verify_any_3 char max");
 
395
        verify_any_3(i, x, y, 1, z);
 
396
        
 
397
        x.insert_wchar('\uFFFF');
 
398
        y.insert_wchar('\u0001');
 
399
        z.insert_wchar('\uFFFE');
 
400
        System.out.println("verify_any_3 char max");
 
401
        verify_any_3(i, x, y, 1, z);
 
402
    }
 
403
 
 
404
    static void marshal_any_2(String selfNode, String peerNode,
 
405
                              String cookie, String serverName)
 
406
        throws java.lang.Exception
 
407
    {
 
408
        m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName);
 
409
        m.s s = new m.s();
 
410
        com.ericsson.otp.ic.Any a = new com.ericsson.otp.ic.Any();
 
411
        //
 
412
        s.ull_x = -1L;
 
413
        s.ll_x = java.lang.Long.MAX_VALUE;
 
414
        s.ll_y = 1L;
 
415
        s.ull_z = -2L;
 
416
        s.ll_z = java.lang.Long.MAX_VALUE-1L;
 
417
        //
 
418
        s.ul_x = -1;
 
419
        s.l_x = java.lang.Integer.MAX_VALUE;
 
420
        s.l_y = 1;
 
421
        s.ul_z = -2;
 
422
        s.l_z = java.lang.Integer.MAX_VALUE-1;
 
423
        //
 
424
        s.us_x = (short)-1;
 
425
        s.s_x = java.lang.Short.MAX_VALUE;
 
426
        s.s_y = (short)1;
 
427
        s.us_z = (short)-2;
 
428
        s.s_z = (short)(java.lang.Short.MAX_VALUE-1);
 
429
        //
 
430
        s.c_x = '\377';
 
431
        s.c_y = '\1';
 
432
        s.c_z = '\376';
 
433
        s.wc_x = '\uFFFF';
 
434
        s.wc_y = '\u0001';
 
435
        s.wc_z = '\uFFFE';
 
436
        m.sHelper.insert(a, s);
 
437
        verify_any_2(i, a, 1);
 
438
        
 
439
        s.ull_x = 0L;
 
440
        s.ll_x = java.lang.Long.MIN_VALUE;
 
441
        s.ll_y = -1L;
 
442
        s.ull_z = 1L;
 
443
        s.ll_z = java.lang.Long.MIN_VALUE+1L;
 
444
        //
 
445
        s.ul_x = 0;
 
446
        s.l_x = java.lang.Integer.MIN_VALUE;
 
447
        s.l_y = -1;
 
448
        s.ul_z = 1;
 
449
        s.l_z = java.lang.Integer.MIN_VALUE+1;
 
450
        //
 
451
        s.us_x = (short)0;
 
452
        s.s_x = java.lang.Short.MIN_VALUE;
 
453
        s.s_y = (short)-1;
 
454
        s.us_z = (short)1;
 
455
        s.s_z = (short)(java.lang.Short.MIN_VALUE+1);
 
456
        //
 
457
        s.c_x = '\0';
 
458
        s.c_y = '\0';
 
459
        s.c_z = '\0';
 
460
        s.wc_x = '\u0000';
 
461
        s.wc_y = '\u0000';
 
462
        s.wc_z = '\u0000';
 
463
        m.sHelper.insert(a, s);
 
464
        verify_any_2(i, a, 1);
 
465
    }
 
466
 
 
467
 
 
468
    static void verify_ll(m._iStub i, long x, long y, int b) 
 
469
        throws java.lang.Exception 
 
470
    {
 
471
        m.s a = new m.s();
 
472
        System.out.println("verify_ll "+a);
 
473
        a.ll_x = x;
 
474
        a.ll_y = y;
 
475
        long expected = (x - y)*(short)b;
 
476
        long result = i.marshal_ll(a, (short)b);
 
477
        if (result == expected) {
 
478
            System.out.println("verify_ll("+x+", "+y+", "+b+") => "
 
479
                               +result);
 
480
        } else {
 
481
            System.out.println("verify_ll("+x+", "+y+", "+b+") => "
 
482
                               +result+" != "+expected);
 
483
            System.exit(4);
 
484
        }
 
485
    }
 
486
 
 
487
    static void verify_ull(m._iStub i, long x, long y, int b) 
 
488
        throws java.lang.Exception 
 
489
    {
 
490
        m.s a = new m.s();
 
491
        a.ull_x = x;
 
492
        a.ll_y = y;
 
493
        long expected = (x - y)*(short)b;
 
494
        long result = i.marshal_ull(a, (short)b);
 
495
        if (result == expected) {
 
496
            System.out.println("verify_ull("+x+", "+y+", "+b+") => "
 
497
                               +result);
 
498
        } else {
 
499
            System.out.println("verify_ull("+x+", "+y+", "+b+") => "
 
500
                               +result+" != "+expected);
 
501
            System.exit(4);
 
502
        }
 
503
    }
 
504
 
 
505
    static void verify_l(m._iStub i, int x, int y, int b) 
 
506
        throws java.lang.Exception 
 
507
    {
 
508
        m.s a = new m.s();
 
509
        a.l_x = x;
 
510
        a.l_y = y;
 
511
        int expected = (x - y)*(short)b;
 
512
        int result = i.marshal_l(a, (short)b);
 
513
        if (result == expected) {
 
514
            System.out.println("verify_l("+x+", "+y+", "+b+") => "
 
515
                               +result);
 
516
        } else {
 
517
            System.out.println("verify_l("+x+", "+y+", "+b+") => "
 
518
                               +result+" != "+expected);
 
519
            System.exit(4);
 
520
        }
 
521
    }
 
522
 
 
523
    static void verify_ul(m._iStub i, int x, int y, int b) 
 
524
        throws java.lang.Exception 
 
525
    {
 
526
        m.s a = new m.s();
 
527
        a.ul_x = x;
 
528
        a.l_y = y;
 
529
        int expected = (x - y)*(short)b;
 
530
        int result = i.marshal_ul(a, (short)b);
 
531
        if (result == expected) {
 
532
            System.out.println("verify_ul("+x+", "+y+", "+b+") => "
 
533
                               +result);
 
534
        } else {
 
535
            System.out.println("verify_ul("+x+", "+y+", "+b+") => "
 
536
                               +result+" != "+expected);
 
537
            System.exit(4);
 
538
        }
 
539
    }
 
540
 
 
541
    static void verify_s(m._iStub i, int x, int y, int b) 
 
542
        throws java.lang.Exception 
 
543
    {
 
544
        m.s a = new m.s();
 
545
        a.s_x = (short)x;
 
546
        a.s_y = (short)y;
 
547
        short expected = (short)((x - y)*(short)b);
 
548
        short result = i.marshal_s(a, (short)b);
 
549
        if (result == expected) {
 
550
            System.out.println("verify_s("+x+", "+y+", "+b+") => "
 
551
                               +result);
 
552
        } else {
 
553
            System.out.println("verify_s("+x+", "+y+", "+b+") => "
 
554
                               +result+" != "+expected);
 
555
            System.exit(4);
 
556
        }
 
557
    }
 
558
 
 
559
    static void verify_us(m._iStub i, int x, int y, int b) 
 
560
        throws java.lang.Exception 
 
561
    {
 
562
        m.s a = new m.s();
 
563
        a.us_x = (short)x;
 
564
        a.s_y = (short)y;
 
565
        short expected = (short)((x - y)*(short)b);
 
566
        short result = i.marshal_us(a, (short)b);
 
567
        if (result == expected) {
 
568
            System.out.println("verify_us("+x+", "+y+", "+b+") => "
 
569
                               +result);
 
570
        } else {
 
571
            System.out.println("verify_us("+x+", "+y+", "+b+") => "
 
572
                               +result+" != "+expected);
 
573
            System.exit(4);
 
574
        }
 
575
    }
 
576
 
 
577
    static void verify_c(m._iStub i, char x, char y, int b) 
 
578
        throws java.lang.Exception 
 
579
    {
 
580
        m.s a = new m.s();
 
581
        a.c_x = x;
 
582
        a.c_y = y;
 
583
        char expected = (char)(((int)x - (int)y)*(short)b);
 
584
        char result = i.marshal_c(a, (short)b);
 
585
        if (result == expected) {
 
586
            System.out.println("verify_c("+x+", "+y+", "+b+") => "
 
587
                               +result);
 
588
        } else {
 
589
            System.out.println("verify_c("+x+", "+y+", "+b+") => "
 
590
                               +result+" != "+expected);
 
591
            System.exit(4);
 
592
        }
 
593
    }
 
594
 
 
595
    static void verify_wc(m._iStub i, char x, char y, int b) 
 
596
        throws java.lang.Exception 
 
597
    {
 
598
        m.s a = new m.s();
 
599
        a.wc_x = x;
 
600
        a.wc_y = y;
 
601
        char expected = (char)(((int)x - (int)y)*(short)b);
 
602
        char result = i.marshal_wc(a, (short)b);
 
603
        if (result == expected) {
 
604
            System.out.println("verify_wc("+x+", "+y+", "+b+") => "
 
605
                               +result);
 
606
        } else {
 
607
            System.out.println("verify_wc("+x+", "+y+", "+b+") => "
 
608
                               +result+" != "+expected);
 
609
            System.exit(4);
 
610
        }
 
611
    }
 
612
 
 
613
    static void verify_str(m._iStub i, int a_len, int b_len) 
 
614
        throws java.lang.Exception 
 
615
    {
 
616
        String a = mk_str(a_len);
 
617
        String b = mk_str(b_len);
 
618
        String expected = a + b;
 
619
        String result = i.strcat(a, b);
 
620
        if (result.equals(expected)) {
 
621
            System.out.println("verify_str(\""+a+"\", \""+b+"\") => \""
 
622
                               +result+"\"");
 
623
        } else {
 
624
            System.out.println("verify_str(\""+a+"\", \""+b+"\") => \""
 
625
                               +result+"\" != \""+expected.length()+"\"");
 
626
            System.exit(4);
 
627
        }
 
628
    }
 
629
 
 
630
    static String mk_str(int len) 
 
631
        throws StringIndexOutOfBoundsException
 
632
    {
 
633
        StringBuffer s = new StringBuffer();
 
634
        // 17 characters is prime relative all bases of two - on purpose
 
635
        do s.append("qwertyuiopasdfghj"); while (s.length() < len);
 
636
        return s.substring(0, len);
 
637
    }
 
638
 
 
639
    static void verify_any_3(m._iStub i, 
 
640
                           com.ericsson.otp.ic.Any x, 
 
641
                           com.ericsson.otp.ic.Any y, 
 
642
                           int b, 
 
643
                           com.ericsson.otp.ic.Any expected) 
 
644
        throws java.lang.Exception 
 
645
    {
 
646
        com.ericsson.otp.ic.Any result = i.marshal_any_3(x, y, (short)b);
 
647
        if (! expected.equal(result)) {
 
648
            System.exit(4);
 
649
        }
 
650
    }
 
651
 
 
652
    static void verify_any_2(m._iStub i, com.ericsson.otp.ic.Any a, int b)
 
653
        throws java.lang.Exception 
 
654
    {
 
655
        com.ericsson.otp.ic.Any result = i.marshal_any_2(a, (short)b);
 
656
        if (! a.equal(result)) {
 
657
            System.exit(4);
 
658
        }
 
659
    }
 
660
 
 
661
 
 
662
 
 
663
    static void verify_ll_bad(m._iStub i, long x, long y, int b)
 
664
        throws java.lang.Exception
 
665
    {
 
666
        try {
 
667
            verify_ll(i, x, y, b);
 
668
            System.out.println("Expected exception missing!");
 
669
            System.exit(5);
 
670
        } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) {
 
671
            System.out.println("Expected exception: "+e);
 
672
        }
 
673
    }
 
674
 
 
675
    static void verify_ull_bad(m._iStub i, long x, long y, int b)
 
676
        throws java.lang.Exception
 
677
    {
 
678
        try {
 
679
            verify_ull(i, x, y, b);
 
680
            System.out.println("Expected exception missing!");
 
681
            System.exit(5);
 
682
        } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) {
 
683
            System.out.println("Expected exception: "+e);
 
684
        }
 
685
    }
 
686
 
 
687
    static void verify_l_bad(m._iStub i, int x, int y, int b)
 
688
        throws java.lang.Exception
 
689
    {
 
690
        try {
 
691
            verify_l(i, x, y, b);
 
692
            System.out.println("Expected exception missing!");
 
693
            System.exit(5);
 
694
        } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) {
 
695
            System.out.println("Expected exception: "+e);
 
696
        }
 
697
    }
 
698
 
 
699
    static void verify_ul_bad(m._iStub i, int x, int y, int b)
 
700
        throws java.lang.Exception
 
701
    {
 
702
        try {
 
703
            verify_ul(i, x, y, b);
 
704
            System.out.println("Expected exception missing!");
 
705
            System.exit(5);
 
706
        } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) {
 
707
            System.out.println("Expected exception: "+e);
 
708
        }
 
709
    }
 
710
 
 
711
    static void verify_s_bad(m._iStub i, int x, int y, int b)
 
712
        throws java.lang.Exception
 
713
    {
 
714
        try {
 
715
            verify_s(i, x, y, b);
 
716
            System.out.println("Expected exception missing!");
 
717
            System.exit(5);
 
718
        } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) {
 
719
            System.out.println("Expected exception: "+e);
 
720
        }
 
721
    }
 
722
 
 
723
    static void verify_us_bad(m._iStub i, int x, int y, int b)
 
724
        throws java.lang.Exception
 
725
    {
 
726
        try {
 
727
            verify_us(i, x, y, b);
 
728
            System.out.println("Expected exception missing!");
 
729
            System.exit(5);
 
730
        } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) {
 
731
            System.out.println("Expected exception: "+e);
 
732
        }
 
733
    }
 
734
 
 
735
    static void verify_c_bad(m._iStub i, char x, char y, int b)
 
736
        throws java.lang.Exception
 
737
    {
 
738
        try {
 
739
            verify_c(i, x, y, b);
 
740
            System.out.println("Expected exception missing!");
 
741
            System.exit(5);
 
742
        } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) {
 
743
            System.out.println("Expected exception: "+e);
 
744
        }
 
745
    }
 
746
 
 
747
    static void verify_wc_bad(m._iStub i, char x, char y, int b)
 
748
        throws java.lang.Exception
 
749
    {
 
750
        try {
 
751
            verify_wc(i, x, y, b);
 
752
            System.out.println("Expected exception missing!");
 
753
            System.exit(5);
 
754
        } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) {
 
755
            System.out.println("Expected exception: "+e);
 
756
        }
 
757
    }
 
758
 
 
759
}