blob: aa496dc8d39b6e055d4cf39448cc944197535d90 [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:
Oleksii Prudkyi39a09ac2016-05-19 16:55:11 +0300215 var uri = 'http://${args.host}:${args.port}';
216 trace('- http client : ${uri}');
217 transport = new THttpClient(uri);
Jens Geyerb5028322014-11-09 02:38:11 +0100218 default:
219 throw "Unhandled transport";
220 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200221
Jens Geyerb5028322014-11-09 02:38:11 +0100222 // optional: layered transport
223 if ( args.framed) {
224 trace("- framed transport");
225 transport = new TFramedTransport(transport);
226 }
227 if ( args.buffered) {
228 trace("- buffered transport");
Jens Geyerd35f6162014-11-29 19:23:03 +0100229 transport = new TBufferedTransport(transport);
Jens Geyerb5028322014-11-09 02:38:11 +0100230 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200231
Jens Geyerb5028322014-11-09 02:38:11 +0100232 // protocol
233 var protocol : TProtocol = null;
234 switch( args.protocol)
235 {
236 case binary:
237 trace("- binary protocol");
238 protocol = new TBinaryProtocol(transport);
239 case json:
240 trace("- json protocol");
241 protocol = new TJSONProtocol(transport);
Jens Geyer426ab862015-03-02 23:37:15 +0100242 case compact:
243 trace("- compact protocol");
244 protocol = new TCompactProtocol(transport);
Jens Geyerb5028322014-11-09 02:38:11 +0100245 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200246
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200247 // some quick and basic unit tests
Jens Geyerb5028322014-11-09 02:38:11 +0100248 HaxeBasicsTest( args, rslt);
Jens Geyer426ab862015-03-02 23:37:15 +0100249 ModuleUnitTests( args, rslt);
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200250
251 // now run the test code
252 trace('- ${args.numIterations} iterations');
Jens Geyerb5028322014-11-09 02:38:11 +0100253 for( i in 0 ... args.numIterations) {
254 ClientTest( transport, protocol, args, rslt);
255 }
256 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200257
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200258
Jens Geyerb5028322014-11-09 02:38:11 +0100259 public static function HaxeBasicsTest( args : Arguments, rslt : TestResults) : Void
260 {
261 // We need to test a few basic things used in the ClientTest
262 // Anything else beyond this scope should go into /lib/haxe/ instead
Jens Geyer26b36dc2016-05-28 23:22:51 +0200263 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200264
Jens Geyerb5028322014-11-09 02:38:11 +0100265 var map32 = new IntMap<Int32>();
266 var map64 = new Int64Map<Int32>();
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200267
Jens Geyerb5028322014-11-09 02:38:11 +0100268 rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #1");
269 rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #2");
270 rslt.Expect( map32.remove( 4711) == map64.remove( Int64.make(47,11)), "Int64Map<Int32> Test #3");
271 rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #4");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200272
Jens Geyerb5028322014-11-09 02:38:11 +0100273 map32.set( 42, 815);
274 map64.set( Int64.make(0,42), 815);
275 map32.set( -517, 23);
Jens Geyer426ab862015-03-02 23:37:15 +0100276 map64.set( Int64.neg(Int64.make(0,517)), 23);
Jens Geyerb5028322014-11-09 02:38:11 +0100277 map32.set( 0, -123);
278 map64.set( Int64.make(0,0), -123);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200279
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200280 //trace('map32 = $map32');
281 //trace('map64 = $map64');
282
Jens Geyerb5028322014-11-09 02:38:11 +0100283 rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #10");
284 rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #11");
Jens Geyer426ab862015-03-02 23:37:15 +0100285 rslt.Expect( map32.exists( -517) == map64.exists( Int64.neg(Int64.make(0,517))), "Int64Map<Int32> Test #12");
Jens Geyerb5028322014-11-09 02:38:11 +0100286 rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #13");
287 rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #14");
288 rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #15");
Jens Geyer426ab862015-03-02 23:37:15 +0100289 rslt.Expect( map32.get( -517) == map64.get( Int64.neg(Int64.make(0,517))), "Int64Map<Int32> Test #16");
Jens Geyerb5028322014-11-09 02:38:11 +0100290 rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #Int64.make(-5,17)");
291 rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #18");
292 rslt.Expect( map32.remove( 4711) == map64.remove( Int64.make(47,11)), "Int64Map<Int32> Test #19");
Jens Geyer426ab862015-03-02 23:37:15 +0100293 rslt.Expect( map32.remove( -517) == map64.remove( Int64.neg(Int64.make(0,517))), "Int64Map<Int32> Test #20");
Jens Geyerb5028322014-11-09 02:38:11 +0100294 rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #21");
Jens Geyer426ab862015-03-02 23:37:15 +0100295 rslt.Expect( map32.exists( -517) == map64.exists( Int64.neg(Int64.make(0,517))), "Int64Map<Int32> Test #22");
Jens Geyerb5028322014-11-09 02:38:11 +0100296 rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #23");
297 rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #24");
298 rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #25");
Jens Geyer426ab862015-03-02 23:37:15 +0100299 rslt.Expect( map32.get( -517) == map64.get( Int64.neg(Int64.make(0,517))), "Int64Map<Int32> Test #26");
Jens Geyerb5028322014-11-09 02:38:11 +0100300 rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #27");
301 rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #28");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200302
Jens Geyerb5028322014-11-09 02:38:11 +0100303 map32.set( 42, 1);
304 map64.set( Int64.make(0,42), 1);
305 map32.set( -517, -2);
Jens Geyer426ab862015-03-02 23:37:15 +0100306 map64.set( Int64.neg(Int64.make(0,517)), -2);
Jens Geyerb5028322014-11-09 02:38:11 +0100307 map32.set( 0, 3);
308 map64.set( Int64.make(0,0), 3);
Jens Geyerfea00ac2014-10-01 02:22:48 +0200309
Jens Geyerb5028322014-11-09 02:38:11 +0100310 var c32 = 0;
Jens Geyer426ab862015-03-02 23:37:15 +0100311 var ksum32 = 0;
Jens Geyerb5028322014-11-09 02:38:11 +0100312 for (key in map32.keys()) {
313 ++c32;
Jens Geyer426ab862015-03-02 23:37:15 +0100314 ksum32 += key;
Jens Geyerb5028322014-11-09 02:38:11 +0100315 }
316 var c64 = 0;
Jens Geyer426ab862015-03-02 23:37:15 +0100317 var ksum64 = Int64.make(0,0);
Jens Geyerb5028322014-11-09 02:38:11 +0100318 for (key in map64.keys()) {
319 ++c64;
Jens Geyer426ab862015-03-02 23:37:15 +0100320 ksum64 = Int64.add( ksum64, key);
Jens Geyerb5028322014-11-09 02:38:11 +0100321 }
322 rslt.Expect( c32 == c64, "Int64Map<Int32> Test #30");
Jens Geyer426ab862015-03-02 23:37:15 +0100323 rslt.Expect( '$ksum64' == '$ksum32', '$ksum64 == $ksum32 Test #31');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200324
Jens Geyer1d20a372016-03-15 23:04:27 +0200325 //compare without spaces because differ in php and cpp
326 var s32 = map32.toString().replace(' ', '');
327 var s64 = map64.toString().replace(' ', '');
Jens Geyer426ab862015-03-02 23:37:15 +0100328 rslt.Expect( s32 == s64, "Int64Map<Int32>.toString(): " + ' ("$s32" == "$s64") Test #32');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200329
Jens Geyerb5028322014-11-09 02:38:11 +0100330 map32.remove( 42);
331 map64.remove( Int64.make(0,42));
332 map32.remove( -517);
Jens Geyer426ab862015-03-02 23:37:15 +0100333 map64.remove( Int64.neg(Int64.make(0,517)));
Jens Geyerb5028322014-11-09 02:38:11 +0100334 map32.remove( 0);
335 map64.remove( Int64.make(0,0));
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200336
Jens Geyerb5028322014-11-09 02:38:11 +0100337 rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #90");
338 rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #91");
Jens Geyer426ab862015-03-02 23:37:15 +0100339 rslt.Expect( map32.exists( -517) == map64.exists( Int64.neg(Int64.make(0,517))), "Int64Map<Int32> Test #92");
Jens Geyerb5028322014-11-09 02:38:11 +0100340 rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #93");
341 rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #94");
342 rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #95");
343 rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #96");
344 rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #97");
Jens Geyer426ab862015-03-02 23:37:15 +0100345 rslt.Expect( map32.get( 0) == map64.get( Int64.make(0, 0)), "Int64Map<Int32> Test #98");
Jens Geyerb5028322014-11-09 02:38:11 +0100346 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200347
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200348
Jens Geyer426ab862015-03-02 23:37:15 +0100349 // core module unit tests
350 public static function ModuleUnitTests( args : Arguments, rslt : TestResults) : Void {
Jens Geyer1d20a372016-03-15 23:04:27 +0200351 #if debug
352
Jens Geyer426ab862015-03-02 23:37:15 +0100353 try {
354 BitConverter.UnitTest();
355 rslt.Expect( true, 'BitConverter.UnitTest Test #100');
356 }
357 catch( e : Dynamic) {
358 rslt.Expect( false, 'BitConverter.UnitTest: $e Test #100');
359 }
Jens Geyer43e195a2014-12-14 00:29:17 +0100360
Jens Geyer426ab862015-03-02 23:37:15 +0100361 try {
362 ZigZag.UnitTest();
363 rslt.Expect( true, 'ZigZag.UnitTest Test #101');
364 }
365 catch( e : Dynamic) {
366 rslt.Expect( false, 'ZigZag.UnitTest: $e Test #101');
367 }
Jens Geyer1d20a372016-03-15 23:04:27 +0200368
369 #end
Jens Geyer426ab862015-03-02 23:37:15 +0100370 }
Jens Geyer43e195a2014-12-14 00:29:17 +0100371
Jens Geyer43e195a2014-12-14 00:29:17 +0100372
Jens Geyer426ab862015-03-02 23:37:15 +0100373 public static function BytesToHex(data : Bytes) : String {
374 var hex = "";
375 for ( i in 0 ... data.length) {
376 hex += StringTools.hex( data.get(i), 2);
377 }
378 return hex;
379 }
Jens Geyer43e195a2014-12-14 00:29:17 +0100380
Jens Geyer426ab862015-03-02 23:37:15 +0100381 public static function PrepareTestData(randomDist : Bool) : Bytes {
382 var retval = Bytes.alloc(0x100);
383 var initLen : Int = (retval.length > 0x100 ? 0x100 : retval.length);
384
385 // linear distribution, unless random is requested
386 if (!randomDist) {
387 for (i in 0 ... initLen) {
388 retval.set(i, i % 0x100);
389 }
390 return retval;
391 }
392
393 // random distribution
394 for (i in 0 ... initLen) {
395 retval.set(i, 0);
396 }
397 for (i in 1 ... initLen) {
398 while( true) {
399 var nextPos = Std.random(initLen);
400 if (retval.get(nextPos) == 0) {
401 retval.set( nextPos, i % 0x100);
402 break;
403 }
404 }
405 }
406 return retval;
407 }
408
409
Jens Geyerb5028322014-11-09 02:38:11 +0100410 public static function ClientTest( transport : TTransport, protocol : TProtocol,
411 args : Arguments, rslt : TestResults) : Void
412 {
413 var client = new ThriftTestImpl(protocol,protocol);
414 try
415 {
416 if (!transport.isOpen())
417 {
418 transport.open();
419 }
420 }
421 catch (e : TException)
422 {
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200423 rslt.Expect( false, 'unable to open transport: $e');
Jens Geyerb5028322014-11-09 02:38:11 +0100424 return;
425 }
426 catch (e : Dynamic)
427 {
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200428 rslt.Expect( false, 'unable to open transport: $e');
Jens Geyerb5028322014-11-09 02:38:11 +0100429 return;
430 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200431
Jens Geyerb5028322014-11-09 02:38:11 +0100432 var start = Date.now();
433
434 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_EXCEPTIONS);
435
436 // if arg == "Xception" throw Xception with errorCode = 1001 and message = arg
437 trace('testException("Xception")');
438 try {
439 client.testException("Xception");
440 rslt.Expect( false, 'testException("Xception") should throw');
441 }
442 catch (e : Xception)
443 {
444 rslt.Expect( e.message == "Xception", 'testException("Xception") - e.message == "Xception"');
445 rslt.Expect( e.errorCode == 1001, 'testException("Xception") - e.errorCode == 1001');
446 }
447 catch (e : Dynamic)
448 {
449 rslt.Expect( false, 'testException("Xception") - $e');
450 }
451
452 // if arg == "TException" throw TException
453 trace('testException("TException")');
454 try {
455 client.testException("TException");
456 rslt.Expect( false, 'testException("TException") should throw');
457 }
458 catch (e : TException)
459 {
460 rslt.Expect( true, 'testException("TException") - $e');
461 }
462 catch (e : Dynamic)
463 {
464 rslt.Expect( false, 'testException("TException") - $e');
465 }
466
Jens Geyer426ab862015-03-02 23:37:15 +0100467 // reopen the transport, just in case the server closed his end
468 if (transport.isOpen())
469 transport.close();
470 transport.open();
471
Jens Geyerb5028322014-11-09 02:38:11 +0100472 // else do not throw anything
473 trace('testException("bla")');
474 try {
475 client.testException("bla");
476 rslt.Expect( true, 'testException("bla") should not throw');
477 }
478 catch (e : Dynamic)
479 {
480 rslt.Expect( false, 'testException("bla") - $e');
481 }
482
Jens Geyerb5028322014-11-09 02:38:11 +0100483 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
484
485 trace('testVoid()');
486 client.testVoid();
487 trace(' = void');
488 rslt.Expect(true,"testVoid()"); // bump counter
489
Jens Geyerfa2daef2015-09-22 00:11:01 +0200490 trace('testBool(${true})');
491 var b = client.testBool(true);
492 trace(' = $b');
Jens Geyer1d20a372016-03-15 23:04:27 +0200493 rslt.Expect(b, '$b == "${true}"');
Jens Geyerfa2daef2015-09-22 00:11:01 +0200494 trace('testBool(${false})');
495 b = client.testBool(false);
496 trace(' = $b');
Jens Geyer1d20a372016-03-15 23:04:27 +0200497 rslt.Expect( ! b, '$b == "${false}"');
Jens Geyerfa2daef2015-09-22 00:11:01 +0200498
Jens Geyerb5028322014-11-09 02:38:11 +0100499 trace('testString("Test")');
500 var s = client.testString("Test");
501 trace(' = "$s"');
502 rslt.Expect(s == "Test", '$s == "Test"');
503
504 trace('testByte(1)');
505 var i8 = client.testByte(1);
506 trace(' = $i8');
507 rslt.Expect(i8 == 1, '$i8 == 1');
508
509 trace('testI32(-1)');
510 var i32 = client.testI32(-1);
511 trace(' = $i32');
512 rslt.Expect(i32 == -1, '$i32 == -1');
513
514 trace('testI64(-34359738368)');
515 var i64 = client.testI64( Int64.make( 0xFFFFFFF8, 0x00000000)); // -34359738368
516 trace(' = $i64');
517 rslt.Expect( Int64.compare( i64, Int64.make( 0xFFFFFFF8, 0x00000000)) == 0,
518 Int64.toStr(i64) +" == "+Int64.toStr(Int64.make( 0xFFFFFFF8, 0x00000000)));
519
520 // edge case: the largest negative Int64 has no positive Int64 equivalent
521 trace('testI64(-9223372036854775808)');
522 i64 = client.testI64( Int64.make( 0x80000000, 0x00000000)); // -9223372036854775808
523 trace(' = $i64');
524 rslt.Expect( Int64.compare( i64, Int64.make( 0x80000000, 0x00000000)) == 0,
525 Int64.toStr(i64) +" == "+Int64.toStr(Int64.make( 0x80000000, 0x00000000)));
526
527 trace('testDouble(5.325098235)');
528 var dub = client.testDouble(5.325098235);
529 trace(' = $dub');
530 rslt.Expect(dub == 5.325098235, '$dub == 5.325098235');
531
Jens Geyer43e195a2014-12-14 00:29:17 +0100532 var binOut = PrepareTestData(true);
533 trace('testBinary('+BytesToHex(binOut)+')');
534 try {
535 var binIn = client.testBinary(binOut);
Jens Geyer426ab862015-03-02 23:37:15 +0100536 trace('testBinary() = '+BytesToHex(binIn));
537 rslt.Expect( binIn.length == binOut.length, '${binIn.length} == ${binOut.length}');
538 var len = ((binIn.length < binOut.length) ? binIn.length : binOut.length);
Jens Geyer43e195a2014-12-14 00:29:17 +0100539 for (ofs in 0 ... len) {
540 if (binIn.get(ofs) != binOut.get(ofs)) {
Jens Geyer426ab862015-03-02 23:37:15 +0100541 rslt.Expect( false, 'testBinary('+BytesToHex(binOut)+'): content mismatch at offset $ofs');
542 }
543 }
544 }
545 catch (e : TApplicationException) {
Jens Geyer43e195a2014-12-14 00:29:17 +0100546 trace('testBinary('+BytesToHex(binOut)+'): '+e.errorMsg); // may not be supported by the server
547 }
548
Jens Geyerb5028322014-11-09 02:38:11 +0100549
550 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_STRUCTS);
551
552 trace('testStruct({"Zero", 1, -3, -5})');
553 var o = new Xtruct();
554 o.string_thing = "Zero";
555 o.byte_thing = 1;
556 o.i32_thing = -3;
557 o.i64_thing = Int64.make(0,-5);
558 var i = client.testStruct(o);
559 trace(' = {"' + i.string_thing + '", ' + i.byte_thing +', '
560 + i.i32_thing +', '+ Int64.toStr(i.i64_thing) + '}');
561 rslt.Expect( i.string_thing == o.string_thing, "i.string_thing == o.string_thing");
562 rslt.Expect( i.byte_thing == o.byte_thing, "i.byte_thing == o.byte_thing");
563 rslt.Expect( i.i32_thing == o.i32_thing, "i.i64_thing == o.i64_thing");
564 rslt.Expect( i.i32_thing == o.i32_thing, "i.i64_thing == o.i64_thing");
565
566 trace('testNest({1, {\"Zero\", 1, -3, -5}, 5})');
567 var o2 = new Xtruct2();
568 o2.byte_thing = 1;
569 o2.struct_thing = o;
570 o2.i32_thing = 5;
571 var i2 = client.testNest(o2);
572 i = i2.struct_thing;
573 trace(" = {" + i2.byte_thing + ", {\"" + i.string_thing + "\", "
574 + i.byte_thing + ", " + i.i32_thing + ", " + Int64.toStr(i.i64_thing) + "}, "
575 + i2.i32_thing + "}");
576 rslt.Expect( i2.byte_thing == o2.byte_thing, "i2.byte_thing == o2.byte_thing");
577 rslt.Expect( i2.i32_thing == o2.i32_thing, "i2.i32_thing == o2.i32_thing");
578 rslt.Expect( i.string_thing == o.string_thing, "i.string_thing == o.string_thing");
579 rslt.Expect( i.byte_thing == o.byte_thing, "i.byte_thing == o.byte_thing");
580 rslt.Expect( i.i32_thing == o.i32_thing, "i.i32_thing == o.i32_thing");
581 rslt.Expect( Int64.compare( i.i64_thing, o.i64_thing) == 0, "i.i64_thing == o.i64_thing");
582
583
584 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_CONTAINERS);
585
586 var mapout = new IntMap< haxe.Int32>();
587 for ( j in 0 ... 5)
588 {
589 mapout.set(j, j - 10);
590 }
591 trace("testMap({");
592 var first : Bool = true;
593 for( key in mapout.keys())
594 {
595 if (first)
596 {
597 first = false;
598 }
599 else
600 {
601 trace(", ");
602 }
603 trace(key + " => " + mapout.get(key));
604 }
605 trace("})");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200606
Jens Geyerb5028322014-11-09 02:38:11 +0100607 var mapin = client.testMap(mapout);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200608
Jens Geyerb5028322014-11-09 02:38:11 +0100609 trace(" = {");
610 first = true;
611 for( key in mapin.keys())
612 {
613 if (first)
614 {
615 first = false;
616 }
617 else
618 {
619 trace(", ");
620 }
621 trace(key + " => " + mapin.get(key));
622 rslt.Expect( mapin.get(key) == mapout.get(key), ' mapin.get($key) == mapout.get($key)');
623 }
624 trace("}");
625 for( key in mapout.keys())
626 {
627 rslt.Expect(mapin.exists(key), 'mapin.exists($key)');
628 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200629
Jens Geyerb5028322014-11-09 02:38:11 +0100630 var listout = new List<Int>();
631 for (j in -2 ... 3)
632 {
633 listout.add(j);
634 }
635 trace("testList({");
636 first = true;
637 for( j in listout)
638 {
639 if (first)
640 {
641 first = false;
642 }
643 else
644 {
645 trace(", ");
646 }
647 trace(j);
648 }
649 trace("})");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200650
Jens Geyerb5028322014-11-09 02:38:11 +0100651 var listin = client.testList(listout);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200652
Jens Geyerb5028322014-11-09 02:38:11 +0100653 trace(" = {");
654 first = true;
655 for( j in listin)
656 {
657 if (first)
658 {
659 first = false;
660 }
661 else
662 {
663 trace(", ");
664 }
665 trace(j);
666 }
667 trace("}");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200668
Jens Geyerb5028322014-11-09 02:38:11 +0100669 rslt.Expect(listin.length == listout.length, "listin.length == listout.length");
670 var literout = listout.iterator();
671 var literin = listin.iterator();
672 while( literin.hasNext()) {
673 rslt.Expect(literin.next() == literout.next(), "literin[i] == literout[i]");
674 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200675
Jens Geyerb5028322014-11-09 02:38:11 +0100676 //set
677 var setout = new IntSet();
678 for (j in -2 ... 3)
679 {
680 setout.add(j);
681 }
682 trace("testSet({");
683 first = true;
684 for( j in setout)
685 {
686 if (first)
687 {
688 first = false;
689 }
690 else
691 {
692 trace(", ");
693 }
694 trace(j);
695 }
696 trace("})");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200697
Jens Geyerb5028322014-11-09 02:38:11 +0100698 var setin = client.testSet(setout);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200699
Jens Geyerb5028322014-11-09 02:38:11 +0100700 trace(" = {");
701 first = true;
702 for( j in setin)
703 {
704 if (first)
705 {
706 first = false;
707 }
708 else
709 {
710 trace(", ");
711 }
712 trace(j);
713 rslt.Expect(setout.contains(j), 'setout.contains($j)');
714 }
715 trace("}");
716 rslt.Expect(setin.size == setout.size, "setin.length == setout.length");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200717
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200718
Jens Geyerb5028322014-11-09 02:38:11 +0100719 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200720
Jens Geyerb5028322014-11-09 02:38:11 +0100721 trace("testEnum(ONE)");
722 var ret = client.testEnum(Numberz.ONE);
723 trace(" = " + ret);
724 rslt.Expect(ret == Numberz.ONE, '$ret == Numberz.ONE');
Jens Geyerfea00ac2014-10-01 02:22:48 +0200725
Jens Geyerb5028322014-11-09 02:38:11 +0100726 trace("testEnum(TWO)");
727 ret = client.testEnum(Numberz.TWO);
728 trace(" = " + ret);
729 rslt.Expect(ret == Numberz.TWO, '$ret == Numberz.TWO');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200730
Jens Geyerb5028322014-11-09 02:38:11 +0100731 trace("testEnum(THREE)");
732 ret = client.testEnum(Numberz.THREE);
733 trace(" = " + ret);
734 rslt.Expect(ret == Numberz.THREE, '$ret == Numberz.THREE');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200735
Jens Geyerb5028322014-11-09 02:38:11 +0100736 trace("testEnum(FIVE)");
737 ret = client.testEnum(Numberz.FIVE);
738 trace(" = " + ret);
739 rslt.Expect(ret == Numberz.FIVE, '$ret == Numberz.FIVE');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200740
Jens Geyerb5028322014-11-09 02:38:11 +0100741 trace("testEnum(EIGHT)");
742 ret = client.testEnum(Numberz.EIGHT);
743 trace(" = " + ret);
744 rslt.Expect(ret == Numberz.EIGHT, '$ret == Numberz.EIGHT');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200745
Jens Geyerb5028322014-11-09 02:38:11 +0100746 trace("testTypedef(309858235082523)");
747 var uid = client.testTypedef( Int64.make( 0x119D0, 0x7E08671B)); // 309858235082523
748 trace(" = " + uid);
749 rslt.Expect( Int64.compare( uid, Int64.make( 0x119D0, 0x7E08671B)) == 0,
750 Int64.toStr(uid)+" == "+Int64.toStr(Int64.make( 0x119D0, 0x7E08671B)));
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200751
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200752
Jens Geyerb5028322014-11-09 02:38:11 +0100753 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_CONTAINERS);
Jens Geyerfea00ac2014-10-01 02:22:48 +0200754
Jens Geyerb5028322014-11-09 02:38:11 +0100755 trace("testMapMap(1)");
756 var mm = client.testMapMap(1);
757 trace(" = {");
758 for( key in mm.keys())
759 {
760 trace(key + " => {");
761 var m2 = mm.get(key);
762 for( k2 in m2.keys())
763 {
764 trace(k2 + " => " + m2.get(k2) + ", ");
765 }
766 trace("}, ");
767 }
768 trace("}");
Jens Geyerfea00ac2014-10-01 02:22:48 +0200769
Jens Geyerb5028322014-11-09 02:38:11 +0100770 var pos = mm.get(4);
771 var neg = mm.get(-4);
772 rslt.Expect( (pos != null) && (neg != null), "(pos != null) && (neg != null)");
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200773 for (i in 1 ... 5) {
Jens Geyerb5028322014-11-09 02:38:11 +0100774 rslt.Expect( pos.get(i) == i, 'pos.get($i) == $i');
775 rslt.Expect( neg.get(-i) == -i, 'neg.get(-$i) == -$i');
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200776 }
777 rslt.Expect( ! pos.exists(0), '!pos.exists(0)');
778 rslt.Expect( ! neg.exists(-0), '!neg.exists(-0)');
779 rslt.Expect( ! pos.exists(42), '!pos.exists(42)');
780 rslt.Expect( ! neg.exists(-42), '!neg.exists(-42)');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200781
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200782
Jens Geyerb5028322014-11-09 02:38:11 +0100783 rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_STRUCTS);
Jens Geyerfea00ac2014-10-01 02:22:48 +0200784
Jens Geyerb5028322014-11-09 02:38:11 +0100785 var insane = new Insanity();
786 insane.userMap = new IntMap< Int64>();
787 insane.userMap.set( Numberz.FIVE, Int64.make(0,5000));
788 var truck = new Xtruct();
789 truck.string_thing = "Truck";
790 truck.byte_thing = 8;
791 truck.i32_thing = 8;
792 truck.i64_thing = Int64.make(0,8);
793 insane.xtructs = new List<Xtruct>();
794 insane.xtructs.add(truck);
795 trace("testInsanity()");
796 var whoa = client.testInsanity(insane);
797 trace(" = {");
798 for( key in whoa.keys())
799 {
800 var val = whoa.get(key);
801 trace(key + " => {");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200802
Jens Geyerb5028322014-11-09 02:38:11 +0100803 for( k2 in val.keys())
804 {
805 var v2 = val.get(k2);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200806
Jens Geyerb5028322014-11-09 02:38:11 +0100807 trace(k2 + " => {");
808 var userMap = v2.userMap;
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200809
Jens Geyerb5028322014-11-09 02:38:11 +0100810 trace("{");
811 if (userMap != null)
812 {
813 for( k3 in userMap.keys())
814 {
815 trace(k3 + " => " + userMap.get(k3) + ", ");
816 }
817 }
818 else
819 {
820 trace("null");
821 }
822 trace("}, ");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200823
Jens Geyerb5028322014-11-09 02:38:11 +0100824 var xtructs = v2.xtructs;
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200825
Jens Geyerb5028322014-11-09 02:38:11 +0100826 trace("{");
827 if (xtructs != null)
828 {
829 for( x in xtructs)
830 {
831 trace("{\"" + x.string_thing + "\", "
832 + x.byte_thing + ", " + x.i32_thing + ", "
833 + x.i32_thing + "}, ");
834 }
835 }
836 else
837 {
838 trace("null");
839 }
840 trace("}");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200841
Jens Geyerb5028322014-11-09 02:38:11 +0100842 trace("}, ");
843 }
844 trace("}, ");
845 }
846 trace("}");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200847
Jens Geyerfea00ac2014-10-01 02:22:48 +0200848
Jens Geyerb5028322014-11-09 02:38:11 +0100849 var first_map = whoa.get(Int64.make(0,1));
850 var second_map = whoa.get(Int64.make(0,2));
851 rslt.Expect( (first_map != null) && (second_map != null), "(first_map != null) && (second_map != null)");
852 if ((first_map != null) && (second_map != null))
853 {
854 var crazy2 = first_map.get(Numberz.TWO);
855 var crazy3 = first_map.get(Numberz.THREE);
856 var looney = second_map.get(Numberz.SIX);
857 rslt.Expect( (crazy2 != null) && (crazy3 != null) && (looney != null),
858 "(crazy2 != null) && (crazy3 != null) && (looney != null)");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200859
Jens Geyerb5028322014-11-09 02:38:11 +0100860 rslt.Expect( Int64.compare( crazy2.userMap.get(Numberz.EIGHT), Int64.make(0,8)) == 0,
861 "crazy2.UserMap.get(Numberz.EIGHT) == 8");
862 rslt.Expect( Int64.compare( crazy3.userMap.get(Numberz.EIGHT), Int64.make(0,8)) == 0,
863 "crazy3.UserMap.get(Numberz.EIGHT) == 8");
864 rslt.Expect( Int64.compare( crazy2.userMap.get(Numberz.FIVE), Int64.make(0,5)) == 0,
865 "crazy2.UserMap.get(Numberz.FIVE) == 5");
866 rslt.Expect( Int64.compare( crazy3.userMap.get(Numberz.FIVE), Int64.make(0,5)) == 0,
867 "crazy3.UserMap.get(Numberz.FIVE) == 5");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200868
Jens Geyerb5028322014-11-09 02:38:11 +0100869 var crz2iter = crazy2.xtructs.iterator();
870 var crz3iter = crazy3.xtructs.iterator();
871 rslt.Expect( crz2iter.hasNext() && crz3iter.hasNext(), "crz2iter.hasNext() && crz3iter.hasNext()");
872 var goodbye2 = crz2iter.next();
873 var goodbye3 = crz3iter.next();
874 rslt.Expect( crz2iter.hasNext() && crz3iter.hasNext(), "crz2iter.hasNext() && crz3iter.hasNext()");
875 var hello2 = crz2iter.next();
876 var hello3 = crz3iter.next();
877 rslt.Expect( ! (crz2iter.hasNext() || crz3iter.hasNext()), "! (crz2iter.hasNext() || crz3iter.hasNext())");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200878
Jens Geyerb5028322014-11-09 02:38:11 +0100879 rslt.Expect( hello2.string_thing == "Hello2", 'hello2.String_thing == "Hello2"');
880 rslt.Expect( hello2.byte_thing == 2, 'hello2.Byte_thing == 2');
881 rslt.Expect( hello2.i32_thing == 2, 'hello2.I32_thing == 2');
882 rslt.Expect( Int64.compare( hello2.i64_thing, Int64.make(0,2)) == 0, 'hello2.I64_thing == 2');
883 rslt.Expect( hello3.string_thing == "Hello2", 'hello3.String_thing == "Hello2"');
884 rslt.Expect( hello3.byte_thing == 2, 'hello3.Byte_thing == 2');
885 rslt.Expect( hello3.i32_thing == 2, 'hello3.I32_thing == 2');
886 rslt.Expect( Int64.compare( hello3.i64_thing, Int64.make(0,2)) == 0, 'hello3.I64_thing == 2');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200887
Jens Geyerb5028322014-11-09 02:38:11 +0100888 rslt.Expect( goodbye2.string_thing == "Goodbye4", 'goodbye2.String_thing == "Goodbye4"');
889 rslt.Expect( goodbye2.byte_thing == 4, 'goodbye2.Byte_thing == 4');
890 rslt.Expect( goodbye2.i32_thing == 4, 'goodbye2.I32_thing == 4');
891 rslt.Expect( Int64.compare( goodbye2.i64_thing, Int64.make(0,4)) == 0, 'goodbye2.I64_thing == 4');
892 rslt.Expect( goodbye3.string_thing == "Goodbye4", 'goodbye3.String_thing == "Goodbye4"');
893 rslt.Expect( goodbye3.byte_thing == 4, 'goodbye3.Byte_thing == 4');
894 rslt.Expect( goodbye3.i32_thing == 4, 'goodbye3.I32_thing == 4');
895 rslt.Expect( Int64.compare( goodbye3.i64_thing, Int64.make(0,4)) == 0, 'goodbye3.I64_thing == 4');
896 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200897
Jens Geyerb5028322014-11-09 02:38:11 +0100898 var arg0 = 1;
899 var arg1 = 2;
900 var arg2 = Int64.make( 0x7FFFFFFF,0xFFFFFFFF);
901 var multiDict = new IntMap< String>();
902 multiDict.set(1, "one");
903 var arg4 = Numberz.FIVE;
904 var arg5 = Int64.make(0,5000000);
905 trace("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + "," + multiDict + "," + arg4 + "," + arg5 + ")");
906 var multiResponse = client.testMulti(arg0, arg1, arg2, multiDict, arg4, arg5);
907 trace(" = Xtruct(byte_thing:" + multiResponse.byte_thing + ",string_thing:" + multiResponse.string_thing
908 + ",i32_thing:" + multiResponse.i32_thing
909 + ",i64_thing:" + Int64.toStr(multiResponse.i64_thing) + ")");
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200910
Jens Geyerb5028322014-11-09 02:38:11 +0100911 rslt.Expect( multiResponse.string_thing == "Hello2", 'multiResponse.String_thing == "Hello2"');
912 rslt.Expect( multiResponse.byte_thing == arg0, 'multiResponse.Byte_thing == arg0');
913 rslt.Expect( multiResponse.i32_thing == arg1, 'multiResponse.I32_thing == arg1');
914 rslt.Expect( Int64.compare( multiResponse.i64_thing, arg2) == 0, 'multiResponse.I64_thing == arg2');
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200915
916
Jens Geyerb5028322014-11-09 02:38:11 +0100917 rslt.StartTestGroup( 0);
Jens Geyerfea00ac2014-10-01 02:22:48 +0200918
Jens Geyerb5028322014-11-09 02:38:11 +0100919 trace("Test Oneway(1)");
920 client.testOneway(1);
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200921
Jens Geyerb5028322014-11-09 02:38:11 +0100922 if( ! args.skipSpeedTest) {
923 trace("Test Calltime()");
924 var difft = Timer.stamp();
925 for ( k in 0 ... 1000) {
926 client.testVoid();
927 }
Jens Geyerbbd6fd72015-05-30 19:33:44 +0200928 difft = Math.round( 1000 * (Timer.stamp() - difft)) / 1000;
Jens Geyerb5028322014-11-09 02:38:11 +0100929 trace('$difft ms per testVoid() call');
930 }
931 }
Jens Geyerbd52f1a2014-07-28 01:25:30 +0200932}