gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/avm2 r9571: Add header files for running H


From: Tom Stellard
Subject: [Gnash-commit] /srv/bzr/gnash/avm2 r9571: Add header files for running Haxe tests.
Date: Fri, 26 Sep 2008 01:05:37 +0800
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9571
committer: Tom Stellard <address@hidden>
branch nick: gnash_dev
timestamp: Fri 2008-09-26 01:05:37 +0800
message:
  Add header files for running Haxe tests.
added:
  testsuite/actionscript.all/haxe-swf9/Dejagnu.hx
  testsuite/actionscript.all/haxe-swf9/check.as
=== added file 'testsuite/actionscript.all/haxe-swf9/Dejagnu.hx'
--- a/testsuite/actionscript.all/haxe-swf9/Dejagnu.hx   1970-01-01 00:00:00 
+0000
+++ b/testsuite/actionscript.all/haxe-swf9/Dejagnu.hx   2008-09-25 17:05:37 
+0000
@@ -0,0 +1,135 @@
+import flash.Lib;
+import flash.text.TextField;
+class Dejagnu {
+    static var passed = 0;
+    static var failed = 0;
+    static var xpassed = 0;
+    static var xfailed = 0;
+    static var untest = 0;
+    static var unresolve = 0;
+    static var inithack = init();
+    static var tf:flash.text.TextField;
+    static function init() {
+ tf = new flash.text.TextField();
+ tf.autoSize = flash.text.TextFieldAutoSize.LEFT;
+ flash.Lib.current.addChild(tf);
+ return null;
+    }
+    static function fail (why) {
+        failed++;
+        var msg = 'FAILED: '+why;
+        xtrace(msg);
+    }
+    static function xfail(why) {
+        xfailed++;
+        var msg = 'XFAILED: '+why;
+        xtrace(msg);
+    }
+    static function pass(why) {
+        passed++;
+        var msg = 'PASSED: '+why;
+        flash.Lib.trace(msg);
+    }
+    static function xpass(why) {
+        xpassed++;
+        var msg = 'XPASSED: '+why;
+        flash.Lib.trace(msg);
+    }
+    static function testcount() {
+        var c = 0;
+        if ( passed > 0 ) c += passed;
+        if ( failed > 0 ) c += failed;
+        if ( xpassed > 0 ) c += xpassed;
+        if ( xfailed > 0 ) c += xfailed;
+        return c;
+    }
+    static function printtotals() {
+        xtrace('#passed: '+ passed);
+        xtrace('#failed: '+ failed);
+        if ( xpassed > 0 ) {
+            xtrace('#unexpected successes: '+ xpassed);
+        }
+        if ( xfailed > 0 ) {
+            xtrace('#expected failures: '+ xfailed);
+        }
+  xtrace('#total tests run: '+ testcount());
+    }
+    static public function totals(exp:Dynamic, msg:Dynamic) {
+        var obt = testcount();
+        if ( exp != null && obt != exp ) {
+            fail('Test run '+obt+' (expected '+exp+') '+msg);
+        } else {
+            pass('Test run '+obt+' '+msg);
+        }
+    }
+    static function xtotals(exp:Dynamic, msg:Dynamic) {
+        var obt = testcount();
+        if ( exp != null && obt != exp ) {
+            xfail('Test run '+obt+' (expected '+exp+') ['+msg+']');
+        } else {
+            xpass('Test run '+obt+' ['+msg+']');
+        }
+    }
+    static public function check_equals(obt:Dynamic, exp:Dynamic, msg) {
+        if(msg == null) msg = "";
+        if ( obt == exp )
+            pass(obt+' == '+exp+' '+msg);
+        else
+            fail('expected: "'+exp+'" , obtained: "'+obt+'" '+msg);
+    }
+ static public function xcheck_equals(obt:Dynamic, exp:Dynamic, msg)
+ {
+  if(msg == null) msg = "";
+  if ( obt == exp )
+  {
+   xpass(obt+' == '+exp+' '+msg);
+  }
+  else
+  {
+   xfail('expected: '+exp+' , obtained: '+obt+" "+msg);
+  }
+ }
+ static public function check(a : Dynamic, msg)
+ {
+  if ( a )
+  {
+   if ( msg != null ) pass(msg);
+   else pass(a);
+  }
+  else
+  {
+   if ( msg != null ) fail(msg);
+   else fail(a);
+  }
+ }
+ static public function xcheck(a : Dynamic, msg)
+ {
+  if ( a )
+  {
+   if ( msg != null ) xpass(msg);
+   else xpass(a);
+  }
+  else
+  {
+   if ( msg != null ) xfail(msg);
+   else xfail(a);
+  }
+ }
+    static public function note(msg) {
+        xtrace(msg);
+    }
+    static function xtrace(msg) {
+        tf.text += msg + "\n";
+        flash.Lib.trace(msg);
+    }
+    static function untested(msg) {
+        flash.Lib.trace("UNTESTED: "+msg);
+    }
+    static function unresolved(msg) {
+        flash.Lib.trace("UNRESOLVED: "+msg);
+    }
+    static public function done() {
+        printtotals();
+ flash.Lib.trace("__END_OF_TEST__");
+    }
+}

=== added file 'testsuite/actionscript.all/haxe-swf9/check.as'
--- a/testsuite/actionscript.all/haxe-swf9/check.as     1970-01-01 00:00:00 
+0000
+++ b/testsuite/actionscript.all/haxe-swf9/check.as     2008-09-25 17:05:37 
+0000
@@ -0,0 +1,52 @@
+// check.as - Include file for MTASC testcases providing common testing 
facilities
+//
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+//
+// Original author: David Rorex - address@hidden
+//
+
+#ifndef _CHECK_AS_
+#define _CHECK_AS_
+
+#define _INFO_ ' ['+__FILE__+':'+__LINE__+']'
+
+// First argument is the expression we test, second is the result we expect
+#define check_equals(obt, exp) Dejagnu.check_equals(obt, exp, _INFO_)
+
+// First argument is the expression we test, second is the result we expect
+#define xcheck_equals(obt, exp) Dejagnu.xcheck_equals(obt, exp, _INFO_)
+
+#define check(a) Dejagnu.check(a, #a+' '+_INFO_)
+#define xcheck(a) Dejagnu.xcheck(a, #a+' '+_INFO_)
+
+#define pass(text) Dejagnu.pass(text + _INFO_)
+#define xpass(text) Dejagnu.xpass(text + _INFO_)
+#define fail(text) Dejagnu.fail(text + _INFO_)
+#define xfail(text) Dejagnu.xfail(text + _INFO_)
+#define pass(text) Dejagnu.pass(text + _INFO_)
+#define untested(text) Dejagnu.untested(text + _INFO_)
+#define unresolved(text) Dejagnu.unresolved(text + _INFO_)
+
+#define check_totals(n) Dejagnu.totals(n,  _INFO_)
+#define xcheck_totals(n) Dejagnu.xtotals(n,  _INFO_)
+
+#define note(text) Dejagnu.note(text + _INFO_)
+
+import Dejagnu;
+
+#endif


reply via email to

[Prev in Thread] Current Thread [Next in Thread]