THRIFT-2806 more whitespace fixups
Client: Haxe
Patch: Jens Geyer
This closes #254
diff --git a/test/haxe/src/TestClient.hx b/test/haxe/src/TestClient.hx
index 3c98e6a..3f9158e 100644
--- a/test/haxe/src/TestClient.hx
+++ b/test/haxe/src/TestClient.hx
@@ -43,758 +43,758 @@
class TestResults {
- private var successCnt : Int = 0;
- private var errorCnt : Int = 0;
- private var failedTests : String = "";
- private var print_direct : Bool = false;
-
- public static var EXITCODE_SUCCESS = 0x00; // no errors bits set
- //
- public static var EXITCODE_FAILBIT_BASETYPES = 0x01;
- public static var EXITCODE_FAILBIT_STRUCTS = 0x02;
- public static var EXITCODE_FAILBIT_CONTAINERS = 0x04;
- public static var EXITCODE_FAILBIT_EXCEPTIONS = 0x08;
- //
- public static var EXITCODE_ALL_FAILBITS = 0x0F;
- //
- private var testsExecuted : Int = 0;
- private var testsFailed : Int = 0;
- private var currentTest : Int = 0;
+ private var successCnt : Int = 0;
+ private var errorCnt : Int = 0;
+ private var failedTests : String = "";
+ private var print_direct : Bool = false;
-
- public function new(direct : Bool) {
- print_direct = direct;
- }
-
- public function StartTestGroup( groupBit : Int) : Void {
- currentTest = groupBit;
- testsExecuted |= groupBit;
- }
-
- public function Expect( expr : Bool, msg : String) : Void {
- if ( expr) {
- ++successCnt;
- } else {
- ++errorCnt;
- testsFailed |= currentTest;
- failedTests += "\n " + msg;
- if( print_direct) {
- trace('FAIL: $msg');
- }
- }
- }
+ public static var EXITCODE_SUCCESS = 0x00; // no errors bits set
+ //
+ public static var EXITCODE_FAILBIT_BASETYPES = 0x01;
+ public static var EXITCODE_FAILBIT_STRUCTS = 0x02;
+ public static var EXITCODE_FAILBIT_CONTAINERS = 0x04;
+ public static var EXITCODE_FAILBIT_EXCEPTIONS = 0x08;
+ //
+ public static var EXITCODE_ALL_FAILBITS = 0x0F;
+ //
+ private var testsExecuted : Int = 0;
+ private var testsFailed : Int = 0;
+ private var currentTest : Int = 0;
- public function CalculateExitCode() : Int {
- var notExecuted : Int = EXITCODE_ALL_FAILBITS & (~testsExecuted);
- return testsFailed | notExecuted;
- }
- public function PrintSummary() : Void {
- var total = successCnt + errorCnt;
- var sp = (100 * successCnt) / total;
- var ep = (100 * errorCnt) / total;
-
- trace('===========================');
- trace('Tests executed $total');
- trace('Tests succeeded $successCnt ($sp%)');
- trace('Tests failed $errorCnt ($ep%)');
- if ( errorCnt > 0)
- {
- trace('===========================');
- trace('FAILED TESTS: $failedTests');
- }
- trace('===========================');
- }
+ public function new(direct : Bool) {
+ print_direct = direct;
+ }
+
+ public function StartTestGroup( groupBit : Int) : Void {
+ currentTest = groupBit;
+ testsExecuted |= groupBit;
+ }
+
+ public function Expect( expr : Bool, msg : String) : Void {
+ if ( expr) {
+ ++successCnt;
+ } else {
+ ++errorCnt;
+ testsFailed |= currentTest;
+ failedTests += "\n " + msg;
+ if( print_direct) {
+ trace('FAIL: $msg');
+ }
+ }
+ }
+
+ public function CalculateExitCode() : Int {
+ var notExecuted : Int = EXITCODE_ALL_FAILBITS & (~testsExecuted);
+ return testsFailed | notExecuted;
+ }
+
+ public function PrintSummary() : Void {
+ var total = successCnt + errorCnt;
+ var sp = (100 * successCnt) / total;
+ var ep = (100 * errorCnt) / total;
+
+ trace('===========================');
+ trace('Tests executed $total');
+ trace('Tests succeeded $successCnt ($sp%)');
+ trace('Tests failed $errorCnt ($ep%)');
+ if ( errorCnt > 0)
+ {
+ trace('===========================');
+ trace('FAILED TESTS: $failedTests');
+ }
+ trace('===========================');
+ }
}
class TestClient {
- public static function Execute(args : Arguments) : Void
- {
- var exitCode = 0xFF;
- try
- {
- var difft = Timer.stamp();
-
- if( args.numThreads > 1) {
- var threads = new List<Thread>();
- for( test in 0 ... args.numThreads) {
- threads.add( StartThread( args));
- }
- exitCode = 0;
- for( thread in threads) {
- exitCode |= Thread.readMessage(true);
- }
- } else {
- var rslt = new TestResults(true);
- RunClient(args,rslt);
- rslt.PrintSummary();
- exitCode = rslt.CalculateExitCode();
- }
+ public static function Execute(args : Arguments) : Void
+ {
+ var exitCode = 0xFF;
+ try
+ {
+ var difft = Timer.stamp();
- difft = Timer.stamp() - difft;
- trace('total test time: $difft seconds');
- }
- catch (e : TException)
- {
- trace('$e');
- exitCode = 0xFF;
- }
- catch (e : Dynamic)
- {
- trace('$e');
- exitCode = 0xFF;
- }
-
- #if sys
- Sys.exit( exitCode);
- #end
- }
+ if( args.numThreads > 1) {
+ var threads = new List<Thread>();
+ for( test in 0 ... args.numThreads) {
+ threads.add( StartThread( args));
+ }
+ exitCode = 0;
+ for( thread in threads) {
+ exitCode |= Thread.readMessage(true);
+ }
+ } else {
+ var rslt = new TestResults(true);
+ RunClient(args,rslt);
+ rslt.PrintSummary();
+ exitCode = rslt.CalculateExitCode();
+ }
-
- private static function StartThread(args : Arguments) : Thread {
- var thread = Thread.create(
- function() : Void {
- var rslt = new TestResults(false);
- var main : Thread = Thread.readMessage(true);
- try
- {
- RunClient(args,rslt);
- }
- catch (e : TException)
- {
- rslt.Expect( false, '$e');
- trace('$e');
- }
- catch (e : Dynamic)
- {
- rslt.Expect( false, '$e');
- trace('$e');
- }
- main.sendMessage( rslt.CalculateExitCode());
- });
-
- thread.sendMessage(Thread.current());
- return thread;
- }
+ difft = Timer.stamp() - difft;
+ trace('total test time: $difft seconds');
+ }
+ catch (e : TException)
+ {
+ trace('$e');
+ exitCode = 0xFF;
+ }
+ catch (e : Dynamic)
+ {
+ trace('$e');
+ exitCode = 0xFF;
+ }
-
- public static function RunClient(args : Arguments, rslt : TestResults)
- {
- var transport : TTransport = null;
- switch (args.transport)
- {
- case socket:
- transport = new TSocket(args.host, args.port);
- case http:
- transport = new THttpClient(args.host);
- default:
- throw "Unhandled transport";
- }
+ #if sys
+ Sys.exit( exitCode);
+ #end
+ }
- // optional: layered transport
- if ( args.framed) {
- trace("- framed transport");
- transport = new TFramedTransport(transport);
- }
- if ( args.buffered) {
- trace("- buffered transport");
- throw "TBufferedTransport not implemented yet";
- //transport = new TBufferedTransport(transport);
- }
- // protocol
- var protocol : TProtocol = null;
- switch( args.protocol)
- {
- case binary:
- trace("- binary protocol");
- protocol = new TBinaryProtocol(transport);
- case json:
- trace("- json protocol");
- protocol = new TJSONProtocol(transport);
- default:
- throw "Unhandled protocol";
- }
+ private static function StartThread(args : Arguments) : Thread {
+ var thread = Thread.create(
+ function() : Void {
+ var rslt = new TestResults(false);
+ var main : Thread = Thread.readMessage(true);
+ try
+ {
+ RunClient(args,rslt);
+ }
+ catch (e : TException)
+ {
+ rslt.Expect( false, '$e');
+ trace('$e');
+ }
+ catch (e : Dynamic)
+ {
+ rslt.Expect( false, '$e');
+ trace('$e');
+ }
+ main.sendMessage( rslt.CalculateExitCode());
+ });
+ thread.sendMessage(Thread.current());
+ return thread;
+ }
- // run the test code
- HaxeBasicsTest( args, rslt);
- for( i in 0 ... args.numIterations) {
- ClientTest( transport, protocol, args, rslt);
- }
- }
+ public static function RunClient(args : Arguments, rslt : TestResults)
+ {
+ var transport : TTransport = null;
+ switch (args.transport)
+ {
+ case socket:
+ transport = new TSocket(args.host, args.port);
+ case http:
+ transport = new THttpClient(args.host);
+ default:
+ throw "Unhandled transport";
+ }
- public static function HaxeBasicsTest( args : Arguments, rslt : TestResults) : Void
- {
- // We need to test a few basic things used in the ClientTest
- // Anything else beyond this scope should go into /lib/haxe/ instead
- rslt.StartTestGroup( 0);
-
- var map32 = new IntMap<Int32>();
- var map64 = new Int64Map<Int32>();
+ // optional: layered transport
+ if ( args.framed) {
+ trace("- framed transport");
+ transport = new TFramedTransport(transport);
+ }
+ if ( args.buffered) {
+ trace("- buffered transport");
+ throw "TBufferedTransport not implemented yet";
+ //transport = new TBufferedTransport(transport);
+ }
- rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #1");
- rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #2");
- rslt.Expect( map32.remove( 4711) == map64.remove( Int64.make(47,11)), "Int64Map<Int32> Test #3");
- rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #4");
-
- map32.set( 42, 815);
- map64.set( Int64.make(0,42), 815);
- map32.set( -517, 23);
- map64.set( Int64.make(-5,17), 23);
- map32.set( 0, -123);
- map64.set( Int64.make(0,0), -123);
+ // protocol
+ var protocol : TProtocol = null;
+ switch( args.protocol)
+ {
+ case binary:
+ trace("- binary protocol");
+ protocol = new TBinaryProtocol(transport);
+ case json:
+ trace("- json protocol");
+ protocol = new TJSONProtocol(transport);
+ default:
+ throw "Unhandled protocol";
+ }
- rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #10");
- rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #11");
- rslt.Expect( map32.exists( -517) == map64.exists( Int64.make(-5,17)), "Int64Map<Int32> Test #12");
- rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #13");
- rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #14");
- rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #15");
- rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #16");
- rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #Int64.make(-5,17)");
- rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #18");
- rslt.Expect( map32.remove( 4711) == map64.remove( Int64.make(47,11)), "Int64Map<Int32> Test #19");
- rslt.Expect( map32.remove( -517) == map64.remove( Int64.make(-5,17)), "Int64Map<Int32> Test #20");
- rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #21");
- rslt.Expect( map32.exists( -517) == map64.exists( Int64.make(-5,17)), "Int64Map<Int32> Test #22");
- rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #23");
- rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #24");
- rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #25");
- rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #26");
- rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #27");
- rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #28");
- map32.set( 42, 1);
- map64.set( Int64.make(0,42), 1);
- map32.set( -517, -2);
- map64.set( Int64.make(-5,17), -2);
- map32.set( 0, 3);
- map64.set( Int64.make(0,0), 3);
+ // run the test code
+ HaxeBasicsTest( args, rslt);
+ for( i in 0 ... args.numIterations) {
+ ClientTest( transport, protocol, args, rslt);
+ }
+ }
- var c32 = 0;
- for (key in map32.keys()) {
- ++c32;
- }
- var c64 = 0;
- for (key in map64.keys()) {
- ++c64;
- }
- rslt.Expect( c32 == c64, "Int64Map<Int32> Test #30");
- var s32 = map32.toString();
- var s64 = map64.toString();
- trace("Int64Map<Int32>.toString(): " + ' ("$s32" == "$s64")');
+ public static function HaxeBasicsTest( args : Arguments, rslt : TestResults) : Void
+ {
+ // We need to test a few basic things used in the ClientTest
+ // Anything else beyond this scope should go into /lib/haxe/ instead
+ rslt.StartTestGroup( 0);
- map32.remove( 42);
- map64.remove( Int64.make(0,42));
- map32.remove( -517);
- map64.remove( Int64.make(-5,17));
- map32.remove( 0);
- map64.remove( Int64.make(0,0));
-
- rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #90");
- rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #91");
- rslt.Expect( map32.exists( -517) == map64.exists( Int64.make(-5,17)), "Int64Map<Int32> Test #92");
- rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #93");
- rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #94");
- rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #95");
- rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #96");
- rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #97");
- rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #98");
- }
+ var map32 = new IntMap<Int32>();
+ var map64 = new Int64Map<Int32>();
+ rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #1");
+ rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #2");
+ rslt.Expect( map32.remove( 4711) == map64.remove( Int64.make(47,11)), "Int64Map<Int32> Test #3");
+ rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #4");
- public static function ClientTest( transport : TTransport, protocol : TProtocol,
- args : Arguments, rslt : TestResults) : Void
- {
- var client = new ThriftTestImpl(protocol,protocol);
- try
- {
- if (!transport.isOpen())
- {
- transport.open();
- }
- }
- catch (e : TException)
- {
- trace('$e');
- return;
- }
- catch (e : Dynamic)
- {
- trace('$e');
- return;
- }
+ map32.set( 42, 815);
+ map64.set( Int64.make(0,42), 815);
+ map32.set( -517, 23);
+ map64.set( Int64.make(-5,17), 23);
+ map32.set( 0, -123);
+ map64.set( Int64.make(0,0), -123);
- var start = Date.now();
+ rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #10");
+ rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #11");
+ rslt.Expect( map32.exists( -517) == map64.exists( Int64.make(-5,17)), "Int64Map<Int32> Test #12");
+ rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #13");
+ rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #14");
+ rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #15");
+ rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #16");
+ rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #Int64.make(-5,17)");
+ rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #18");
+ rslt.Expect( map32.remove( 4711) == map64.remove( Int64.make(47,11)), "Int64Map<Int32> Test #19");
+ rslt.Expect( map32.remove( -517) == map64.remove( Int64.make(-5,17)), "Int64Map<Int32> Test #20");
+ rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #21");
+ rslt.Expect( map32.exists( -517) == map64.exists( Int64.make(-5,17)), "Int64Map<Int32> Test #22");
+ rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #23");
+ rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #24");
+ rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #25");
+ rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #26");
+ rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #27");
+ rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #28");
- rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_EXCEPTIONS);
-
- // if arg == "Xception" throw Xception with errorCode = 1001 and message = arg
- trace('testException("Xception")');
- try {
- client.testException("Xception");
- rslt.Expect( false, 'testException("Xception") should throw');
- }
- catch (e : Xception)
- {
- rslt.Expect( e.message == "Xception", 'testException("Xception") - e.message == "Xception"');
- rslt.Expect( e.errorCode == 1001, 'testException("Xception") - e.errorCode == 1001');
- }
- catch (e : Dynamic)
- {
- rslt.Expect( false, 'testException("Xception") - $e');
- }
-
- // if arg == "TException" throw TException
- trace('testException("TException")');
- try {
- client.testException("TException");
- rslt.Expect( false, 'testException("TException") should throw');
- }
- catch (e : TException)
- {
- rslt.Expect( true, 'testException("TException") - $e');
- }
- catch (e : Dynamic)
- {
- rslt.Expect( false, 'testException("TException") - $e');
- }
-
- // else do not throw anything
- trace('testException("bla")');
- try {
- client.testException("bla");
- rslt.Expect( true, 'testException("bla") should not throw');
- }
- catch (e : Dynamic)
- {
- rslt.Expect( false, 'testException("bla") - $e');
- }
-
-
+ map32.set( 42, 1);
+ map64.set( Int64.make(0,42), 1);
+ map32.set( -517, -2);
+ map64.set( Int64.make(-5,17), -2);
+ map32.set( 0, 3);
+ map64.set( Int64.make(0,0), 3);
- rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
-
- trace('testVoid()');
- client.testVoid();
- trace(' = void');
- rslt.Expect(true,"testVoid()"); // bump counter
+ var c32 = 0;
+ for (key in map32.keys()) {
+ ++c32;
+ }
+ var c64 = 0;
+ for (key in map64.keys()) {
+ ++c64;
+ }
+ rslt.Expect( c32 == c64, "Int64Map<Int32> Test #30");
- trace('testString("Test")');
- var s = client.testString("Test");
- trace(' = "$s"');
- rslt.Expect(s == "Test", '$s == "Test"');
+ var s32 = map32.toString();
+ var s64 = map64.toString();
+ trace("Int64Map<Int32>.toString(): " + ' ("$s32" == "$s64")');
- trace('testByte(1)');
- var i8 = client.testByte(1);
- trace(' = $i8');
- rslt.Expect(i8 == 1, '$i8 == 1');
+ map32.remove( 42);
+ map64.remove( Int64.make(0,42));
+ map32.remove( -517);
+ map64.remove( Int64.make(-5,17));
+ map32.remove( 0);
+ map64.remove( Int64.make(0,0));
- trace('testI32(-1)');
- var i32 = client.testI32(-1);
- trace(' = $i32');
- rslt.Expect(i32 == -1, '$i32 == -1');
+ rslt.Expect( map32.keys().hasNext() == map64.keys().hasNext(), "Int64Map<Int32> Test #90");
+ rslt.Expect( map32.exists( 4711) == map64.exists( Int64.make(47,11)), "Int64Map<Int32> Test #91");
+ rslt.Expect( map32.exists( -517) == map64.exists( Int64.make(-5,17)), "Int64Map<Int32> Test #92");
+ rslt.Expect( map32.exists( 42) == map64.exists( Int64.make(0,42)), "Int64Map<Int32> Test #93");
+ rslt.Expect( map32.exists( 0) == map64.exists( Int64.make(0,0)), "Int64Map<Int32> Test #94");
+ rslt.Expect( map32.get( 4711) == map64.get( Int64.make(47,11)), "Int64Map<Int32> Test #95");
+ rslt.Expect( map32.get( -517) == map64.get( Int64.make(-5,17)), "Int64Map<Int32> Test #96");
+ rslt.Expect( map32.get( 42) == map64.get( Int64.make(0,42)), "Int64Map<Int32> Test #97");
+ rslt.Expect( map32.get( 0) == map64.get( Int64.make(0,0)), "Int64Map<Int32> Test #98");
+ }
- trace('testI64(-34359738368)');
- var i64 = client.testI64( Int64.make( 0xFFFFFFF8, 0x00000000)); // -34359738368
- trace(' = $i64');
- rslt.Expect( Int64.compare( i64, Int64.make( 0xFFFFFFF8, 0x00000000)) == 0,
- Int64.toStr(i64) +" == "+Int64.toStr(Int64.make( 0xFFFFFFF8, 0x00000000)));
- // edge case: the largest negative Int64 has no positive Int64 equivalent
- trace('testI64(-9223372036854775808)');
- i64 = client.testI64( Int64.make( 0x80000000, 0x00000000)); // -9223372036854775808
- trace(' = $i64');
- rslt.Expect( Int64.compare( i64, Int64.make( 0x80000000, 0x00000000)) == 0,
- Int64.toStr(i64) +" == "+Int64.toStr(Int64.make( 0x80000000, 0x00000000)));
+ public static function ClientTest( transport : TTransport, protocol : TProtocol,
+ args : Arguments, rslt : TestResults) : Void
+ {
+ var client = new ThriftTestImpl(protocol,protocol);
+ try
+ {
+ if (!transport.isOpen())
+ {
+ transport.open();
+ }
+ }
+ catch (e : TException)
+ {
+ trace('$e');
+ return;
+ }
+ catch (e : Dynamic)
+ {
+ trace('$e');
+ return;
+ }
- trace('testDouble(5.325098235)');
- var dub = client.testDouble(5.325098235);
- trace(' = $dub');
- rslt.Expect(dub == 5.325098235, '$dub == 5.325098235');
+ var start = Date.now();
+
+ rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_EXCEPTIONS);
+
+ // if arg == "Xception" throw Xception with errorCode = 1001 and message = arg
+ trace('testException("Xception")');
+ try {
+ client.testException("Xception");
+ rslt.Expect( false, 'testException("Xception") should throw');
+ }
+ catch (e : Xception)
+ {
+ rslt.Expect( e.message == "Xception", 'testException("Xception") - e.message == "Xception"');
+ rslt.Expect( e.errorCode == 1001, 'testException("Xception") - e.errorCode == 1001');
+ }
+ catch (e : Dynamic)
+ {
+ rslt.Expect( false, 'testException("Xception") - $e');
+ }
+
+ // if arg == "TException" throw TException
+ trace('testException("TException")');
+ try {
+ client.testException("TException");
+ rslt.Expect( false, 'testException("TException") should throw');
+ }
+ catch (e : TException)
+ {
+ rslt.Expect( true, 'testException("TException") - $e');
+ }
+ catch (e : Dynamic)
+ {
+ rslt.Expect( false, 'testException("TException") - $e');
+ }
+
+ // else do not throw anything
+ trace('testException("bla")');
+ try {
+ client.testException("bla");
+ rslt.Expect( true, 'testException("bla") should not throw');
+ }
+ catch (e : Dynamic)
+ {
+ rslt.Expect( false, 'testException("bla") - $e');
+ }
+
+
+
+ rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
+
+ trace('testVoid()');
+ client.testVoid();
+ trace(' = void');
+ rslt.Expect(true,"testVoid()"); // bump counter
+
+ trace('testString("Test")');
+ var s = client.testString("Test");
+ trace(' = "$s"');
+ rslt.Expect(s == "Test", '$s == "Test"');
+
+ trace('testByte(1)');
+ var i8 = client.testByte(1);
+ trace(' = $i8');
+ rslt.Expect(i8 == 1, '$i8 == 1');
+
+ trace('testI32(-1)');
+ var i32 = client.testI32(-1);
+ trace(' = $i32');
+ rslt.Expect(i32 == -1, '$i32 == -1');
+
+ trace('testI64(-34359738368)');
+ var i64 = client.testI64( Int64.make( 0xFFFFFFF8, 0x00000000)); // -34359738368
+ trace(' = $i64');
+ rslt.Expect( Int64.compare( i64, Int64.make( 0xFFFFFFF8, 0x00000000)) == 0,
+ Int64.toStr(i64) +" == "+Int64.toStr(Int64.make( 0xFFFFFFF8, 0x00000000)));
+
+ // edge case: the largest negative Int64 has no positive Int64 equivalent
+ trace('testI64(-9223372036854775808)');
+ i64 = client.testI64( Int64.make( 0x80000000, 0x00000000)); // -9223372036854775808
+ trace(' = $i64');
+ rslt.Expect( Int64.compare( i64, Int64.make( 0x80000000, 0x00000000)) == 0,
+ Int64.toStr(i64) +" == "+Int64.toStr(Int64.make( 0x80000000, 0x00000000)));
+
+ trace('testDouble(5.325098235)');
+ var dub = client.testDouble(5.325098235);
+ trace(' = $dub');
+ rslt.Expect(dub == 5.325098235, '$dub == 5.325098235');
+
+
+ rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_STRUCTS);
+
+ trace('testStruct({"Zero", 1, -3, -5})');
+ var o = new Xtruct();
+ o.string_thing = "Zero";
+ o.byte_thing = 1;
+ o.i32_thing = -3;
+ o.i64_thing = Int64.make(0,-5);
+ var i = client.testStruct(o);
+ trace(' = {"' + i.string_thing + '", ' + i.byte_thing +', '
+ + i.i32_thing +', '+ Int64.toStr(i.i64_thing) + '}');
+ rslt.Expect( i.string_thing == o.string_thing, "i.string_thing == o.string_thing");
+ rslt.Expect( i.byte_thing == o.byte_thing, "i.byte_thing == o.byte_thing");
+ rslt.Expect( i.i32_thing == o.i32_thing, "i.i64_thing == o.i64_thing");
+ rslt.Expect( i.i32_thing == o.i32_thing, "i.i64_thing == o.i64_thing");
+
+ trace('testNest({1, {\"Zero\", 1, -3, -5}, 5})');
+ var o2 = new Xtruct2();
+ o2.byte_thing = 1;
+ o2.struct_thing = o;
+ o2.i32_thing = 5;
+ var i2 = client.testNest(o2);
+ i = i2.struct_thing;
+ trace(" = {" + i2.byte_thing + ", {\"" + i.string_thing + "\", "
+ + i.byte_thing + ", " + i.i32_thing + ", " + Int64.toStr(i.i64_thing) + "}, "
+ + i2.i32_thing + "}");
+ rslt.Expect( i2.byte_thing == o2.byte_thing, "i2.byte_thing == o2.byte_thing");
+ rslt.Expect( i2.i32_thing == o2.i32_thing, "i2.i32_thing == o2.i32_thing");
+ rslt.Expect( i.string_thing == o.string_thing, "i.string_thing == o.string_thing");
+ rslt.Expect( i.byte_thing == o.byte_thing, "i.byte_thing == o.byte_thing");
+ rslt.Expect( i.i32_thing == o.i32_thing, "i.i32_thing == o.i32_thing");
+ rslt.Expect( Int64.compare( i.i64_thing, o.i64_thing) == 0, "i.i64_thing == o.i64_thing");
+
+
+ rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_CONTAINERS);
+
+ var mapout = new IntMap< haxe.Int32>();
+ for ( j in 0 ... 5)
+ {
+ mapout.set(j, j - 10);
+ }
+ trace("testMap({");
+ var first : Bool = true;
+ for( key in mapout.keys())
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ trace(", ");
+ }
+ trace(key + " => " + mapout.get(key));
+ }
+ trace("})");
-
- rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_STRUCTS);
-
- trace('testStruct({"Zero", 1, -3, -5})');
- var o = new Xtruct();
- o.string_thing = "Zero";
- o.byte_thing = 1;
- o.i32_thing = -3;
- o.i64_thing = Int64.make(0,-5);
- var i = client.testStruct(o);
- trace(' = {"' + i.string_thing + '", ' + i.byte_thing +', '
- + i.i32_thing +', '+ Int64.toStr(i.i64_thing) + '}');
- rslt.Expect( i.string_thing == o.string_thing, "i.string_thing == o.string_thing");
- rslt.Expect( i.byte_thing == o.byte_thing, "i.byte_thing == o.byte_thing");
- rslt.Expect( i.i32_thing == o.i32_thing, "i.i64_thing == o.i64_thing");
- rslt.Expect( i.i32_thing == o.i32_thing, "i.i64_thing == o.i64_thing");
+ var mapin = client.testMap(mapout);
- trace('testNest({1, {\"Zero\", 1, -3, -5}, 5})');
- var o2 = new Xtruct2();
- o2.byte_thing = 1;
- o2.struct_thing = o;
- o2.i32_thing = 5;
- var i2 = client.testNest(o2);
- i = i2.struct_thing;
- trace(" = {" + i2.byte_thing + ", {\"" + i.string_thing + "\", "
- + i.byte_thing + ", " + i.i32_thing + ", " + Int64.toStr(i.i64_thing) + "}, "
- + i2.i32_thing + "}");
- rslt.Expect( i2.byte_thing == o2.byte_thing, "i2.byte_thing == o2.byte_thing");
- rslt.Expect( i2.i32_thing == o2.i32_thing, "i2.i32_thing == o2.i32_thing");
- rslt.Expect( i.string_thing == o.string_thing, "i.string_thing == o.string_thing");
- rslt.Expect( i.byte_thing == o.byte_thing, "i.byte_thing == o.byte_thing");
- rslt.Expect( i.i32_thing == o.i32_thing, "i.i32_thing == o.i32_thing");
- rslt.Expect( Int64.compare( i.i64_thing, o.i64_thing) == 0, "i.i64_thing == o.i64_thing");
+ trace(" = {");
+ first = true;
+ for( key in mapin.keys())
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ trace(", ");
+ }
+ trace(key + " => " + mapin.get(key));
+ rslt.Expect( mapin.get(key) == mapout.get(key), ' mapin.get($key) == mapout.get($key)');
+ }
+ trace("}");
+ for( key in mapout.keys())
+ {
+ rslt.Expect(mapin.exists(key), 'mapin.exists($key)');
+ }
-
- rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_CONTAINERS);
-
- var mapout = new IntMap< haxe.Int32>();
- for ( j in 0 ... 5)
- {
- mapout.set(j, j - 10);
- }
- trace("testMap({");
- var first : Bool = true;
- for( key in mapout.keys())
- {
- if (first)
- {
- first = false;
- }
- else
- {
- trace(", ");
- }
- trace(key + " => " + mapout.get(key));
- }
- trace("})");
+ var listout = new List<Int>();
+ for (j in -2 ... 3)
+ {
+ listout.add(j);
+ }
+ trace("testList({");
+ first = true;
+ for( j in listout)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ trace(", ");
+ }
+ trace(j);
+ }
+ trace("})");
- var mapin = client.testMap(mapout);
+ var listin = client.testList(listout);
- trace(" = {");
- first = true;
- for( key in mapin.keys())
- {
- if (first)
- {
- first = false;
- }
- else
- {
- trace(", ");
- }
- trace(key + " => " + mapin.get(key));
- rslt.Expect( mapin.get(key) == mapout.get(key), ' mapin.get($key) == mapout.get($key)');
- }
- trace("}");
- for( key in mapout.keys())
- {
- rslt.Expect(mapin.exists(key), 'mapin.exists($key)');
- }
+ trace(" = {");
+ first = true;
+ for( j in listin)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ trace(", ");
+ }
+ trace(j);
+ }
+ trace("}");
- var listout = new List<Int>();
- for (j in -2 ... 3)
- {
- listout.add(j);
- }
- trace("testList({");
- first = true;
- for( j in listout)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- trace(", ");
- }
- trace(j);
- }
- trace("})");
+ rslt.Expect(listin.length == listout.length, "listin.length == listout.length");
+ var literout = listout.iterator();
+ var literin = listin.iterator();
+ while( literin.hasNext()) {
+ rslt.Expect(literin.next() == literout.next(), "literin[i] == literout[i]");
+ }
- var listin = client.testList(listout);
+ //set
+ var setout = new IntSet();
+ for (j in -2 ... 3)
+ {
+ setout.add(j);
+ }
+ trace("testSet({");
+ first = true;
+ for( j in setout)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ trace(", ");
+ }
+ trace(j);
+ }
+ trace("})");
- trace(" = {");
- first = true;
- for( j in listin)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- trace(", ");
- }
- trace(j);
- }
- trace("}");
+ var setin = client.testSet(setout);
- rslt.Expect(listin.length == listout.length, "listin.length == listout.length");
- var literout = listout.iterator();
- var literin = listin.iterator();
- while( literin.hasNext()) {
- rslt.Expect(literin.next() == literout.next(), "literin[i] == literout[i]");
- }
-
- //set
- var setout = new IntSet();
- for (j in -2 ... 3)
- {
- setout.add(j);
- }
- trace("testSet({");
- first = true;
- for( j in setout)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- trace(", ");
- }
- trace(j);
- }
- trace("})");
+ trace(" = {");
+ first = true;
+ for( j in setin)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ trace(", ");
+ }
+ trace(j);
+ rslt.Expect(setout.contains(j), 'setout.contains($j)');
+ }
+ trace("}");
+ rslt.Expect(setin.size == setout.size, "setin.length == setout.length");
- var setin = client.testSet(setout);
- trace(" = {");
- first = true;
- for( j in setin)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- trace(", ");
- }
- trace(j);
- rslt.Expect(setout.contains(j), 'setout.contains($j)');
- }
- trace("}");
- rslt.Expect(setin.size == setout.size, "setin.length == setout.length");
-
+ rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
- rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_BASETYPES);
+ trace("testEnum(ONE)");
+ var ret = client.testEnum(Numberz.ONE);
+ trace(" = " + ret);
+ rslt.Expect(ret == Numberz.ONE, '$ret == Numberz.ONE');
- trace("testEnum(ONE)");
- var ret = client.testEnum(Numberz.ONE);
- trace(" = " + ret);
- rslt.Expect(ret == Numberz.ONE, '$ret == Numberz.ONE');
+ trace("testEnum(TWO)");
+ ret = client.testEnum(Numberz.TWO);
+ trace(" = " + ret);
+ rslt.Expect(ret == Numberz.TWO, '$ret == Numberz.TWO');
- trace("testEnum(TWO)");
- ret = client.testEnum(Numberz.TWO);
- trace(" = " + ret);
- rslt.Expect(ret == Numberz.TWO, '$ret == Numberz.TWO');
+ trace("testEnum(THREE)");
+ ret = client.testEnum(Numberz.THREE);
+ trace(" = " + ret);
+ rslt.Expect(ret == Numberz.THREE, '$ret == Numberz.THREE');
- trace("testEnum(THREE)");
- ret = client.testEnum(Numberz.THREE);
- trace(" = " + ret);
- rslt.Expect(ret == Numberz.THREE, '$ret == Numberz.THREE');
+ trace("testEnum(FIVE)");
+ ret = client.testEnum(Numberz.FIVE);
+ trace(" = " + ret);
+ rslt.Expect(ret == Numberz.FIVE, '$ret == Numberz.FIVE');
- trace("testEnum(FIVE)");
- ret = client.testEnum(Numberz.FIVE);
- trace(" = " + ret);
- rslt.Expect(ret == Numberz.FIVE, '$ret == Numberz.FIVE');
+ trace("testEnum(EIGHT)");
+ ret = client.testEnum(Numberz.EIGHT);
+ trace(" = " + ret);
+ rslt.Expect(ret == Numberz.EIGHT, '$ret == Numberz.EIGHT');
- trace("testEnum(EIGHT)");
- ret = client.testEnum(Numberz.EIGHT);
- trace(" = " + ret);
- rslt.Expect(ret == Numberz.EIGHT, '$ret == Numberz.EIGHT');
+ trace("testTypedef(309858235082523)");
+ var uid = client.testTypedef( Int64.make( 0x119D0, 0x7E08671B)); // 309858235082523
+ trace(" = " + uid);
+ rslt.Expect( Int64.compare( uid, Int64.make( 0x119D0, 0x7E08671B)) == 0,
+ Int64.toStr(uid)+" == "+Int64.toStr(Int64.make( 0x119D0, 0x7E08671B)));
- trace("testTypedef(309858235082523)");
- var uid = client.testTypedef( Int64.make( 0x119D0, 0x7E08671B)); // 309858235082523
- trace(" = " + uid);
- rslt.Expect( Int64.compare( uid, Int64.make( 0x119D0, 0x7E08671B)) == 0,
- Int64.toStr(uid)+" == "+Int64.toStr(Int64.make( 0x119D0, 0x7E08671B)));
+ rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_CONTAINERS);
- rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_CONTAINERS);
+ trace("testMapMap(1)");
+ var mm = client.testMapMap(1);
+ trace(" = {");
+ for( key in mm.keys())
+ {
+ trace(key + " => {");
+ var m2 = mm.get(key);
+ for( k2 in m2.keys())
+ {
+ trace(k2 + " => " + m2.get(k2) + ", ");
+ }
+ trace("}, ");
+ }
+ trace("}");
- trace("testMapMap(1)");
- var mm = client.testMapMap(1);
- trace(" = {");
- for( key in mm.keys())
- {
- trace(key + " => {");
- var m2 = mm.get(key);
- for( k2 in m2.keys())
- {
- trace(k2 + " => " + m2.get(k2) + ", ");
- }
- trace("}, ");
- }
- trace("}");
+ var pos = mm.get(4);
+ var neg = mm.get(-4);
+ rslt.Expect( (pos != null) && (neg != null), "(pos != null) && (neg != null)");
+ for (i in 0 ... 5) {
+ rslt.Expect( pos.get(i) == i, 'pos.get($i) == $i');
+ rslt.Expect( neg.get(-i) == -i, 'neg.get(-$i) == -$i');
+ }
- var pos = mm.get(4);
- var neg = mm.get(-4);
- rslt.Expect( (pos != null) && (neg != null), "(pos != null) && (neg != null)");
- for (i in 0 ... 5) {
- rslt.Expect( pos.get(i) == i, 'pos.get($i) == $i');
- rslt.Expect( neg.get(-i) == -i, 'neg.get(-$i) == -$i');
- }
-
- rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_STRUCTS);
+ rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_STRUCTS);
- var insane = new Insanity();
- insane.userMap = new IntMap< Int64>();
- insane.userMap.set( Numberz.FIVE, Int64.make(0,5000));
- var truck = new Xtruct();
- truck.string_thing = "Truck";
- truck.byte_thing = 8;
- truck.i32_thing = 8;
- truck.i64_thing = Int64.make(0,8);
- insane.xtructs = new List<Xtruct>();
- insane.xtructs.add(truck);
- trace("testInsanity()");
- var whoa = client.testInsanity(insane);
- trace(" = {");
- for( key in whoa.keys())
- {
- var val = whoa.get(key);
- trace(key + " => {");
+ var insane = new Insanity();
+ insane.userMap = new IntMap< Int64>();
+ insane.userMap.set( Numberz.FIVE, Int64.make(0,5000));
+ var truck = new Xtruct();
+ truck.string_thing = "Truck";
+ truck.byte_thing = 8;
+ truck.i32_thing = 8;
+ truck.i64_thing = Int64.make(0,8);
+ insane.xtructs = new List<Xtruct>();
+ insane.xtructs.add(truck);
+ trace("testInsanity()");
+ var whoa = client.testInsanity(insane);
+ trace(" = {");
+ for( key in whoa.keys())
+ {
+ var val = whoa.get(key);
+ trace(key + " => {");
- for( k2 in val.keys())
- {
- var v2 = val.get(k2);
+ for( k2 in val.keys())
+ {
+ var v2 = val.get(k2);
- trace(k2 + " => {");
- var userMap = v2.userMap;
+ trace(k2 + " => {");
+ var userMap = v2.userMap;
- trace("{");
- if (userMap != null)
- {
- for( k3 in userMap.keys())
- {
- trace(k3 + " => " + userMap.get(k3) + ", ");
- }
- }
- else
- {
- trace("null");
- }
- trace("}, ");
+ trace("{");
+ if (userMap != null)
+ {
+ for( k3 in userMap.keys())
+ {
+ trace(k3 + " => " + userMap.get(k3) + ", ");
+ }
+ }
+ else
+ {
+ trace("null");
+ }
+ trace("}, ");
- var xtructs = v2.xtructs;
+ var xtructs = v2.xtructs;
- trace("{");
- if (xtructs != null)
- {
- for( x in xtructs)
- {
- trace("{\"" + x.string_thing + "\", "
- + x.byte_thing + ", " + x.i32_thing + ", "
- + x.i32_thing + "}, ");
- }
- }
- else
- {
- trace("null");
- }
- trace("}");
+ trace("{");
+ if (xtructs != null)
+ {
+ for( x in xtructs)
+ {
+ trace("{\"" + x.string_thing + "\", "
+ + x.byte_thing + ", " + x.i32_thing + ", "
+ + x.i32_thing + "}, ");
+ }
+ }
+ else
+ {
+ trace("null");
+ }
+ trace("}");
- trace("}, ");
- }
- trace("}, ");
- }
- trace("}");
+ trace("}, ");
+ }
+ trace("}, ");
+ }
+ trace("}");
- var first_map = whoa.get(Int64.make(0,1));
- var second_map = whoa.get(Int64.make(0,2));
- rslt.Expect( (first_map != null) && (second_map != null), "(first_map != null) && (second_map != null)");
- if ((first_map != null) && (second_map != null))
- {
- var crazy2 = first_map.get(Numberz.TWO);
- var crazy3 = first_map.get(Numberz.THREE);
- var looney = second_map.get(Numberz.SIX);
- rslt.Expect( (crazy2 != null) && (crazy3 != null) && (looney != null),
- "(crazy2 != null) && (crazy3 != null) && (looney != null)");
+ var first_map = whoa.get(Int64.make(0,1));
+ var second_map = whoa.get(Int64.make(0,2));
+ rslt.Expect( (first_map != null) && (second_map != null), "(first_map != null) && (second_map != null)");
+ if ((first_map != null) && (second_map != null))
+ {
+ var crazy2 = first_map.get(Numberz.TWO);
+ var crazy3 = first_map.get(Numberz.THREE);
+ var looney = second_map.get(Numberz.SIX);
+ rslt.Expect( (crazy2 != null) && (crazy3 != null) && (looney != null),
+ "(crazy2 != null) && (crazy3 != null) && (looney != null)");
- rslt.Expect( Int64.compare( crazy2.userMap.get(Numberz.EIGHT), Int64.make(0,8)) == 0,
- "crazy2.UserMap.get(Numberz.EIGHT) == 8");
- rslt.Expect( Int64.compare( crazy3.userMap.get(Numberz.EIGHT), Int64.make(0,8)) == 0,
- "crazy3.UserMap.get(Numberz.EIGHT) == 8");
- rslt.Expect( Int64.compare( crazy2.userMap.get(Numberz.FIVE), Int64.make(0,5)) == 0,
- "crazy2.UserMap.get(Numberz.FIVE) == 5");
- rslt.Expect( Int64.compare( crazy3.userMap.get(Numberz.FIVE), Int64.make(0,5)) == 0,
- "crazy3.UserMap.get(Numberz.FIVE) == 5");
+ rslt.Expect( Int64.compare( crazy2.userMap.get(Numberz.EIGHT), Int64.make(0,8)) == 0,
+ "crazy2.UserMap.get(Numberz.EIGHT) == 8");
+ rslt.Expect( Int64.compare( crazy3.userMap.get(Numberz.EIGHT), Int64.make(0,8)) == 0,
+ "crazy3.UserMap.get(Numberz.EIGHT) == 8");
+ rslt.Expect( Int64.compare( crazy2.userMap.get(Numberz.FIVE), Int64.make(0,5)) == 0,
+ "crazy2.UserMap.get(Numberz.FIVE) == 5");
+ rslt.Expect( Int64.compare( crazy3.userMap.get(Numberz.FIVE), Int64.make(0,5)) == 0,
+ "crazy3.UserMap.get(Numberz.FIVE) == 5");
- var crz2iter = crazy2.xtructs.iterator();
- var crz3iter = crazy3.xtructs.iterator();
- rslt.Expect( crz2iter.hasNext() && crz3iter.hasNext(), "crz2iter.hasNext() && crz3iter.hasNext()");
- var goodbye2 = crz2iter.next();
- var goodbye3 = crz3iter.next();
- rslt.Expect( crz2iter.hasNext() && crz3iter.hasNext(), "crz2iter.hasNext() && crz3iter.hasNext()");
- var hello2 = crz2iter.next();
- var hello3 = crz3iter.next();
- rslt.Expect( ! (crz2iter.hasNext() || crz3iter.hasNext()), "! (crz2iter.hasNext() || crz3iter.hasNext())");
+ var crz2iter = crazy2.xtructs.iterator();
+ var crz3iter = crazy3.xtructs.iterator();
+ rslt.Expect( crz2iter.hasNext() && crz3iter.hasNext(), "crz2iter.hasNext() && crz3iter.hasNext()");
+ var goodbye2 = crz2iter.next();
+ var goodbye3 = crz3iter.next();
+ rslt.Expect( crz2iter.hasNext() && crz3iter.hasNext(), "crz2iter.hasNext() && crz3iter.hasNext()");
+ var hello2 = crz2iter.next();
+ var hello3 = crz3iter.next();
+ rslt.Expect( ! (crz2iter.hasNext() || crz3iter.hasNext()), "! (crz2iter.hasNext() || crz3iter.hasNext())");
- rslt.Expect( hello2.string_thing == "Hello2", 'hello2.String_thing == "Hello2"');
- rslt.Expect( hello2.byte_thing == 2, 'hello2.Byte_thing == 2');
- rslt.Expect( hello2.i32_thing == 2, 'hello2.I32_thing == 2');
- rslt.Expect( Int64.compare( hello2.i64_thing, Int64.make(0,2)) == 0, 'hello2.I64_thing == 2');
- rslt.Expect( hello3.string_thing == "Hello2", 'hello3.String_thing == "Hello2"');
- rslt.Expect( hello3.byte_thing == 2, 'hello3.Byte_thing == 2');
- rslt.Expect( hello3.i32_thing == 2, 'hello3.I32_thing == 2');
- rslt.Expect( Int64.compare( hello3.i64_thing, Int64.make(0,2)) == 0, 'hello3.I64_thing == 2');
+ rslt.Expect( hello2.string_thing == "Hello2", 'hello2.String_thing == "Hello2"');
+ rslt.Expect( hello2.byte_thing == 2, 'hello2.Byte_thing == 2');
+ rslt.Expect( hello2.i32_thing == 2, 'hello2.I32_thing == 2');
+ rslt.Expect( Int64.compare( hello2.i64_thing, Int64.make(0,2)) == 0, 'hello2.I64_thing == 2');
+ rslt.Expect( hello3.string_thing == "Hello2", 'hello3.String_thing == "Hello2"');
+ rslt.Expect( hello3.byte_thing == 2, 'hello3.Byte_thing == 2');
+ rslt.Expect( hello3.i32_thing == 2, 'hello3.I32_thing == 2');
+ rslt.Expect( Int64.compare( hello3.i64_thing, Int64.make(0,2)) == 0, 'hello3.I64_thing == 2');
- rslt.Expect( goodbye2.string_thing == "Goodbye4", 'goodbye2.String_thing == "Goodbye4"');
- rslt.Expect( goodbye2.byte_thing == 4, 'goodbye2.Byte_thing == 4');
- rslt.Expect( goodbye2.i32_thing == 4, 'goodbye2.I32_thing == 4');
- rslt.Expect( Int64.compare( goodbye2.i64_thing, Int64.make(0,4)) == 0, 'goodbye2.I64_thing == 4');
- rslt.Expect( goodbye3.string_thing == "Goodbye4", 'goodbye3.String_thing == "Goodbye4"');
- rslt.Expect( goodbye3.byte_thing == 4, 'goodbye3.Byte_thing == 4');
- rslt.Expect( goodbye3.i32_thing == 4, 'goodbye3.I32_thing == 4');
- rslt.Expect( Int64.compare( goodbye3.i64_thing, Int64.make(0,4)) == 0, 'goodbye3.I64_thing == 4');
- }
+ rslt.Expect( goodbye2.string_thing == "Goodbye4", 'goodbye2.String_thing == "Goodbye4"');
+ rslt.Expect( goodbye2.byte_thing == 4, 'goodbye2.Byte_thing == 4');
+ rslt.Expect( goodbye2.i32_thing == 4, 'goodbye2.I32_thing == 4');
+ rslt.Expect( Int64.compare( goodbye2.i64_thing, Int64.make(0,4)) == 0, 'goodbye2.I64_thing == 4');
+ rslt.Expect( goodbye3.string_thing == "Goodbye4", 'goodbye3.String_thing == "Goodbye4"');
+ rslt.Expect( goodbye3.byte_thing == 4, 'goodbye3.Byte_thing == 4');
+ rslt.Expect( goodbye3.i32_thing == 4, 'goodbye3.I32_thing == 4');
+ rslt.Expect( Int64.compare( goodbye3.i64_thing, Int64.make(0,4)) == 0, 'goodbye3.I64_thing == 4');
+ }
- var arg0 = 1;
- var arg1 = 2;
- var arg2 = Int64.make( 0x7FFFFFFF,0xFFFFFFFF);
- var multiDict = new IntMap< String>();
- multiDict.set(1, "one");
- var arg4 = Numberz.FIVE;
- var arg5 = Int64.make(0,5000000);
- trace("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + "," + multiDict + "," + arg4 + "," + arg5 + ")");
- var multiResponse = client.testMulti(arg0, arg1, arg2, multiDict, arg4, arg5);
- trace(" = Xtruct(byte_thing:" + multiResponse.byte_thing + ",string_thing:" + multiResponse.string_thing
- + ",i32_thing:" + multiResponse.i32_thing
- + ",i64_thing:" + Int64.toStr(multiResponse.i64_thing) + ")");
+ var arg0 = 1;
+ var arg1 = 2;
+ var arg2 = Int64.make( 0x7FFFFFFF,0xFFFFFFFF);
+ var multiDict = new IntMap< String>();
+ multiDict.set(1, "one");
+ var arg4 = Numberz.FIVE;
+ var arg5 = Int64.make(0,5000000);
+ trace("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + "," + multiDict + "," + arg4 + "," + arg5 + ")");
+ var multiResponse = client.testMulti(arg0, arg1, arg2, multiDict, arg4, arg5);
+ trace(" = Xtruct(byte_thing:" + multiResponse.byte_thing + ",string_thing:" + multiResponse.string_thing
+ + ",i32_thing:" + multiResponse.i32_thing
+ + ",i64_thing:" + Int64.toStr(multiResponse.i64_thing) + ")");
- rslt.Expect( multiResponse.string_thing == "Hello2", 'multiResponse.String_thing == "Hello2"');
- rslt.Expect( multiResponse.byte_thing == arg0, 'multiResponse.Byte_thing == arg0');
- rslt.Expect( multiResponse.i32_thing == arg1, 'multiResponse.I32_thing == arg1');
- rslt.Expect( Int64.compare( multiResponse.i64_thing, arg2) == 0, 'multiResponse.I64_thing == arg2');
+ rslt.Expect( multiResponse.string_thing == "Hello2", 'multiResponse.String_thing == "Hello2"');
+ rslt.Expect( multiResponse.byte_thing == arg0, 'multiResponse.Byte_thing == arg0');
+ rslt.Expect( multiResponse.i32_thing == arg1, 'multiResponse.I32_thing == arg1');
+ rslt.Expect( Int64.compare( multiResponse.i64_thing, arg2) == 0, 'multiResponse.I64_thing == arg2');
- rslt.StartTestGroup( 0);
+ rslt.StartTestGroup( 0);
- trace("Test Oneway(1)");
- client.testOneway(1);
+ trace("Test Oneway(1)");
+ client.testOneway(1);
- if( ! args.skipSpeedTest) {
- trace("Test Calltime()");
- var difft = Timer.stamp();
- for ( k in 0 ... 1000) {
- client.testVoid();
- }
- difft = Timer.stamp() - difft;
- trace('$difft ms per testVoid() call');
- }
- }
+ if( ! args.skipSpeedTest) {
+ trace("Test Calltime()");
+ var difft = Timer.stamp();
+ for ( k in 0 ... 1000) {
+ client.testVoid();
+ }
+ difft = Timer.stamp() - difft;
+ trace('$difft ms per testVoid() call');
+ }
+ }
}