[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10737: Fill in the as3 testsuite a
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10737: Fill in the as3 testsuite a bit. |
Date: |
Tue, 24 Mar 2009 11:28:30 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10737
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2009-03-24 11:28:30 +0100
message:
Fill in the as3 testsuite a bit.
added:
testsuite/as3/Makefile.am
testsuite/as3/basic.as
testsuite/as3/check.as
testsuite/as3/dejagnu.as
modified:
configure.ac
testsuite/Makefile.am
------------------------------------------------------------
revno: 10736.1.1
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-03-24 10:12:36 +0100
message:
Initial version of dejagnu as3 package with test class enabled.
added:
testsuite/as3/dejagnu.as
------------------------------------------------------------
revno: 10736.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-03-24 10:22:19 +0100
message:
Improvements.
modified:
testsuite/as3/dejagnu.as
------------------------------------------------------------
revno: 10736.1.3
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-03-24 10:30:24 +0100
message:
Add Makefile.
added:
testsuite/as3/Makefile.am
------------------------------------------------------------
revno: 10736.1.4
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-03-24 10:42:57 +0100
message:
Add check.as.
added:
testsuite/as3/check.as
------------------------------------------------------------
revno: 10736.1.5
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-03-24 10:45:33 +0100
message:
Add a test test.
added:
testsuite/as3/hello.as
------------------------------------------------------------
revno: 10736.1.6
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-03-24 10:52:55 +0100
message:
Modify testsuite Makefile for as3.
modified:
testsuite/Makefile.am
------------------------------------------------------------
revno: 10736.1.7
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-03-24 11:18:08 +0100
message:
Modifications to get better test info.
modified:
testsuite/as3/Makefile.am
testsuite/as3/check.as
testsuite/as3/dejagnu.as
testsuite/as3/hello.as
------------------------------------------------------------
revno: 10736.1.8
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-03-24 11:18:33 +0100
message:
Make testsuite/as3 build and run.
modified:
configure.ac
------------------------------------------------------------
revno: 10736.1.9
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-03-24 11:19:39 +0100
message:
Rename hello.as.
renamed:
testsuite/as3/hello.as => testsuite/as3/basic.as
modified:
testsuite/as3/Makefile.am
------------------------------------------------------------
revno: 10736.1.10
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2009-03-24 11:21:30 +0100
message:
Make as3compile build conditional.
modified:
testsuite/Makefile.am
=== modified file 'configure.ac'
--- a/configure.ac 2009-03-17 13:03:04 +0000
+++ b/configure.ac 2009-03-24 10:18:33 +0000
@@ -2212,6 +2212,7 @@
testsuite/Makefile
testsuite/media/Makefile
testsuite/libbase/Makefile
+testsuite/as3/Makefile
testsuite/actionscript.all/Makefile
testsuite/samples/Makefile
testsuite/swfdec/Makefile
=== modified file 'testsuite/Makefile.am'
--- a/testsuite/Makefile.am 2009-02-25 22:33:03 +0000
+++ b/testsuite/Makefile.am 2009-03-24 10:21:30 +0000
@@ -41,8 +41,13 @@
DIR_SWFDEC_TESTSUITE = swfdec
endif
+if ENABLE_AS3COMPILE
+DIR_AS3 = as3
+endif
+
DIST_SUBDIRS = \
media \
+ as3 \
actionscript.all \
libbase \
libamf.all \
@@ -61,6 +66,7 @@
SUBDIRS = \
. \
media \
+ $(DIR_AS3) \
$(DIR_SWFDEC_TESTSUITE) \
libnet.all \
libbase \
=== added file 'testsuite/as3/Makefile.am'
--- a/testsuite/as3/Makefile.am 1970-01-01 00:00:00 +0000
+++ b/testsuite/as3/Makefile.am 2009-03-24 10:19:39 +0000
@@ -0,0 +1,81 @@
+## Process this fill with automake to generate Makefile.in
+#
+# Copyright (C) 2007, 2008, 2009 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
+
+AUTOMAKE_OPTIONS = dejagnu
+
+# These will get executed and parsed for test output
+AS3TESTS = \
+ basic.as \
+ $(NULL)
+
+EXTRA_DIST = $(AS3TESTS) dejagnu.as
+
+abs_mediadir = `cd $(srcdir)/../media; pwd`
+
+# AS3COMPILE set by configure.
+AS3COMPILE_FLAGS =
+AS3COMPILE_CPP = $(CPP) -x c -P -I$(srcdir) -DMEDIADIR="$(abs_mediadir)"
+
+AS3TESTS_OUT = $(AS3TESTS:.as=.swf)
+
+TEST_DRIVERS = ../simple.exp
+TEST_CASES = \
+ sanetests-runner \
+ $(check_PROGRAMS)
+
+sanetests-runner: $(srcdir)/../generic-testrunner.sh $(AS3TESTS_OUT) Makefile
+ sh $< -f 50 -r 50 $(top_builddir) $(AS3TESTS_OUT) > $@
+ chmod 755 $@
+
+$(AS3TESTS_OUT): dejagnu.as check.as
+
+SUFFIXES = .as .swf
+.as.swf:
+ $(AS3COMPILE_CPP) $< > $(@:%.swf=pp_%.as)
+ $(AS3COMPILE) $(AS3COMPILE_FLAGS) -o $@ $(@:%.swf=pp_%.as)
+
+CLEANFILES = \
+ $(TEST_CASES) \
+ gnash-dbg.log \
+ site.exp.bak \
+ alltests-runner \
+ testrun.* \
+ *.swf \
+ *.pp \
+ pp_*.as \
+ *_testrunner \
+ *_Runner
+
+check-DEJAGNU: site-update $(TEST_CASES)
+ @runtest=$(RUNTEST); \
+ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ GNASH_GC_TRIGGER_THRESHOLD=0 GNASHRC=../gnashrc $$runtest
$(RUNTESTFLAGS) $(TEST_DRIVERS); true; \
+ else \
+ echo "WARNING: could not find \`runtest'" 1>&2; \
+ for i in "$(TEST_CASES)"; do \
+ GNASH_GC_TRIGGER_THRESHOLD=0 GNASHRC=../gnashrc $(SHELL) $$i; \
+ done; \
+ fi
+
+site-update: site.exp
+ @rm -fr site.exp.bak
+ @cp site.exp site.exp.bak
+ @sed -e '/testcases/d' site.exp.bak > site.exp
+ @echo "# This is a list of the pre-compiled testcases" >> site.exp
+ @echo "set testcases \"$(TEST_CASES)\"" >> site.exp
+
=== added file 'testsuite/as3/basic.as'
--- a/testsuite/as3/basic.as 1970-01-01 00:00:00 +0000
+++ b/testsuite/as3/basic.as 2009-03-24 10:19:39 +0000
@@ -0,0 +1,51 @@
+//
+// Copyright (C) 2005, 2006, 2007, 2009 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
+
+#include "check.as"
+
+package hello {
+
+ import flash.display.MovieClip;
+
+
+ public class Hello extends MovieClip {
+
+ DEJAGNU_OBJ;
+
+ public function Hello() {
+ INIT_DEJAGNU;
+
+ var i = 1;
+ i++;
+ check_equals(i, 2);
+
+ i += 2;
+ check_equals(i, 4);
+
+ i *= 3;
+ check_equals(i, 12);
+
+ i /= 8;
+ check_equals(i, 1.5);
+
+ i -= 14;
+ check_equals(i, -12.5);
+
+ }
+ }
+}
+
=== added file 'testsuite/as3/check.as'
--- a/testsuite/as3/check.as 1970-01-01 00:00:00 +0000
+++ b/testsuite/as3/check.as 2009-03-24 10:18:08 +0000
@@ -0,0 +1,57 @@
+// check.as - Include file for SWFC testcases providing common testing
facilities
+//
+// Copyright (C) 2005, 2006, 2007, 2009 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
+//
+
+#ifndef GNASH_AS3_CHECK_AS
+#define GNASH_AS3_CHECK_AS
+
+#include "dejagnu.as"
+
+#define DEJAGNU_OBJ import dejagnu.Dejagnu; \
+ var DJ:Dejagnu
+
+#define INIT_DEJAGNU DJ = new Dejagnu(this);
+
+#define _INFO_ ' ['+__FILE__+':'+__LINE__+']'
+
+#define check_equals(a, b) DJ.check_equals(a, b, _INFO_, #a);
+
+#define xcheck_equals(a, b) DJ.xcheck_equals(a, b, _INFO_, #a);
+
+#define check(a) DJ.check(a, _INFO_);
+#define xcheck(a) DJ.xcheck(a, _INFO_);
+
+#define pass(text) DJ.pass(text + _INFO_)
+#define xpass(text) DJ.xpass(text + _INFO_)
+#define fail(text) DJ.fail(text + _INFO_)
+#define xfail(text) DJ.xfail(text + _INFO_)
+#define pass(text) DJ.pass(text + _INFO_)
+#define untested(text) DJ.untested(text + _INFO_)
+#define unresolved(text) DJ.unresolved(text + _INFO_)
+
+#define note(text) DJ.note(text + _INFO_);
+
+#define totals(x) DJ.totals(x, _INFO_)
+
+#define xtotals(x) DJ.xtotals(x, _INFO_)
+
+#define _QUOTEME(x) #x
+#define QUOTEME(x) _QUOTEME(x)
+#define MEDIA(x) QUOTEME(MEDIADIR/x)
+
+#endif
=== added file 'testsuite/as3/dejagnu.as'
--- a/testsuite/as3/dejagnu.as 1970-01-01 00:00:00 +0000
+++ b/testsuite/as3/dejagnu.as 2009-03-24 10:18:08 +0000
@@ -0,0 +1,178 @@
+// Dejagnu.as - MTASC class for dejagnu-like testing.
+//
+// Copyright (C) 2005, 2006, 2007, 2009 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
+
+package dejagnu {
+
+ import flash.text.*;
+ import flash.display.Sprite;
+
+ public class Dejagnu extends Sprite {
+
+ private var passed;
+ private var failed;
+ private var xpassed;
+ private var xfailed;
+ private var untest;
+ private var unresolve;
+ private var tf:TextField;
+
+ public function Dejagnu(o) {
+ passed = 0;
+ failed = 0;
+ xpassed = 0;
+ xfailed = 0;
+ untest = 0;
+ unresolve = 0;
+ tf = new TextField();
+ tf.autoSize = TextFieldAutoSize.LEFT;
+ addChild(tf);
+ o.addChild(this);
+ }
+
+ public function fail (why) {
+ failed++;
+ var msg = 'FAILED: '+why;
+ xtrace(msg);
+ }
+
+ public function xfail(why) {
+ xfailed++;
+ var msg = 'XFAILED: '+why;
+ xtrace(msg);
+ }
+
+ public function pass(why) {
+ passed++;
+ var msg = 'PASSED: '+why;
+ trace (msg);
+ }
+
+ public function xpass(why) {
+ xpassed++;
+ var msg = 'XPASSED: '+why;
+ trace (msg);
+ }
+
+ public function totals(exp, msg) {
+ var obt = testcount();
+ if ( exp != undefined && obt != exp ) {
+ fail('Test run '+obt+' (expected '+exp+') ['+msg+']');
+ } else {
+ pass('Test run '+obt+' ['+msg+']');
+ }
+ }
+
+ public function xtotals(exp, msg) {
+ var obt = testcount();
+ if ( exp != undefined && obt != exp ) {
+ xfail('Test run '+obt+' (expected '+exp+') ['+msg+']');
+ } else {
+ xpass('Test run '+obt+' ['+msg+']');
+ }
+ }
+
+ public function check_equals(obt, exp, msg, expression) {
+ if (msg == null) msg = "";
+ if (obt == exp) {
+ pass(expression + ' == ' + exp + ' ' + msg);
+ }
+ else {
+ fail(expression + ': expected: "' + exp +
+ '" , obtained: "' + obt + '" ' + msg);
+ }
+ }
+
+ public function xcheck_equals(obt, exp, msg, expression) {
+ if (msg == null) msg = "";
+ if (obt == exp) {
+ xpass(expression + ' == ' + exp + ' ' + msg);
+ }
+ else {
+ xfail(expression + ': expected: "' + exp +
+ '" , obtained: "' + obt + '" ' + msg);
+ }
+ }
+
+ public function check(a, msg) {
+ if (a) {
+ pass(msg != undefined ? msg : a);
+ }
+ else {
+ fail(msg != undefined ? msg : a);
+ }
+ }
+
+ public function xcheck(a, msg) {
+ if (a) {
+ xpass(msg != undefined ? msg : a);
+ }
+ else {
+ xfail(msg != undefined ? msg : a);
+ }
+ }
+
+ public function note(msg) {
+ xtrace(msg);
+ }
+
+ public function untested(msg) {
+ trace("UNTESTED: "+msg);
+ }
+
+ public function unresolved(msg) {
+ trace("UNRESOLVED: "+msg);
+ }
+
+ /// Private functions.
+
+ private function xtrace(msg) {
+ tf.text += msg + "\n";
+ trace(msg);
+ }
+
+ private function done() {
+ printtotals();
+ trace("__END_OF_TEST__");
+ }
+
+ private function testcount() {
+ var c = 0;
+ if ( passed ) c += passed;
+ if ( failed ) c += failed;
+ if ( xpassed ) c += xpassed;
+ if ( xfailed ) c += xfailed;
+ return c;
+ }
+
+ private function printtotals() {
+ xtrace('#passed: '+ passed);
+ xtrace('#failed: '+ failed);
+ if ( xpassed ) {
+ xtrace('#unexpected successes: '+ xpassed);
+ }
+ if ( xfailed ) {
+ xtrace('#expected failures: '+ xfailed);
+ }
+ xtrace('#total tests run: '+ testcount());
+ }
+
+
+ }
+
+}
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10737: Fill in the as3 testsuite a bit.,
Benjamin Wolsey <=