THRIFT-3076 Compatibility with Haxe 3.2.0
Client: Haxe
Patch: Jens Geyer

This closes #510
diff --git a/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx b/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
index e648b75..8845fd0 100644
--- a/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
+++ b/lib/haxe/src/org/apache/thrift/helper/Int64Map.hx
@@ -52,9 +52,9 @@
 
     private function GetLowMap( key : haxe.Int64, canCreate : Bool) : IntMap< T> {
         #if( haxe_ver < 3.2)
-        return GetSubMap( Int64.getHigh(key), false);
+        return GetSubMap( Int64.getHigh(key), canCreate);
         #else
-        return GetSubMap( key.high, false);
+        return GetSubMap( key.high, canCreate);
         #end
     }
 
@@ -70,10 +70,10 @@
 
     private function NullCheck( key : haxe.Int64) : Bool {
         #if( haxe_ver < 3.2)
-		return (key != null);  
+        return (key != null);
         #else
-		return false;  // In64 is not nullable anymore (it never really was)
-		#end
+        return true;  // Int64 is not nullable anymore (it never really was)
+        #end
     };
 
 
@@ -183,9 +183,10 @@
             if( first) {
                 first = false;
             } else {
-                result += ", ";
+                result += ",";
             }
 
+            result += " ";
             var value = this.get(key);
             result += Int64.toStr(key) + ' => $value';
         }
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx b/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx
index e945789..c4d0ced 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx
@@ -700,7 +700,6 @@
         try
         {
             return tcompactTypeToType[type];
-            throw "fuck";
         }
         catch ( e : Dynamic)
         {
diff --git a/lib/haxe/test/Makefile.am b/lib/haxe/test/Makefile.am
index 91cfc90..7d29f81 100644
--- a/lib/haxe/test/Makefile.am
+++ b/lib/haxe/test/Makefile.am
@@ -36,9 +36,12 @@
 
 all-local: $(BIN_CPP)
 
-$(BIN_CPP): gen-haxe/thrift/test/ThriftTest.hx \
-			gen-haxe/thrift/test/Aggr.hx \
-			gen-haxe/thrift/test/BenchmarkService.hx
+$(BIN_CPP): \
+		src/*.hx \
+		../src/org/apache/thrift/**/*.hx \
+		gen-haxe/thrift/test/ThriftTest.hx \
+		gen-haxe/thrift/test/Aggr.hx \
+		gen-haxe/thrift/test/BenchmarkService.hx
 	$(HAXE) --cwd .  cpp.hxml
 
 
@@ -49,7 +52,7 @@
 #    $(HAXE)  --cwd .  javascript
 #    $(HAXE)  --cwd .  neko
 #    $(HAXE)  --cwd .  php
-#    $(HAXE)  --cwd .  python  # needs Haxe 3.1.4
+#    $(HAXE)  --cwd .  python  # needs Haxe 3.2.0
 
 
 clean-local:
diff --git a/test/haxe/Makefile.am b/test/haxe/Makefile.am
index 1e537d3..37ccfc3 100644
--- a/test/haxe/Makefile.am
+++ b/test/haxe/Makefile.am
@@ -28,7 +28,10 @@
 
 all-local: $(BIN_CPP)
 
-$(BIN_CPP):    gen-haxe/thrift/test/ThriftTest.hx
+$(BIN_CPP): \
+		src/*.hx \
+		../../lib/haxe/src/org/apache/thrift/**/*.hx \
+		gen-haxe/thrift/test/ThriftTest.hx
 	$(HAXE) --cwd .  cpp.hxml
 
 
@@ -39,7 +42,7 @@
 #    $(HAXE)  --cwd .  javascript
 #    $(HAXE)  --cwd .  neko
 #    $(HAXE)  --cwd .  php
-#    $(HAXE)  --cwd .  python  # needs Haxe 3.1.4
+#    $(HAXE)  --cwd .  python  # needs Haxe 3.2.0
 
 
 clean-local:
diff --git a/test/haxe/src/TestClient.hx b/test/haxe/src/TestClient.hx
index 5193c47..8e43c76 100644
--- a/test/haxe/src/TestClient.hx
+++ b/test/haxe/src/TestClient.hx
@@ -92,8 +92,8 @@
 
     public function PrintSummary() : Void {
         var total = successCnt + errorCnt;
-        var sp = (100 * successCnt) / total;
-        var ep = (100 * errorCnt) / total;
+        var sp = Math.round((1000 * successCnt) / total) / 10;
+        var ep = Math.round((1000 * errorCnt) / total) / 10;
 
         trace('===========================');
         trace('Tests executed    $total');
@@ -134,17 +134,17 @@
                 exitCode = rslt.CalculateExitCode();
             }
 
-            difft = Timer.stamp() - difft;
+            difft = Math.round( 1000 * (Timer.stamp() - difft)) / 1000;
             trace('total test time: $difft seconds');
         }
         catch (e : TException)
         {
-            trace('$e');
+            trace('TException: $e');
             exitCode = 0xFF;
         }
         catch (e : Dynamic)
         {
-            trace('$e');
+            trace('Exception: $e');
             exitCode = 0xFF;
         }
 
@@ -219,10 +219,12 @@
             protocol = new TCompactProtocol(transport);
         }
 
-
-        // run the test code
+        // some quick and basic unit tests
         HaxeBasicsTest( args, rslt);
         ModuleUnitTests( args, rslt);
+
+        // now run the test code
+        trace('- ${args.numIterations} iterations');
         for( i in 0 ... args.numIterations) {
             ClientTest( transport, protocol, args, rslt);
         }
@@ -250,6 +252,9 @@
         map32.set( 0, -123);
         map64.set( Int64.make(0,0), -123);
 
+        //trace('map32 = $map32');
+        //trace('map64 = $map64');
+
         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.neg(Int64.make(0,517))), "Int64Map<Int32> Test #12");
@@ -385,12 +390,12 @@
         }
         catch (e : TException)
         {
-            trace('$e');
+            rslt.Expect( false, 'unable to open transport: $e');
             return;
         }
         catch (e : Dynamic)
         {
-            trace('$e');
+            rslt.Expect( false, 'unable to open transport: $e');
             return;
         }
 
@@ -726,10 +731,14 @@
         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) {
+        for (i in 1 ... 5) {
             rslt.Expect( pos.get(i) == i, 'pos.get($i) == $i');
             rslt.Expect( neg.get(-i) == -i, 'neg.get(-$i) == -$i');
-         }
+        }
+        rslt.Expect( ! pos.exists(0), '!pos.exists(0)');
+        rslt.Expect( ! neg.exists(-0), '!neg.exists(-0)');
+        rslt.Expect( ! pos.exists(42), '!pos.exists(42)');
+        rslt.Expect( ! neg.exists(-42), '!neg.exists(-42)');
 
 
         rslt.StartTestGroup( TestResults.EXITCODE_FAILBIT_STRUCTS);
@@ -877,7 +886,7 @@
             for ( k in 0 ... 1000) {
                 client.testVoid();
             }
-            difft = Timer.stamp() - difft;
+            difft = Math.round( 1000 * (Timer.stamp() - difft)) / 1000;
             trace('$difft ms per testVoid() call');
         }
     }
diff --git a/tutorial/haxe/Makefile.am b/tutorial/haxe/Makefile.am
index a781b5a..c3c5204 100644
--- a/tutorial/haxe/Makefile.am
+++ b/tutorial/haxe/Makefile.am
@@ -26,7 +26,10 @@
 
 check: gen-haxe/tutorial/calculator.hx
 
-bin/Main-debug:    gen-haxe/tutorial/calculator.hx
+bin/Main-debug: \
+		src/*.hx \
+		../../lib/haxe/src/org/apache/thrift/**/*.hx \
+		gen-haxe/tutorial/calculator.hx
 	$(HAXE) --cwd .  cpp.hxml
 
 tutorialserver: all