Browse Source

add a timer to the unit tests so we can compare the size of our run-times

Simon Krajewski 8 years ago
parent
commit
f9329180aa
3 changed files with 6 additions and 2 deletions
  1. 0 1
      tests/unit/compile-each.hxml
  2. 4 0
      tests/unit/src/unit/Test.hx
  3. 2 1
      tests/unit/src/unit/TestMain.hx

+ 0 - 1
tests/unit/compile-each.hxml

@@ -1,4 +1,3 @@
--D macro-times
 -debug
 -cp src
 -cp "C:\Program Files\The Haxe Effect\src/dev/null"

+ 4 - 0
tests/unit/src/unit/Test.hx

@@ -198,6 +198,7 @@ class Test {
 	static var AMAX = 3;
 	static var timer : haxe.Timer;
 	static var success = true;
+	static var startStamp:Float;
 
 	dynamic static function report( msg : String, ?pos : haxe.PosInfos ) {
 		if( reportInfos != null ) {
@@ -228,6 +229,9 @@ class Test {
 			}
 			#end
 
+			if (success) {
+				report("TIME: " + (haxe.Timer.stamp() - startStamp));
+			}
 			#if sys
 			Sys.exit(success ? 0 : 1);
 			#end

+ 2 - 1
tests/unit/src/unit/TestMain.hx

@@ -18,7 +18,8 @@ class TestMain {
 	#end
 
 	static function main() {
-	  var verbose = #if ( cpp || neko || php ) Sys.args().indexOf("-v") >= 0 #else false #end;
+		Test.startStamp = haxe.Timer.stamp();
+		var verbose = #if ( cpp || neko || php ) Sys.args().indexOf("-v") >= 0 #else false #end;
 
 		#if cs //"Turkey Test" - Issue #996
 		cs.system.threading.Thread.CurrentThread.CurrentCulture = new cs.system.globalization.CultureInfo('tr-TR');