blob: 9436865e1b2e9894774bf0353ec037d6d3ba73f7 [file] [log] [blame]
Jens Geyerbd52f1a2014-07-28 01:25:30 +02001/*
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
20package;
21
22import haxe.Int32;
23import haxe.Int64;
Jens Geyer43e195a2014-12-14 00:29:17 +010024import haxe.io.Bytes;
Jens Geyerbd52f1a2014-07-28 01:25:30 +020025import haxe.Timer;
26import haxe.ds.IntMap;
27import haxe.ds.StringMap;
28import haxe.ds.ObjectMap;
29
30import org.apache.thrift.*;
31import org.apache.thrift.helper.*;
32import org.apache.thrift.protocol.*;
33import org.apache.thrift.transport.*;
34import org.apache.thrift.server.*;
35import org.apache.thrift.meta_data.*;
36
37#if cpp
38import cpp.vm.Thread;
39#else
40// no thread support (yet)
41#end
42
43import thrift.test.*; // generated code
44
45
Jens Geyer1d20a372016-03-15 23:04:27 +020046using StringTools;
47
Jens Geyerbd52f1a2014-07-28 01:25:30 +020048class TestResults {
Jens Geyerb5028322014-11-09 02:38:11 +010049 private var successCnt : Int = 0;
50 private var errorCnt : Int = 0;
51 private var failedTests : String = "";
52 private var print_direct : Bool = false;
Jens Geyerbd52f1a2014-07-28 01:25:30 +020053
Jens Geyerb5028322014-11-09 02:38:11 +010054 public static var EXITCODE_SUCCESS = 0x00; // no errors bits set
55 //
56 public static var EXITCODE_FAILBIT_BASETYPES = 0x01;
57 public static var EXITCODE_FAILBIT_STRUCTS = 0x02;
58 public static var EXITCODE_FAILBIT_CONTAINERS = 0x04;
59 public static var EXITCODE_FAILBIT_EXCEPTIONS = 0x08;
60 //
61 public static var EXITCODE_ALL_FAILBITS = 0x0F;
62 //
63 private var testsExecuted : Int = 0;
64 private var testsFailed : Int = 0;
65 private var currentTest : Int = 0;
Jens Geyerbd52f1a2014-07-28 01:25:30 +020066
67
Jens Geyerb5028322014-11-09 02:38:11 +010068 public function new(direct : Bool) {
69 print_direct = direct;
70 }
71
72 public function StartTestGroup( groupBit : Int) : Void {
73 currentTest = groupBit;
74 testsExecuted |= groupBit;
75 }
76
77 public function Expect( expr : Bool, msg : String) : Void {
78 if ( expr) {
79 ++successCnt;
80 } else {
81 ++errorCnt;
82 testsFailed |= currentTest;
83 failedTests += "\n " + msg;
84 if( print_direct) {
85 trace('FAIL: $msg');
86 }
87 }
88 }
89
90 public function CalculateExitCode() : Int {
91 var notExecuted : Int = EXITCODE_ALL_FAILBITS & (~testsExecuted);
92 return testsFailed | notExecuted;
93 }
94
95 public function PrintSummary() : Void {
96 var total = successCnt + errorCnt;
Jens Geyerbbd6fd72015-05-30 19:33:44 +020097 var sp = Math.round((1000 * successCnt) / total) / 10;
98 var ep = Math.round((1000 * errorCnt) / total) / 10;
Jens Geyerb5028322014-11-09 02:38:11 +010099
100 trace('===========================');
101 trace('Tests executed $total');
102 trace('Tests succeeded $successCnt ($sp%)');
103 trace('Tests failed $errorCnt ($ep%)');
104 if ( errorCnt > 0)
105 {
106 trace('===========================');
Jens Geyer1d20a372016-03-15 23:04:27 +0200107 trace('FAILED TESTS: $failedTests');
Jens Geyerb5028322014-11-09 02:38:11 +0100108 }
109 trace('===========================');
110 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200111}
112
113
114class TestClient {
115
Jens Geyerb5028322014-11-09 02:38:11 +0100116 public static function Execute(args : Arguments) : Void
117 {
118 var exitCode = 0xFF;
119 try
120 {
121 var difft = Timer.stamp();
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200122
Jens Geyer1d20a372016-03-15 23:04:27 +0200123 if ( args.numThreads > 1) {
124 #if cpp
125 exitCode = MultiThreadClient(args);
126 #else
127 trace('Threads not supported/implemented for this platform.');
128 exitCode = SingleThreadClient(args);
129 #end
Jens Geyerb5028322014-11-09 02:38:11 +0100130 } else {
Jens Geyer1d20a372016-03-15 23:04:27 +0200131 exitCode = SingleThreadClient(args);
Jens Geyerb5028322014-11-09 02:38:11 +0100132 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200133
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200134 difft = Math.round( 1000 * (Timer.stamp() - difft)) / 1000;
Jens Geyerb5028322014-11-09 02:38:11 +0100135 trace('total test time: $difft seconds');
136 }
137 catch (e : TException)
138 {
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200139 trace('TException: $e');
Jens Geyerb5028322014-11-09 02:38:11 +0100140 exitCode = 0xFF;
141 }
142 catch (e : Dynamic)
143 {
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200144 trace('Exception: $e');
Jens Geyerb5028322014-11-09 02:38:11 +0100145 exitCode = 0xFF;
146 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200147
Jens Geyerb5028322014-11-09 02:38:11 +0100148 #if sys
149 Sys.exit( exitCode);
150 #end
151 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200152
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200153
Jens Geyer1d20a372016-03-15 23:04:27 +0200154 public static function SingleThreadClient(args : Arguments) : Int
155 {
156 var rslt = new TestResults(true);
157 RunClient(args,rslt);
158 rslt.PrintSummary();
159 return rslt.CalculateExitCode();
160 }
161
162
163 #if cpp
164 public static function MultiThreadClient(args : Arguments) : Int
165 {
166 var threads = new List<Thread>();
167 for( test in 0 ... args.numThreads) {
168 threads.add( StartThread( args));
169 }
170 var exitCode : Int = 0;
171 for( thread in threads) {
172 exitCode |= Thread.readMessage(true);
173 }
174 return exitCode;
175 }
176 #end
177
178 #if cpp
Jens Geyerb5028322014-11-09 02:38:11 +0100179 private static function StartThread(args : Arguments) : Thread {
180 var thread = Thread.create(
181 function() : Void {
182 var rslt = new TestResults(false);
183 var main : Thread = Thread.readMessage(true);
184 try
185 {
186 RunClient(args,rslt);
187 }
188 catch (e : TException)
189 {
190 rslt.Expect( false, '$e');
191 trace('$e');
192 }
193 catch (e : Dynamic)
194 {
195 rslt.Expect( false, '$e');
196 trace('$e');
197 }
198 main.sendMessage( rslt.CalculateExitCode());
199 });
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200200
Jens Geyerb5028322014-11-09 02:38:11 +0100201 thread.sendMessage(Thread.current());
202 return thread;
203 }
Jens Geyer1d20a372016-03-15 23:04:27 +0200204 #end
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200205
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200206
Jens Geyerb5028322014-11-09 02:38:11 +0100207 public static function RunClient(args : Arguments, rslt : TestResults)
208 {
209 var transport : TTransport = null;
210 switch (args.transport)
211 {
212 case socket:
213 transport = new TSocket(args.host, args.port);
214 case http:
215 transport = new THttpClient(args.host);
216 default:
217 throw "Unhandled transport";
218 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200219
Jens Geyerb5028322014-11-09 02:38:11 +0100220 // optional: layered transport
221 if ( args.framed) {
222 trace("- framed transport");
223 transport = new TFramedTransport(transport);
224 }
225 if ( args.buffered) {
226 trace("- buffered transport");
Jens Geyerd35f6162014-11-29 19:23:03 +0100227 transport = new TBufferedTransport(transport);
Jens Geyerb5028322014-11-09 02:38:11 +0100228 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200229
Jens Geyerb5028322014-11-09 02:38:11 +0100230 // protocol
231 var protocol : TProtocol = null;
232 switch( args.protocol)
233 {
234 case binary:
235 trace("- binary protocol");
236 protocol = new TBinaryProtocol(transport);
237 case json:
238 trace("- json protocol");
239 protocol = new TJSONProtocol(transport);
Jens Geyer426ab862015-03-02 23:37:15 +0100240 case compact:
241 trace("- compact protocol");
242 protocol = new TCompactProtocol(transport);
Jens Geyerb5028322014-11-09 02:38:11 +0100243 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200244
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200245 // some quick and basic unit tests
Jens Geyerb5028322014-11-09 02:38:11 +0100246 HaxeBasicsTest( args, rslt);
Jens Geyer426ab862015-03-02 23:37:15 +0100247 ModuleUnitTests( args, rslt);
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200248
249 // now run the test code
250 trace('- ${args.numIterations} iterations');
Jens Geyerb5028322014-11-09 02:38:11 +0100251 for( i in 0 ... args.numIterations) {
252 ClientTest( transport, protocol, args, rslt);
253 }
254 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200255
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200256
Jens Geyerb5028322014-11-09 02:38:11 +0100257 public static function HaxeBasicsTest( args : Arguments, rslt : TestResults) : Void
258 {
259 // We need to test a few basic things used in the ClientTest
260 // Anything else beyond this scope should go into /lib/haxe/ instead
Jens Geyer26b36dc2016-05-28 23:22:51 +0200261 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200262
Jens Geyerb5028322014-11-09 02:38:11 +0100263 var map32 = new IntMap<Int32>();
264 var map64 = new Int64Map<Int32>();
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200265
Jens Geyerb5028322014-11-09 02:38:11 +0100266 rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #1");
267 rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #2");
268 rslt.Expect( map32.remove( 4711) == map64.remove( Int64.make(47,11)), "Int64Map<Int32> Test #3");
269 rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #4");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200270
Jens Geyerb5028322014-11-09 02:38:11 +0100271 map32.set( 42, 815);
272 map64.set( Int64.make(0,42), 815);
273 map32.set( -517, 23);
Jens Geyer426ab862015-03-02 23:37:15 +0100274 map64.set( Int64.neg(Int64.make(0,517)), 23);
Jens Geyerb5028322014-11-09 02:38:11 +0100275 map32.set( 0, -123);
276 map64.set( Int64.make(0,0), -123);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200277
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200278 //trace('map32 = $map32');
279 //trace('map64 = $map64');
280
Jens Geyerb5028322014-11-09 02:38:11 +0100281 rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #10");
282 rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #11");
Jens Geyer426ab862015-03-02 23:37:15 +0100283 rslt.Expect( map32.exists( -517) == map64.exists( Int64.neg(Int64.make(0,517))), "Int64Map<Int32> Test #12");
Jens Geyerb5028322014-11-09 02:38:11 +0100284 rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #13");
285 rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #14");
286 rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #15");
Jens Geyer426ab862015-03-02 23:37:15 +0100287 rslt.Expect( map32.get( -517) == map64.get( Int64.neg(Int64.make(0,517))), "Int64Map<Int32> Test #16");
Jens Geyerb5028322014-11-09 02:38:11 +0100288 rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #Int64.make(-5,17)");
289 rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #18");
290 rslt.Expect( map32.remove( 4711) == map64.remove( Int64.make(47,11)), "Int64Map<Int32> Test #19");
Jens Geyer426ab862015-03-02 23:37:15 +0100291 rslt.Expect( map32.remove( -517) == map64.remove( Int64.neg(Int64.make(0,517))), "Int64Map<Int32> Test #20");
Jens Geyerb5028322014-11-09 02:38:11 +0100292 rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #21");
Jens Geyer426ab862015-03-02 23:37:15 +0100293 rslt.Expect( map32.exists( -517) == map64.exists( Int64.neg(Int64.make(0,517))), "Int64Map<Int32> Test #22");
Jens Geyerb5028322014-11-09 02:38:11 +0100294 rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #23");
295 rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #24");
296 rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #25");
Jens Geyer426ab862015-03-02 23:37:15 +0100297 rslt.Expect( map32.get( -517) == map64.get( Int64.neg(Int64.make(0,517))), "Int64Map<Int32> Test #26");
Jens Geyerb5028322014-11-09 02:38:11 +0100298 rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #27");
299 rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #28");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200300
Jens Geyerb5028322014-11-09 02:38:11 +0100301 map32.set( 42, 1);
302 map64.set( Int64.make(0,42), 1);
303 map32.set( -517, -2);
Jens Geyer426ab862015-03-02 23:37:15 +0100304 map64.set( Int64.neg(Int64.make(0,517)), -2);
Jens Geyerb5028322014-11-09 02:38:11 +0100305 map32.set( 0, 3);
306 map64.set( Int64.make(0,0), 3);
Jens Geyerfea00ac2014-10-01 02:22:48 +0200307
Jens Geyerb5028322014-11-09 02:38:11 +0100308 var c32 = 0;
Jens Geyer426ab862015-03-02 23:37:15 +0100309 var ksum32 = 0;
Jens Geyerb5028322014-11-09 02:38:11 +0100310 for (key in map32.keys()) {
311 ++c32;
Jens Geyer426ab862015-03-02 23:37:15 +0100312 ksum32 += key;
Jens Geyerb5028322014-11-09 02:38:11 +0100313 }
314 var c64 = 0;
Jens Geyer426ab862015-03-02 23:37:15 +0100315 var ksum64 = Int64.make(0,0);
Jens Geyerb5028322014-11-09 02:38:11 +0100316 for (key in map64.keys()) {
317 ++c64;
Jens Geyer426ab862015-03-02 23:37:15 +0100318 ksum64 = Int64.add( ksum64, key);
Jens Geyerb5028322014-11-09 02:38:11 +0100319 }
320 rslt.Expect( c32 == c64, "Int64Map<Int32> Test #30");
Jens Geyer426ab862015-03-02 23:37:15 +0100321 rslt.Expect( '$ksum64' == '$ksum32', '$ksum64 == $ksum32 Test #31');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200322
Jens Geyer1d20a372016-03-15 23:04:27 +0200323 //compare without spaces because differ in php and cpp
324 var s32 = map32.toString().replace(' ', '');
325 var s64 = map64.toString().replace(' ', '');
Jens Geyer426ab862015-03-02 23:37:15 +0100326 rslt.Expect( s32 == s64, "Int64Map<Int32>.toString(): " + ' ("$s32" == "$s64") Test #32');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200327
Jens Geyerb5028322014-11-09 02:38:11 +0100328 map32.remove( 42);
329 map64.remove( Int64.make(0,42));
330 map32.remove( -517);
Jens Geyer426ab862015-03-02 23:37:15 +0100331 map64.remove( Int64.neg(Int64.make(0,517)));
Jens Geyerb5028322014-11-09 02:38:11 +0100332 map32.remove( 0);
333 map64.remove( Int64.make(0,0));
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200334
Jens Geyerb5028322014-11-09 02:38:11 +0100335 rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #90");
336 rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #91");
Jens Geyer426ab862015-03-02 23:37:15 +0100337 rslt.Expect( map32.exists( -517) == map64.exists( Int64.neg(Int64.make(0,517))), "Int64Map<Int32> Test #92");
Jens Geyerb5028322014-11-09 02:38:11 +0100338 rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #93");
339 rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #94");
340 rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #95");
341 rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #96");
342 rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #97");
Jens Geyer426ab862015-03-02 23:37:15 +0100343 rslt.Expect( map32.get( 0) == map64.get( Int64.make(0, 0)), "Int64Map<Int32> Test #98");
Jens Geyerb5028322014-11-09 02:38:11 +0100344 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200345
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200346
Jens Geyer426ab862015-03-02 23:37:15 +0100347 // core module unit tests
348 public static function ModuleUnitTests( args : Arguments, rslt : TestResults) : Void {
Jens Geyer1d20a372016-03-15 23:04:27 +0200349 #if debug
350
Jens Geyer426ab862015-03-02 23:37:15 +0100351 try {
352 BitConverter.UnitTest();
353 rslt.Expect( true, 'BitConverter.UnitTest Test #100');
354 }
355 catch( e : Dynamic) {
356 rslt.Expect( false, 'BitConverter.UnitTest: $e Test #100');
357 }
Jens Geyer43e195a2014-12-14 00:29:17 +0100358
Jens Geyer426ab862015-03-02 23:37:15 +0100359 try {
360 ZigZag.UnitTest();
361 rslt.Expect( true, 'ZigZag.UnitTest Test #101');
362 }
363 catch( e : Dynamic) {
364 rslt.Expect( false, 'ZigZag.UnitTest: $e Test #101');
365 }
Jens Geyer1d20a372016-03-15 23:04:27 +0200366
367 #end
Jens Geyer426ab862015-03-02 23:37:15 +0100368 }
Jens Geyer43e195a2014-12-14 00:29:17 +0100369
Jens Geyer43e195a2014-12-14 00:29:17 +0100370
Jens Geyer426ab862015-03-02 23:37:15 +0100371 public static function BytesToHex(data : Bytes) : String {
372 var hex = "";
373 for ( i in 0 ... data.length) {
374 hex += StringTools.hex( data.get(i), 2);
375 }
376 return hex;
377 }
Jens Geyer43e195a2014-12-14 00:29:17 +0100378
Jens Geyer426ab862015-03-02 23:37:15 +0100379 public static function PrepareTestData(randomDist : Bool) : Bytes {
380 var retval = Bytes.alloc(0x100);
381 var initLen : Int = (retval.length > 0x100 ? 0x100 : retval.length);
382
383 // linear distribution, unless random is requested
384 if (!randomDist) {
385 for (i in 0 ... initLen) {
386 retval.set(i, i % 0x100);
387 }
388 return retval;
389 }
390
391 // random distribution
392 for (i in 0 ... initLen) {
393 retval.set(i, 0);
394 }
395 for (i in 1 ... initLen) {
396 while( true) {
397 var nextPos = Std.random(initLen);
398 if (retval.get(nextPos) == 0) {
399 retval.set( nextPos, i % 0x100);
400 break;
401 }
402 }
403 }
404 return retval;
405 }
406
407
Jens Geyerb5028322014-11-09 02:38:11 +0100408 public static function ClientTest( transport : TTransport, protocol : TProtocol,
409 args : Arguments, rslt : TestResults) : Void
410 {
411 var client = new ThriftTestImpl(protocol,protocol);
412 try
413 {
414 if (!transport.isOpen())
415 {
416 transport.open();
417 }
418 }
419 catch (e : TException)
420 {
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200421 rslt.Expect( false, 'unable to open transport: $e');
Jens Geyerb5028322014-11-09 02:38:11 +0100422 return;
423 }
424 catch (e : Dynamic)
425 {
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200426 rslt.Expect( false, 'unable to open transport: $e');
Jens Geyerb5028322014-11-09 02:38:11 +0100427 return;
428 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200429
Jens Geyerb5028322014-11-09 02:38:11 +0100430 var start = Date.now();
431
432 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_EXCEPTIONS);
433
434 // if arg == "Xception" throw Xception with errorCode = 1001 and message = arg
435 trace('testException("Xception")');
436 try {
437 client.testException("Xception");
438 rslt.Expect( false, 'testException("Xception") should throw');
439 }
440 catch (e : Xception)
441 {
442 rslt.Expect( e.message == "Xception", 'testException("Xception") - e.message == "Xception"');
443 rslt.Expect( e.errorCode == 1001, 'testException("Xception") - e.errorCode == 1001');
444 }
445 catch (e : Dynamic)
446 {
447 rslt.Expect( false, 'testException("Xception") - $e');
448 }
449
450 // if arg == "TException" throw TException
451 trace('testException("TException")');
452 try {
453 client.testException("TException");
454 rslt.Expect( false, 'testException("TException") should throw');
455 }
456 catch (e : TException)
457 {
458 rslt.Expect( true, 'testException("TException") - $e');
459 }
460 catch (e : Dynamic)
461 {
462 rslt.Expect( false, 'testException("TException") - $e');
463 }
464
Jens Geyer426ab862015-03-02 23:37:15 +0100465 // reopen the transport, just in case the server closed his end
466 if (transport.isOpen())
467 transport.close();
468 transport.open();
469
Jens Geyerb5028322014-11-09 02:38:11 +0100470 // else do not throw anything
471 trace('testException("bla")');
472 try {
473 client.testException("bla");
474 rslt.Expect( true, 'testException("bla") should not throw');
475 }
476 catch (e : Dynamic)
477 {
478 rslt.Expect( false, 'testException("bla") - $e');
479 }
480
Jens Geyerb5028322014-11-09 02:38:11 +0100481 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
482
483 trace('testVoid()');
484 client.testVoid();
485 trace(' = void');
486 rslt.Expect(true,"testVoid()"); // bump counter
487
Jens Geyerfa2daef2015-09-22 00:11:01 +0200488 trace('testBool(${true})');
489 var b = client.testBool(true);
490 trace(' = $b');
Jens Geyer1d20a372016-03-15 23:04:27 +0200491 rslt.Expect(b, '$b == "${true}"');
Jens Geyerfa2daef2015-09-22 00:11:01 +0200492 trace('testBool(${false})');
493 b = client.testBool(false);
494 trace(' = $b');
Jens Geyer1d20a372016-03-15 23:04:27 +0200495 rslt.Expect( ! b, '$b == "${false}"');
Jens Geyerfa2daef2015-09-22 00:11:01 +0200496
Jens Geyerb5028322014-11-09 02:38:11 +0100497 trace('testString("Test")');
498 var s = client.testString("Test");
499 trace(' = "$s"');
500 rslt.Expect(s == "Test", '$s == "Test"');
501
502 trace('testByte(1)');
503 var i8 = client.testByte(1);
504 trace(' = $i8');
505 rslt.Expect(i8 == 1, '$i8 == 1');
506
507 trace('testI32(-1)');
508 var i32 = client.testI32(-1);
509 trace(' = $i32');
510 rslt.Expect(i32 == -1, '$i32 == -1');
511
512 trace('testI64(-34359738368)');
513 var i64 = client.testI64( Int64.make( 0xFFFFFFF8, 0x00000000)); // -34359738368
514 trace(' = $i64');
515 rslt.Expect( Int64.compare( i64, Int64.make( 0xFFFFFFF8, 0x00000000)) == 0,
516 Int64.toStr(i64) +" == "+Int64.toStr(Int64.make( 0xFFFFFFF8, 0x00000000)));
517
518 // edge case: the largest negative Int64 has no positive Int64 equivalent
519 trace('testI64(-9223372036854775808)');
520 i64 = client.testI64( Int64.make( 0x80000000, 0x00000000)); // -9223372036854775808
521 trace(' = $i64');
522 rslt.Expect( Int64.compare( i64, Int64.make( 0x80000000, 0x00000000)) == 0,
523 Int64.toStr(i64) +" == "+Int64.toStr(Int64.make( 0x80000000, 0x00000000)));
524
525 trace('testDouble(5.325098235)');
526 var dub = client.testDouble(5.325098235);
527 trace(' = $dub');
528 rslt.Expect(dub == 5.325098235, '$dub == 5.325098235');
529
Jens Geyer43e195a2014-12-14 00:29:17 +0100530 var binOut = PrepareTestData(true);
531 trace('testBinary('+BytesToHex(binOut)+')');
532 try {
533 var binIn = client.testBinary(binOut);
Jens Geyer426ab862015-03-02 23:37:15 +0100534 trace('testBinary() = '+BytesToHex(binIn));
535 rslt.Expect( binIn.length == binOut.length, '${binIn.length} == ${binOut.length}');
536 var len = ((binIn.length < binOut.length) ? binIn.length : binOut.length);
Jens Geyer43e195a2014-12-14 00:29:17 +0100537 for (ofs in 0 ... len) {
538 if (binIn.get(ofs) != binOut.get(ofs)) {
Jens Geyer426ab862015-03-02 23:37:15 +0100539 rslt.Expect( false, 'testBinary('+BytesToHex(binOut)+'): content mismatch at offset $ofs');
540 }
541 }
542 }
543 catch (e : TApplicationException) {
Jens Geyer43e195a2014-12-14 00:29:17 +0100544 trace('testBinary('+BytesToHex(binOut)+'): '+e.errorMsg); // may not be supported by the server
545 }
546
Jens Geyerb5028322014-11-09 02:38:11 +0100547
548 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_STRUCTS);
549
550 trace('testStruct({"Zero", 1, -3, -5})');
551 var o = new Xtruct();
552 o.string_thing = "Zero";
553 o.byte_thing = 1;
554 o.i32_thing = -3;
555 o.i64_thing = Int64.make(0,-5);
556 var i = client.testStruct(o);
557 trace(' = {"' + i.string_thing + '", ' + i.byte_thing +', '
558 + i.i32_thing +', '+ Int64.toStr(i.i64_thing) + '}');
559 rslt.Expect( i.string_thing == o.string_thing, "i.string_thing == o.string_thing");
560 rslt.Expect( i.byte_thing == o.byte_thing, "i.byte_thing == o.byte_thing");
561 rslt.Expect( i.i32_thing == o.i32_thing, "i.i64_thing == o.i64_thing");
562 rslt.Expect( i.i32_thing == o.i32_thing, "i.i64_thing == o.i64_thing");
563
564 trace('testNest({1, {\"Zero\", 1, -3, -5}, 5})');
565 var o2 = new Xtruct2();
566 o2.byte_thing = 1;
567 o2.struct_thing = o;
568 o2.i32_thing = 5;
569 var i2 = client.testNest(o2);
570 i = i2.struct_thing;
571 trace(" = {" + i2.byte_thing + ", {\"" + i.string_thing + "\", "
572 + i.byte_thing + ", " + i.i32_thing + ", " + Int64.toStr(i.i64_thing) + "}, "
573 + i2.i32_thing + "}");
574 rslt.Expect( i2.byte_thing == o2.byte_thing, "i2.byte_thing == o2.byte_thing");
575 rslt.Expect( i2.i32_thing == o2.i32_thing, "i2.i32_thing == o2.i32_thing");
576 rslt.Expect( i.string_thing == o.string_thing, "i.string_thing == o.string_thing");
577 rslt.Expect( i.byte_thing == o.byte_thing, "i.byte_thing == o.byte_thing");
578 rslt.Expect( i.i32_thing == o.i32_thing, "i.i32_thing == o.i32_thing");
579 rslt.Expect( Int64.compare( i.i64_thing, o.i64_thing) == 0, "i.i64_thing == o.i64_thing");
580
581
582 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_CONTAINERS);
583
584 var mapout = new IntMap< haxe.Int32>();
585 for ( j in 0 ... 5)
586 {
587 mapout.set(j, j - 10);
588 }
589 trace("testMap({");
590 var first : Bool = true;
591 for( key in mapout.keys())
592 {
593 if (first)
594 {
595 first = false;
596 }
597 else
598 {
599 trace(", ");
600 }
601 trace(key + " => " + mapout.get(key));
602 }
603 trace("})");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200604
Jens Geyerb5028322014-11-09 02:38:11 +0100605 var mapin = client.testMap(mapout);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200606
Jens Geyerb5028322014-11-09 02:38:11 +0100607 trace(" = {");
608 first = true;
609 for( key in mapin.keys())
610 {
611 if (first)
612 {
613 first = false;
614 }
615 else
616 {
617 trace(", ");
618 }
619 trace(key + " => " + mapin.get(key));
620 rslt.Expect( mapin.get(key) == mapout.get(key), ' mapin.get($key) == mapout.get($key)');
621 }
622 trace("}");
623 for( key in mapout.keys())
624 {
625 rslt.Expect(mapin.exists(key), 'mapin.exists($key)');
626 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200627
Jens Geyerb5028322014-11-09 02:38:11 +0100628 var listout = new List<Int>();
629 for (j in -2 ... 3)
630 {
631 listout.add(j);
632 }
633 trace("testList({");
634 first = true;
635 for( j in listout)
636 {
637 if (first)
638 {
639 first = false;
640 }
641 else
642 {
643 trace(", ");
644 }
645 trace(j);
646 }
647 trace("})");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200648
Jens Geyerb5028322014-11-09 02:38:11 +0100649 var listin = client.testList(listout);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200650
Jens Geyerb5028322014-11-09 02:38:11 +0100651 trace(" = {");
652 first = true;
653 for( j in listin)
654 {
655 if (first)
656 {
657 first = false;
658 }
659 else
660 {
661 trace(", ");
662 }
663 trace(j);
664 }
665 trace("}");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200666
Jens Geyerb5028322014-11-09 02:38:11 +0100667 rslt.Expect(listin.length == listout.length, "listin.length == listout.length");
668 var literout = listout.iterator();
669 var literin = listin.iterator();
670 while( literin.hasNext()) {
671 rslt.Expect(literin.next() == literout.next(), "literin[i] == literout[i]");
672 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200673
Jens Geyerb5028322014-11-09 02:38:11 +0100674 //set
675 var setout = new IntSet();
676 for (j in -2 ... 3)
677 {
678 setout.add(j);
679 }
680 trace("testSet({");
681 first = true;
682 for( j in setout)
683 {
684 if (first)
685 {
686 first = false;
687 }
688 else
689 {
690 trace(", ");
691 }
692 trace(j);
693 }
694 trace("})");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200695
Jens Geyerb5028322014-11-09 02:38:11 +0100696 var setin = client.testSet(setout);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200697
Jens Geyerb5028322014-11-09 02:38:11 +0100698 trace(" = {");
699 first = true;
700 for( j in setin)
701 {
702 if (first)
703 {
704 first = false;
705 }
706 else
707 {
708 trace(", ");
709 }
710 trace(j);
711 rslt.Expect(setout.contains(j), 'setout.contains($j)');
712 }
713 trace("}");
714 rslt.Expect(setin.size == setout.size, "setin.length == setout.length");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200715
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200716
Jens Geyerb5028322014-11-09 02:38:11 +0100717 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200718
Jens Geyerb5028322014-11-09 02:38:11 +0100719 trace("testEnum(ONE)");
720 var ret = client.testEnum(Numberz.ONE);
721 trace(" = " + ret);
722 rslt.Expect(ret == Numberz.ONE, '$ret == Numberz.ONE');
Jens Geyerfea00ac2014-10-01 02:22:48 +0200723
Jens Geyerb5028322014-11-09 02:38:11 +0100724 trace("testEnum(TWO)");
725 ret = client.testEnum(Numberz.TWO);
726 trace(" = " + ret);
727 rslt.Expect(ret == Numberz.TWO, '$ret == Numberz.TWO');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200728
Jens Geyerb5028322014-11-09 02:38:11 +0100729 trace("testEnum(THREE)");
730 ret = client.testEnum(Numberz.THREE);
731 trace(" = " + ret);
732 rslt.Expect(ret == Numberz.THREE, '$ret == Numberz.THREE');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200733
Jens Geyerb5028322014-11-09 02:38:11 +0100734 trace("testEnum(FIVE)");
735 ret = client.testEnum(Numberz.FIVE);
736 trace(" = " + ret);
737 rslt.Expect(ret == Numberz.FIVE, '$ret == Numberz.FIVE');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200738
Jens Geyerb5028322014-11-09 02:38:11 +0100739 trace("testEnum(EIGHT)");
740 ret = client.testEnum(Numberz.EIGHT);
741 trace(" = " + ret);
742 rslt.Expect(ret == Numberz.EIGHT, '$ret == Numberz.EIGHT');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200743
Jens Geyerb5028322014-11-09 02:38:11 +0100744 trace("testTypedef(309858235082523)");
745 var uid = client.testTypedef( Int64.make( 0x119D0, 0x7E08671B)); // 309858235082523
746 trace(" = " + uid);
747 rslt.Expect( Int64.compare( uid, Int64.make( 0x119D0, 0x7E08671B)) == 0,
748 Int64.toStr(uid)+" == "+Int64.toStr(Int64.make( 0x119D0, 0x7E08671B)));
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200749
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200750
Jens Geyerb5028322014-11-09 02:38:11 +0100751 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_CONTAINERS);
Jens Geyerfea00ac2014-10-01 02:22:48 +0200752
Jens Geyerb5028322014-11-09 02:38:11 +0100753 trace("testMapMap(1)");
754 var mm = client.testMapMap(1);
755 trace(" = {");
756 for( key in mm.keys())
757 {
758 trace(key + " => {");
759 var m2 = mm.get(key);
760 for( k2 in m2.keys())
761 {
762 trace(k2 + " => " + m2.get(k2) + ", ");
763 }
764 trace("}, ");
765 }
766 trace("}");
Jens Geyerfea00ac2014-10-01 02:22:48 +0200767
Jens Geyerb5028322014-11-09 02:38:11 +0100768 var pos = mm.get(4);
769 var neg = mm.get(-4);
770 rslt.Expect( (pos != null) && (neg != null), "(pos != null) && (neg != null)");
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200771 for (i in 1 ... 5) {
Jens Geyerb5028322014-11-09 02:38:11 +0100772 rslt.Expect( pos.get(i) == i, 'pos.get($i) == $i');
773 rslt.Expect( neg.get(-i) == -i, 'neg.get(-$i) == -$i');
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200774 }
775 rslt.Expect( ! pos.exists(0), '!pos.exists(0)');
776 rslt.Expect( ! neg.exists(-0), '!neg.exists(-0)');
777 rslt.Expect( ! pos.exists(42), '!pos.exists(42)');
778 rslt.Expect( ! neg.exists(-42), '!neg.exists(-42)');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200779
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200780
Jens Geyerb5028322014-11-09 02:38:11 +0100781 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_STRUCTS);
Jens Geyerfea00ac2014-10-01 02:22:48 +0200782
Jens Geyerb5028322014-11-09 02:38:11 +0100783 var insane = new Insanity();
784 insane.userMap = new IntMap< Int64>();
785 insane.userMap.set( Numberz.FIVE, Int64.make(0,5000));
786 var truck = new Xtruct();
787 truck.string_thing = "Truck";
788 truck.byte_thing = 8;
789 truck.i32_thing = 8;
790 truck.i64_thing = Int64.make(0,8);
791 insane.xtructs = new List<Xtruct>();
792 insane.xtructs.add(truck);
793 trace("testInsanity()");
794 var whoa = client.testInsanity(insane);
795 trace(" = {");
796 for( key in whoa.keys())
797 {
798 var val = whoa.get(key);
799 trace(key + " => {");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200800
Jens Geyerb5028322014-11-09 02:38:11 +0100801 for( k2 in val.keys())
802 {
803 var v2 = val.get(k2);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200804
Jens Geyerb5028322014-11-09 02:38:11 +0100805 trace(k2 + " => {");
806 var userMap = v2.userMap;
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200807
Jens Geyerb5028322014-11-09 02:38:11 +0100808 trace("{");
809 if (userMap != null)
810 {
811 for( k3 in userMap.keys())
812 {
813 trace(k3 + " => " + userMap.get(k3) + ", ");
814 }
815 }
816 else
817 {
818 trace("null");
819 }
820 trace("}, ");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200821
Jens Geyerb5028322014-11-09 02:38:11 +0100822 var xtructs = v2.xtructs;
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200823
Jens Geyerb5028322014-11-09 02:38:11 +0100824 trace("{");
825 if (xtructs != null)
826 {
827 for( x in xtructs)
828 {
829 trace("{\"" + x.string_thing + "\", "
830 + x.byte_thing + ", " + x.i32_thing + ", "
831 + x.i32_thing + "}, ");
832 }
833 }
834 else
835 {
836 trace("null");
837 }
838 trace("}");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200839
Jens Geyerb5028322014-11-09 02:38:11 +0100840 trace("}, ");
841 }
842 trace("}, ");
843 }
844 trace("}");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200845
Jens Geyerfea00ac2014-10-01 02:22:48 +0200846
Jens Geyerb5028322014-11-09 02:38:11 +0100847 var first_map = whoa.get(Int64.make(0,1));
848 var second_map = whoa.get(Int64.make(0,2));
849 rslt.Expect( (first_map != null) && (second_map != null), "(first_map != null) && (second_map != null)");
850 if ((first_map != null) && (second_map != null))
851 {
852 var crazy2 = first_map.get(Numberz.TWO);
853 var crazy3 = first_map.get(Numberz.THREE);
854 var looney = second_map.get(Numberz.SIX);
855 rslt.Expect( (crazy2 != null) && (crazy3 != null) && (looney != null),
856 "(crazy2 != null) && (crazy3 != null) && (looney != null)");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200857
Jens Geyerb5028322014-11-09 02:38:11 +0100858 rslt.Expect( Int64.compare( crazy2.userMap.get(Numberz.EIGHT), Int64.make(0,8)) == 0,
859 "crazy2.UserMap.get(Numberz.EIGHT) == 8");
860 rslt.Expect( Int64.compare( crazy3.userMap.get(Numberz.EIGHT), Int64.make(0,8)) == 0,
861 "crazy3.UserMap.get(Numberz.EIGHT) == 8");
862 rslt.Expect( Int64.compare( crazy2.userMap.get(Numberz.FIVE), Int64.make(0,5)) == 0,
863 "crazy2.UserMap.get(Numberz.FIVE) == 5");
864 rslt.Expect( Int64.compare( crazy3.userMap.get(Numberz.FIVE), Int64.make(0,5)) == 0,
865 "crazy3.UserMap.get(Numberz.FIVE) == 5");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200866
Jens Geyerb5028322014-11-09 02:38:11 +0100867 var crz2iter = crazy2.xtructs.iterator();
868 var crz3iter = crazy3.xtructs.iterator();
869 rslt.Expect( crz2iter.hasNext() && crz3iter.hasNext(), "crz2iter.hasNext() && crz3iter.hasNext()");
870 var goodbye2 = crz2iter.next();
871 var goodbye3 = crz3iter.next();
872 rslt.Expect( crz2iter.hasNext() && crz3iter.hasNext(), "crz2iter.hasNext() && crz3iter.hasNext()");
873 var hello2 = crz2iter.next();
874 var hello3 = crz3iter.next();
875 rslt.Expect( ! (crz2iter.hasNext() || crz3iter.hasNext()), "! (crz2iter.hasNext() || crz3iter.hasNext())");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200876
Jens Geyerb5028322014-11-09 02:38:11 +0100877 rslt.Expect( hello2.string_thing == "Hello2", 'hello2.String_thing == "Hello2"');
878 rslt.Expect( hello2.byte_thing == 2, 'hello2.Byte_thing == 2');
879 rslt.Expect( hello2.i32_thing == 2, 'hello2.I32_thing == 2');
880 rslt.Expect( Int64.compare( hello2.i64_thing, Int64.make(0,2)) == 0, 'hello2.I64_thing == 2');
881 rslt.Expect( hello3.string_thing == "Hello2", 'hello3.String_thing == "Hello2"');
882 rslt.Expect( hello3.byte_thing == 2, 'hello3.Byte_thing == 2');
883 rslt.Expect( hello3.i32_thing == 2, 'hello3.I32_thing == 2');
884 rslt.Expect( Int64.compare( hello3.i64_thing, Int64.make(0,2)) == 0, 'hello3.I64_thing == 2');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200885
Jens Geyerb5028322014-11-09 02:38:11 +0100886 rslt.Expect( goodbye2.string_thing == "Goodbye4", 'goodbye2.String_thing == "Goodbye4"');
887 rslt.Expect( goodbye2.byte_thing == 4, 'goodbye2.Byte_thing == 4');
888 rslt.Expect( goodbye2.i32_thing == 4, 'goodbye2.I32_thing == 4');
889 rslt.Expect( Int64.compare( goodbye2.i64_thing, Int64.make(0,4)) == 0, 'goodbye2.I64_thing == 4');
890 rslt.Expect( goodbye3.string_thing == "Goodbye4", 'goodbye3.String_thing == "Goodbye4"');
891 rslt.Expect( goodbye3.byte_thing == 4, 'goodbye3.Byte_thing == 4');
892 rslt.Expect( goodbye3.i32_thing == 4, 'goodbye3.I32_thing == 4');
893 rslt.Expect( Int64.compare( goodbye3.i64_thing, Int64.make(0,4)) == 0, 'goodbye3.I64_thing == 4');
894 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200895
Jens Geyerb5028322014-11-09 02:38:11 +0100896 var arg0 = 1;
897 var arg1 = 2;
898 var arg2 = Int64.make( 0x7FFFFFFF,0xFFFFFFFF);
899 var multiDict = new IntMap< String>();
900 multiDict.set(1, "one");
901 var arg4 = Numberz.FIVE;
902 var arg5 = Int64.make(0,5000000);
903 trace("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + "," + multiDict + "," + arg4 + "," + arg5 + ")");
904 var multiResponse = client.testMulti(arg0, arg1, arg2, multiDict, arg4, arg5);
905 trace(" = Xtruct(byte_thing:" + multiResponse.byte_thing + ",string_thing:" + multiResponse.string_thing
906 + ",i32_thing:" + multiResponse.i32_thing
907 + ",i64_thing:" + Int64.toStr(multiResponse.i64_thing) + ")");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200908
Jens Geyerb5028322014-11-09 02:38:11 +0100909 rslt.Expect( multiResponse.string_thing == "Hello2", 'multiResponse.String_thing == "Hello2"');
910 rslt.Expect( multiResponse.byte_thing == arg0, 'multiResponse.Byte_thing == arg0');
911 rslt.Expect( multiResponse.i32_thing == arg1, 'multiResponse.I32_thing == arg1');
912 rslt.Expect( Int64.compare( multiResponse.i64_thing, arg2) == 0, 'multiResponse.I64_thing == arg2');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200913
914
Jens Geyerb5028322014-11-09 02:38:11 +0100915 rslt.StartTestGroup( 0);
Jens Geyerfea00ac2014-10-01 02:22:48 +0200916
Jens Geyerb5028322014-11-09 02:38:11 +0100917 trace("Test Oneway(1)");
918 client.testOneway(1);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200919
Jens Geyerb5028322014-11-09 02:38:11 +0100920 if( ! args.skipSpeedTest) {
921 trace("Test Calltime()");
922 var difft = Timer.stamp();
923 for ( k in 0 ... 1000) {
924 client.testVoid();
925 }
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200926 difft = Math.round( 1000 * (Timer.stamp() - difft)) / 1000;
Jens Geyerb5028322014-11-09 02:38:11 +0100927 trace('$difft ms per testVoid() call');
928 }
929 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200930}