gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11154: Migrated ming tests to haXe


From: Sharad Desai
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11154: Migrated ming tests to haXe for AsBroadcaster
Date: Fri, 19 Jun 2009 11:29:16 -0600
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11154
committer: Sharad Desai <address@hidden>
branch nick: trunk
timestamp: Fri 2009-06-19 11:29:16 -0600
message:
  Migrated ming tests to haXe for AsBroadcaster
modified:
  testsuite/misc-haxe.all/classes.all/AsBroadcaster_as.hx
    ------------------------------------------------------------
    revno: 11094.1.1
    committer: Sharad Desai <address@hidden>
    branch nick: desaiTst1
    timestamp: Fri 2009-06-19 11:22:34 -0600
    message:
      Migrated ming tests to haXe for AsBroadcaster
    modified:
      testsuite/as3/classes.all/AsBroadcaster_as.hx
=== modified file 'testsuite/misc-haxe.all/classes.all/AsBroadcaster_as.hx'
--- a/testsuite/misc-haxe.all/classes.all/AsBroadcaster_as.hx   2009-06-13 
00:23:50 +0000
+++ b/testsuite/misc-haxe.all/classes.all/AsBroadcaster_as.hx   2009-06-19 
17:29:16 +0000
@@ -29,12 +29,13 @@
 #if flash9
 import flash.display.MovieClip;
 #else
-import flash.MovieClip;
 import flash.TextField;
 #end
 import flash.Lib;
+import flash.MovieClip;
 import Type;
 import Reflect;
+import haxe.PosInfos;
 
 // import our testing API
 import DejaGnu;
@@ -42,403 +43,870 @@
 class AsBroadcaster_as {
        static function main() {
 
-#if flash9
+       #if flash9
     //In actionsscript 3 the AsBroadcaster class does not exist
     //Many of the methods have been moved to flash.events.{method}
     //Look at the Actionscript 2 migration document from adobe to find the new 
methods
 
-#else
+       #else
        // NOTE: Haxe does not provide support for flash version proir to flash 
6
        //     However, AsBroadcaster works slightly differently in flash1-5.
        //     In those versions AsBroadcaster does not provide prototype or
        //     initialize
        
        // The following tests should be valid for flash6, 7, 8
-
        if (Type.typeof(untyped AsBroadcaster) == ValueType.TFunction) {
-           DejaGnu.pass("AsBroadcaster class exists");
+           DejaGnu.pass("typeof(AsBroadcaster) == 'function' 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-           DejaGnu.fail("AsBroadcaster class does not exist");
+           DejaGnu.fail("typeof(AsBroadcaster) != 'function' 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
 
        //Testing for prototype
        if (Type.typeof(untyped AsBroadcaster.prototype) == ValueType.TObject) {
-               DejaGnu.pass("The AsBroadcaster prototype property exists");
+               DejaGnu.pass("typeof(AsBroadcaster.prototype) == 'object'  
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("The AsBroadcaster prototype property does not 
exist");
+               DejaGnu.fail("typeof(AsBroadcaster) != 'function' 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        if (Type.typeof(untyped AsBroadcaster.__proto__) == ValueType.TObject) {
-               DejaGnu.pass("The AsBroadcaster __proto__ property exists");
+               DejaGnu.pass("AsBroadcaster.__proto__ == Function.prototype 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("The AsBroadcaster __proto__ property does not 
exist");
+               DejaGnu.fail("AsBroadcaster.__proto__ != Function.prototype 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        
-       
        var obj = { f : function() { trace("Hi There!");} };
        var target = { x1 : "testing" };
        var event:String = "f";
-       
-       
+               
        //Testing for initialize()
        if (untyped AsBroadcaster.hasOwnProperty('initialize')) {
-               DejaGnu.pass("AsBroadcaster.initialize property exists");
+               DejaGnu.pass("typeof(AsBroadcaster.initialize) == 'function' 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("AsBroadcaster.initialize property does not 
exist");
+               DejaGnu.fail("typeof(AsBroadcaster.initialize) != 'function' 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        if (Type.typeof(untyped AsBroadcaster.initialize) == 
ValueType.TFunction) {
-               DejaGnu.pass("AsBroadcaster.initialize is a function");
+               DejaGnu.pass("AsBroadcaster.initialize is a function 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("AsBroadcaster.initialize is not a function");
+               DejaGnu.fail("AsBroadcaster.initialize is not a function 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        if (! untyped AsBroadcaster.prototype.hasOwnProperty('initialize')) {
-               DejaGnu.pass("AsBroadcaster.initialize was not inherited from 
the superclass");
+               DejaGnu.pass("AsBroadcaster.hasOwnProperty('initialize') 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("AsBroadcaster.initialize was inherited from the 
superclass");
+               DejaGnu.fail("!AsBroadcaster.hasOwnProperty('initialize') 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        if (Type.typeof(untyped AsBroadcaster.initialize(target)) == 
ValueType.TNull) {
-               DejaGnu.pass("AsBroadcaster.initialize() is a void function");
+               
DejaGnu.pass("!AsBroadcaster.prototype.hasOwnProperty('initialize') 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("AsBroadcaster.initialize() is not a void 
function");
+               
DejaGnu.fail("AsBroadcaster.prototype.hasOwnProperty('initialize') 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        
        //Testing for addListener()
        if (untyped AsBroadcaster.hasOwnProperty('addListener')) {
-               DejaGnu.pass("AsBroadcaster.addListener property exists");
+               DejaGnu.pass("AsBroadcaster.hasOwnProperty('addListener') 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("AsBroadcaster.addListener property does not 
exist");
+               DejaGnu.fail("!AsBroadcaster.hasOwnProperty('addListener') 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        if (Type.typeof(untyped AsBroadcaster.addListener) == 
ValueType.TFunction) {
-               DejaGnu.pass("AsBroadcaster.addListener is a function");
+               DejaGnu.pass("typeof(AsBroadcaster.addListener) == 'function' 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("AsBroadcaster.addListener is not a function");
+               DejaGnu.fail("typeof(AsBroadcaster.addListener) != 'function' 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        if (Type.typeof(untyped AsBroadcaster.addListener(obj)) == 
ValueType.TBool) {
-               DejaGnu.pass("AsBroadcaster.addListener() returns Boolean");
+               DejaGnu.pass("typeof(AsBroadcaster.addListener(obj)) == 
'boolean' [./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("AsBroadcaster.addListener() does not return 
Boolean");
+               DejaGnu.fail("AsBroadcaster.addListener() does not return 
Boolean [./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        
        //Testing for broadcastMessage()
        if (untyped AsBroadcaster.hasOwnProperty('broadcastMessage')) {
-               DejaGnu.pass("AsBroadcaster.broadcastMessage property exists");
+               DejaGnu.pass("AsBroadcaster.broadcastMessage property exists 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("AsBroadcaster.broadcastMessage property does not 
exist");
+               DejaGnu.fail("AsBroadcaster.broadcastMessage property does not 
exist [./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        if (Type.typeof(untyped AsBroadcaster.broadcastMessage) == 
ValueType.TFunction) {
-               DejaGnu.pass("AsBroadcaster.broadcastMessage is a function");
+               DejaGnu.pass("AsBroadcaster.broadcastMessage is a function 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("AsBroadcaster.broadcastMessage is not a 
function");
+               DejaGnu.fail("AsBroadcaster.broadcastMessage is not a function 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        if (Type.typeof(untyped AsBroadcaster.broadcastMessage(event)) == 
ValueType.TNull) {
-               DejaGnu.pass("AsBroadcaster.broadcastMessage is a void 
function");
+               DejaGnu.pass("AsBroadcaster.broadcastMessage is a void function 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("AsBroadcaster.broadcastMessage is not a void 
function");
+               DejaGnu.fail("AsBroadcaster.broadcastMessage is not a void 
function [./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        
        //Testing for removeListener
        if (untyped AsBroadcaster.hasOwnProperty('removeListener')) {
-               DejaGnu.pass("AsBroadcaster.broadcastMessage property exists");
+               DejaGnu.pass("AsBroadcaster.broadcastMessage property exists 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("AsBroadcaster.broadcastMessage property does not 
exist");
+               DejaGnu.fail("AsBroadcaster.broadcastMessage property does not 
exist [./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        if (Type.typeof(untyped AsBroadcaster.removeListener) == 
ValueType.TFunction) {
-               DejaGnu.pass("AsBroadcaster.removeListener is a function");
+               DejaGnu.pass("AsBroadcaster.removeListener is a function 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        } else {
-               DejaGnu.fail("AsBroadcaster.removeListener is not a function");
+               DejaGnu.fail("AsBroadcaster.removeListener is not a function 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
        }
        if (Type.typeof(untyped AsBroadcaster.removeListener(obj)) == 
ValueType.TBool) {
-               DejaGnu.pass("AsBroadcaster.removeListener() returns Boolean");
-       } else {
-               DejaGnu.fail("AsBroadcaster.removeListener() does not return 
Boolean");
-       }
-       
-       
-
-       DejaGnu.note("typeof (initialize) "   + Type.typeof(untyped 
AsBroadcaster.initialize));
-       DejaGnu.note("Note 1: "   + Type.typeof(untyped 
AsBroadcaster.addListener(obj)));
-       DejaGnu.note("Note 2: "   + Type.typeof(untyped 
AsBroadcaster.__proto__));
-       
-       
-       //Testing to make sure new object is empty
-       var myObj = { };
-       DejaGnu.note("Note 3: " + Type.typeof(untyped myObj._listeners));
-       DejaGnu.note("Note 4: " + Type.typeof(untyped myObj.addListener));
-       DejaGnu.note("Note 5: " + Type.typeof(untyped myObj.removeLitener));
-       
-/*
-// not sure if this can be tested because AsBroadcaster does not exist in haxe
-// There is no way to access the constructor
-bc = new AsBroadcaster;
-check_equals(typeof(bc), 'object');
-check(bc instanceof AsBroadcaster);
-check(bc instanceof Object);
-check_equals(typeof(bc.addListener), 'undefined');
-check_equals(typeof(bc.removeListener), 'undefined');
-check_equals(typeof(bc.broadcastMessage), 'undefined');
-check_equals(typeof(bc.initialize), 'undefined');
-
-bcast = new Object;
-
-check_equals(typeof(bcast._listeners), 'undefined');
-check_equals(typeof(bcast.addListener), 'undefined');
-check_equals(typeof(bcast.removeListener), 'undefined');
-check_equals(typeof(bcast.broadcastMessage), 'undefined');
-
-AsBroadcaster.initialize(bcast);
-
-check_equals(typeof(bcast._listeners), 'object');
-check(bcast._listeners instanceof Array);
-check_equals(bcast._listeners.length, 0);
-check_equals(typeof(bcast.addListener), 'function');
-check_equals(typeof(bcast.removeListener), 'function');
-check_equals(typeof(bcast.broadcastMessage), 'function');
-
-bob = { _listeners:5, addListener:"string" };
-check_equals(bob._listeners, 5);
-check_equals(bob.addListener, "string");
-AsBroadcaster.initialize(bob);
-check_equals(typeof(bob._listeners), "object");
-check_equals(typeof(bob.addListener), "function");
-
-//--------------------------------
-// Some insane calls...
-//--------------------------------
-
-ret = bcast.addListener();
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-check_equals(bcast._listeners.length, 1); // !!
-
-ret = bcast.addListener();
-check_equals(bcast._listeners.length, 1); // undefined was already there as an 
element...
-
-ret = bcast.addListener(2);
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-check_equals(bcast._listeners.length, 2); // !!
-
-ret = bcast.addListener(2);
-check_equals(bcast._listeners.length, 2); // 2 was already there as an element 
...
-ret = bcast.addListener(3);
-check_equals(bcast._listeners.length, 3); // 3 is a new element
-
-ret = bcast.removeListener(); // will remove the undefined value !
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-check_equals(bcast._listeners.length, 2); // element 'undefined' was removed
-
-ret = bcast.removeListener(2); // will remove the element number:2 !
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-check_equals(bcast._listeners.length, 1); // element '2' was removed
-
-ret = bcast.removeListener(3); // will remove the element number:3 !
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-check_equals(bcast._listeners.length, 0); // element '3' was removed
-
-ret = bcast.removeListener(); // no such element ?
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, false);
-
-o = new Object; o.valueOf = function() { return 'yes I am'; };
-bcast.addListener(o);
-check_equals(bcast._listeners.length, 1); 
-ret = bcast.removeListener('yes I am'); // valueOf invoked
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-check_equals(bcast._listeners.length, 0); // element '3' was removed
-
-o.addListener = bcast.addListener;
-check_equals(typeof(o._listeners), 'undefined');
-check_equals(typeof(o.removeListenerCalled), 'undefined');
-ret = o.addListener(); // automatically attempts to call o.removeListener()
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-check_equals(typeof(o._listeners), 'undefined');
-
-o.removeListener = function() { this.removeListenerCalled = true; };
-ret = o.addListener(); // automatically calls o.removeListener()
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-check_equals(typeof(o._listeners), 'undefined');
-check_equals(typeof(o.removeListenerCalled), 'boolean');
-check_equals(o./usr/bin/haxe -swf-version 8  -cp . -cp ./accessibility -cp 
./display -cp ./errors -cp ./external -cp ./geom -cp ./media -cp ./net -cp 
./printing -cp ./system -cp ./ui -cp ./xml -swf ${newname} -main 
BitmapData_as.hxremoveListenerCalled, true);
-
-o.removeListener = bcast.removeListener;
-o._listeners = new Object();
-o._listeners.push = function() { this.pushCalled = true; this.length++; };
-o._listeners.splice = function() { this.spliceCalled = true; };
-o._listeners.length = 1;
-o._listeners['0'] = 5;
-ret = o.addListener(5); // automatically calls o._listeners.splice and 
o._listeners.push
-// Gnash fails as it gives up if _listeners isn't an array
-check_equals(o._listeners.pushCalled, true);
-check_equals(o._listeners.length, 2);
-check_equals(o._listeners.spliceCalled, true);
-
-dang = createEmptyMovieClip('dangling', 1);
-check_equals(typeof(dang.addListener), 'undefined');
-dang.removeMovieClip();
-AsBroadcaster.initialize(dang); // can't initialize a dangling thing
-check_equals(typeof(dang.addListener), 'undefined');
-createEmptyMovieClip('dangling', 2);
-AsBroadcaster.initialize(dang); // but can initialize a rebound thing
-check_equals(typeof(dang.addListener), 'function');
-
-//--------------------------------
-// A bit more sane calls...
-//--------------------------------
-
-counter = 0;
-
-onTest = function()
-{
-       //note(" Called "+this.name+".onTest (order 
"+this.order+"->"+(counter+1)+")");
-       this.order = ++counter;
-};
-
-a = new Object; a.name = 'a'; a.onTest = onTest;
-b = new Object; b.name = 'b'; b.onTest = onTest;
-
-ret = bcast.addListener(a);
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-ret = bcast.addListener(b);
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-//note("Broadcasting");
-ret = bcast.broadcastMessage('onTest');
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-check_equals(a.order, 1);
-check_equals(b.order, 2);
-
-ret = bcast.addListener(b); // b is not added again
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-//note("Broadcasting");
-bcast.broadcastMessage('onTest');
-check_equals(a.order, 3);
-check_equals(b.order, 4);
-
-ret = bcast.addListener(a); // listener a is moved from first to last position 
to _listeners
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-//note("Broadcasting");
-bcast.broadcastMessage('onTest');
-check_equals(b.order, 5);
-check_equals(a.order, 6);
-
-bcast._listeners.push(a); // force double a listener
-//note("Broadcasting");
-bcast.broadcastMessage('onTest');
-check_equals(b.order, 7);
-check_equals(a.order, 9); // a.order was set twice
-
-bcast.addListener(a); // first a is moved from first to last position to 
_listeners
-//note("Broadcasting");
-ret = bcast.broadcastMessage('onTest');
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-check_equals(b.order, 10);
-check_equals(a.order, 12); // a is still set twice
-
-bcast._listeners.push(b); // force double b, order should now be: b,a,a,b
-//note("Broadcasting");
-bcast.broadcastMessage('onTest');
-check_equals(b.order, 16); 
-check_equals(a.order, 15); 
-
-ret = bcast.addListener(b); // *first* b is removed, another one added, new 
order is a,a,b,b
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-//note("Broadcasting");
-bcast.broadcastMessage('onTest');
-check_equals(a.order, 18); 
-check_equals(b.order, 20);
-
-ret = bcast.removeListener(b); // only first is removed
-check_equals(typeof(ret), 'boolean');
-check_equals(ret, true);
-check_equals(bcast._listeners.length, 3); // expect: a,a,b
-bcast.broadcastMessage('onTest');
-check_equals(a.order, 22); 
-check_equals(b.order, 23);
-
-ret = bcast.broadcastMessage('onUnexistent');
-check_equals(ret, true);
-bcast._listeners.length=0;
-ret = bcast.broadcastMessage('onUnexistent');
-check_equals(typeof(ret), 'undefined');
-
-//--------------------------------
-// broadcastMessage with args
-//--------------------------------
-
-_root.total = 0;
-o = {};
-o.addThis = function(what)
-{
-       //note("Arg0 is "+what);
-       _root.total += what;
-};
-o.setSum = function()
-{
-       _root.total = 0;
-       for (var i=0; i< arguments.length; ++i)
-       {
-               //note("Arg "+i+" is "+arguments[i]);
-               _root.total += arguments[i];
-       }
-};
-bcast.addListener(o);
-bcast.broadcastMessage('addThis', 3);
-check_equals(_root.total, 3);
-bcast.broadcastMessage('addThis', 2);
-check_equals(_root.total, 5);
-bcast.broadcastMessage('setSum', 1, 2, 3, 4);
-check_equals(_root.total, 10);
-bcast.broadcastMessage('setSum', 1, 2, 3, 4, 5, 6, 7, 8);
-check_equals(_root.total, 36);
-bcast.broadcastMessage('setSum', 'one', 'two', 'three');
-check_equals(_root.total, '0onetwothree');
-
-//--------------------------------
-// event handlers calling super
-//--------------------------------
-
-function A1() {}
-A1.prototype.add = function(o) { o.msg += 'A'; };
-function B1() {}
-B1.prototype = new A1;
-B1.prototype.add = function(o) { super.add(o); o.msg += 'B'; };
-
-bobj = new B1;
-o = { msg:'' };
-bobj.add(o);
-check_equals(o.msg, "AB");
-o.msg = '';
-
-bcast._listeners.length=0;
-bcast.addListener(bobj);
-bcast.broadcastMessage('add', o);
-check_equals(o.msg, "AB");
-
-//-----------------------------------------------------------------------------------
-// TODO: test override of 
AsBroadcaster.{addListener,removeListener,broadcastMessage}
-// swfdec contains tests for this, which should now be pretty succeeding 
except for
-// not-directly related checks which trigger failure due to all-or-nothing 
nature of
-// the swfdec testsuite.
-// See swfdec/test/trace/asbroadcaster-override.as for more info
-//-----------------------------------------------------------------------------------
-
-check_totals(115);
-*/
+               DejaGnu.pass("AsBroadcaster.removeListener() returns Boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("AsBroadcaster.removeListener() does not return 
Boolean [./AsBroadcaster_as.hx: " + here.lineNumber + "]"  );
+       }
+       
+       var bc = untyped __new__(AsBroadcaster);
+       
+       if (untyped __instanceof__(bc, AsBroadcaster)) {
+           DejaGnu.pass("bc is an instance of AsBroadcaster 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bc is not an instance of AsBroadcaster 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }       
+       if (untyped __instanceof__(bc, Object)) {
+               DejaGnu.pass("bc is an object ./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bc is not an object ./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       }
+       if (untyped bc.addListener==null) {
+               DejaGnu.pass("bc.addListener is undefined 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bc.addListener is defined ./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+       if (untyped bc.removeListener==null) {
+               DejaGnu.pass("bc.removeListener is undefined 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bc.removeListener is defined 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (untyped bc.broadcastMessage==null) {
+               DejaGnu.pass("bc.broadcaster is undefined 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bc.broadcaster is defined ./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }       
+       if (untyped bc.intialize==null) {
+               DejaGnu.pass("bc.initialize is undefined ./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bc.initialize is defined ./AsBroadcaster_as.hx: " 
+ here.lineNumber + "]");
+       }
+       
+       var bcast = untyped __new__(Object);
+       
+       if (untyped bcast._listeners==null) {
+               DejaGnu.pass("bcast._listeners is undefined 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast._listeners is defined 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (untyped bcast.addListener==null) {
+               DejaGnu.pass("bcast.addListener is undefined 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener is defined 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (untyped bcast.removeListener==null) {
+               DejaGnu.pass("bcast.removeListener is undefined 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.removeListener is defined 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (untyped bcast.broadcastMessage==null) {
+               DejaGnu.pass("bcast.broadcastMessage is undefined 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.broadcastMessage is defined 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       untyped AsBroadcaster.initialize(bcast);
+       
+       var x2 = untyped __new__(Object);
+       var x3 = untyped __new__(Object);
+       var x4 = untyped __new__(Object);
+       var x5 = untyped __new__(Object);
+
+       if (Reflect.isObject(bcast._listeners)) {
+               DejaGnu.pass("bcast._listeners returns an 
object./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast._listeners does not return an 
object./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (untyped __instanceof__(bcast._listeners, Array)) {
+               DejaGnu.pass("bcast._listeners is an array 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast._listeners is not an array 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (bcast._listeners.length==0) {
+               DejaGnu.pass("bcast._listeners.length = 0 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast._listener.length != 0 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (Type.typeof(bcast.addListener)==ValueType.TFunction) {
+               DejaGnu.pass("bcast.addListener is a function 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener is not a function 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (Type.typeof(bcast.removeListener)==ValueType.TFunction) {
+               DejaGnu.pass("bcast.removeListener is a function 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.removeListener is not a function 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (Type.typeof(bcast.broadcastMessage)==ValueType.TFunction) {
+               DejaGnu.pass("bcast.broadcastMessage is a function 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.broadcastMessage is not a function 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       var bob = { _listeners:5, addListener:"string"};
+       
+       if (bob._listeners==5) {
+               DejaGnu.pass("bob._listeners = 5 ./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bob._listeners != 5 ./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       }
+       if (bob.addListener=="string") {
+               DejaGnu.pass("bob.addListener = 'string' ./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bob.addListener != 'string' 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       untyped AsBroadcaster.initialize(bob);
+       
+       if (Reflect.isObject(bob._listeners)) {
+               DejaGnu.pass("bob._listeners returns a object 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bob._listeners does not return a object 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (Type.typeof(bob.addListener)==ValueType.TFunction) {
+               DejaGnu.pass("bob.addListener returns a function 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bob.addListener does not return a function 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       // addListener() always returns true according to documentation,
+       // so take these tests with a grain of salt...
+       var ret = bcast.addListener(x2);
+       
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.addListener() returns a boolean 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() does not return a boolean 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.addListener() returns true 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() returns false 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");      
+       }
+       if (bcast._listeners.length==1) {
+               DejaGnu.pass("bcast._listeners.length = 1 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast._listeners.length != 1 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       ret = bcast.addListener(x2);
+       
+       if (bcast._listeners.length==1) {
+               DejaGnu.pass("bcast._listeners.length = 1 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast._listeners.length != 1 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+               
+       ret = bcast.addListener(x3);
+       
+       if (bcast._listeners.length==2) {
+               DejaGnu.pass("bcast._listeners.length = 2 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast._listeners.length = " + 
bcast._listeners.length + "./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       ret = bcast.addListener(x4);
+       
+       if (bcast._listeners.length==3) {
+               DejaGnu.pass("bcast._listeners.length = 3 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast._listeners.length = " + 
bcast._listeners.length + "[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       ret = bcast.removeListener(x4);
+       
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.addListener() returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.addListener() returns true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() returns false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");     
+       }
+       if (bcast._listeners.length==2) {
+               DejaGnu.pass("bcast._listeners.length = 2 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast._listeners.length = " + 
bcast._listeners.length + "[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       ret = bcast.removeListener(x3);
+       
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.addListener() returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.addListener() returns true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() returns false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");     
+       }
+       if (bcast._listeners.length==1) {
+               DejaGnu.pass("bcast._listeners.length = 1 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast._listeners.length = " + 
bcast._listeners.length + "[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       ret = bcast.removeListener(x2);
+       
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.addListener() returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.addListener() returns true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() returns false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");     
+       }
+       if (bcast._listeners.length==0) {
+               DejaGnu.pass("bcast._listeners.length = 0 --> 
bcast.removeListener() worked [./AsBroadcaster_as.hx: " + here.lineNumber + 
"]");
+       } else {
+               DejaGnu.fail("bcast._listeners.length = " + 
bcast._listeners.length + "[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       // No such element -- previously deleted
+       var ret = bcast.removeListener(x4);
+       
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.addListener() returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==false) {
+               DejaGnu.pass("bcast.addListener() returns false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() returns true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");      
+       }
+       
+       var o : Dynamic = {}; 
+       
+       o.valueOf = function() { 
+               return "yes I am"; 
+       }
+               
+       bcast.addListener(o);
+       
+       if (bcast._listeners.length==1) {
+               DejaGnu.pass("bcast._listeners.length = 1 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast._listeners.length = " + 
bcast._listeners.length + "[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       ret = bcast.removeListener("yes I am");
+               
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.addListener() returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.addListener() returns true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() returns false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");     
+       }
+       if (bcast._listeners.length==0) {
+               DejaGnu.pass("bcast._listeners.length = 0 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast._listeners.length = " + 
bcast._listeners.length + "[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       o.addListener = bcast.addListener;
+       
+       if (untyped o._listeners==null) {
+               DejaGnu.pass("o._listeners property is undefined 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("o._listeners property is defined 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (untyped o.removeListenerCalled==null) {
+               DejaGnu.pass("o.removeListenerCalled property is 
undefined[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else { 
+               DejaGnu.fail("o.removeListenerCalled property is defined 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       ret = o.addListener();
+       
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.addListener() returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.addListener() returns true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener() returns false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");     
+       }
+       if (untyped o._listeners==null) {
+               DejaGnu.pass("o._listeners property is undefined 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("o._listeners property is defined 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       o.removeListener = function () {
+               o.removeListenerCalled = true; 
+       }
+       
+       ret = o.addListener();
+       
+       // Will this test only pass if the fcn is called?
+       o.removeListener();
+       
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("o.addListener() returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("o.addListener() does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("o.addListener() returns true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("o.addListener() returns false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]"); 
+       }
+       if (untyped o._listeners==null) {
+               DejaGnu.pass("o._listeners property is undefined 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("o._listeners property is defined 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       if (Type.typeof(o.removeListenerCalled)==ValueType.TBool) {
+               DejaGnu.pass("o.removeListenerCalled returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("o.removeListenerCalled does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (o.removeListenerCalled==true) {
+               DejaGnu.pass("o.removeListenerCalled returns true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("o.removeListenerCalled returns false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+
+       o.removeListener = bcast.removeListener;
+       
+       //var o._listeners : Dynamic = {};
+       o._listeners = untyped __new__(Object);
+       
+       o._listeners.push = function() {
+               o._listeners.pushCalled = true;
+               o._listeners.length++ ;
+       };
+       
+       o._listeners.splice = function() {
+               o._listeners.spliceCalled = true;
+       };
+       
+       o._listeners.length = 1;
+       o._listeners[0] = 5;
+       
+       ret = o.addListeners(x5);
+       
+       // Will these tests only pass if the fcns are actually called?
+       o._listeners.push();
+       o._listeners.splice();
+       
+       if (o._listeners.pushCalled==true) {
+               DejaGnu.pass("o._listeners.pushCalled returns true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("o._listener.pushCalled returns false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (o._listeners.length==2) {
+               DejaGnu.pass("o._listeners.length = 2 [./AsBroadcaster_as.hx: " 
+ here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("o._listeners.length != 2 " + o._listeners.length 
+"[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (o._listeners.spliceCalled==true) {
+               DejaGnu.pass("o._listeners.spliceCalled is true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("o._listeners.spliceCalled is false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }       
+       
+       var dang:MovieClip = untyped MovieClip.createEmptyMovieClip("dangling", 
1);
+
+       if (dang.addListener==null) {
+               DejaGnu.pass("dang.addListener is undefined 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("dang.addListener is defined 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       dang.removeMovieClip();
+       untyped AsBroadcaster.initialize(dang);
+       
+       if (dang.addListener==null) {
+               DejaGnu.pass("dang.addListener is undefined 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("dang.addListener is defined 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       // FAILS -- try to come back and change, but cannot figure this one 
out...
+       /*var dang:MovieClip = untyped 
MovieClip.createEmptyMovieClip("dangling", 2);
+       untyped AsBroadcaster.initialize(dang);
+
+       if (Type.typeof(dang.addListener)==ValueType.TFunction) {
+               DejaGnu.pass("dang.addListener function exists 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("dang.addListener function does not exist 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }*/
+       
+       var counter = 0;
+
+       var onTest = function() {
+        untyped this.order = ++counter;
+    };
+                       
+       var a : Dynamic = {}; 
+       a.name = "a";
+       a.onTest = onTest;
+       var b : Dynamic = {}; 
+       b.name = "b"; 
+       b.onTest = onTest;
+       
+       Reflect.setField(bcast._listeners, "length", 0);
+
+       ret = bcast.addListener(a);
+
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.addListener returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.addListener returned a true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener returned a false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       ret = bcast.addListener(b);
+       
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.addListener returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.addListener returned a true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener returned a false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+
+       ret = bcast.broadcastMessage("onTest");
+       
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.broadcastMessage returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.broadcastMessage does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.broadcastMessage returned a true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.broadcastMessage returned a false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       if (a.order==1) {
+               DejaGnu.pass("a.order = 1 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("a.order = " + a.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+       if (b.order==2) {
+               DejaGnu.pass("b.order = 2 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("b.order = " + b.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+       
+       ret = bcast.addListener(b);
+               
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.addListener returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.addListener returned a true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener returned a false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       bcast.broadcastMessage("onTest");
+               
+       if (a.order==3) {
+               DejaGnu.pass("a.order = 3 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("a.order = " + a.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+       if (b.order==4) {
+               DejaGnu.pass("b.order = 4 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("b.order = " + b.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+               
+       ret = bcast.addListener(a);
+       
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.addListener returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.addListener returned a true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener returned a false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       bcast.broadcastMessage("onTest");
+
+       if (a.order==6) {
+               DejaGnu.pass("a.order = 6 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("a.order = " + a.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+       if (b.order==5) {
+               DejaGnu.pass("b.order = 5 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("b.order = " + b.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+       
+       
+       bcast._listeners.push(a);
+       
+       bcast.broadcastMessage("onTest");
+       
+       if (a.order==9) {
+               DejaGnu.pass("a.order = 9 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("a.order = " + a.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+       if (b.order==7) {
+               DejaGnu.pass("b.order = 7 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("b.order = " + b.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+               
+       bcast.addListener(a);
+       
+       ret = bcast.broadcastMessage("onTest");
+       
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.broadcastMessage returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.broadcastMessage does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.broadcastMessage returns true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.broadcastMessage returns false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+               
+       if (a.order==12) {
+               DejaGnu.pass("a.order = 12 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("a.order = " + a.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+       if (b.order==10) {
+               DejaGnu.pass("b.order = 10 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("b.order = " + b.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+       
+       bcast._listeners.push(b);
+       
+       bcast.broadcastMessage("onTest");
+       
+       if (a.order==15) {
+               DejaGnu.pass("a.order = 15 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("a.order = " + a.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+       if (b.order==16) {
+               DejaGnu.pass("b.order = 16 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("b.order = " + b.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+               
+       ret = bcast.addListener(b); // *first* b is removed, another one added, 
new onTest is a,a,b,b
+               
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.addListener returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.addListener returns true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener returns false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+
+       bcast.broadcastMessage("onTest");
+       
+       if (a.order==18) {
+               DejaGnu.pass("a.order = 18 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("a.order = " + a.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+       if (b.order==20) {
+               DejaGnu.pass("b.order = 20 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("b.order = " + b.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+       
+       ret = bcast.removeListener(b); // only first is removed
+
+       if (Type.typeof(ret)==ValueType.TBool) {
+               DejaGnu.pass("bcast.addListener returns a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener does not return a boolean 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       if (ret==true) {
+               DejaGnu.pass("bcast.addListener returns true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.addListener returns false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       if (bcast._listeners.length==3) {
+               DejaGnu.pass("bcast._listeners.length = 3 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast._listeners.length = " + 
bcast._listeners.length + "[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       bcast.broadcastMessage("onTest");
+       
+       if (a.order==22) {
+               DejaGnu.pass("a.order = 22 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("a.order = " + a.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+       if (b.order==23) {
+               DejaGnu.pass("b.order = 23 [./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("b.order = " + b.order + "[./AsBroadcaster_as.hx: 
" + here.lineNumber + "]");
+       }
+
+       ret = bcast.broadcastMessage("onUnexistent");
+       
+       if (ret==true) {
+               DejaGnu.pass("bcast.broadcastMessage returns true 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.broadcastMessage returns false 
[./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+
+       Reflect.setField(bcast._listeners, "length", 0);
+       
+       ret = bcast.broadcastMessage("onUnexistent");
+       
+       if (ret==null) {
+               DejaGnu.pass("bcast.broadcastMessage('onUnexistent') is 
undefined [./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("bcast.broadcastMessage('onUnexistent') is defined 
(!) [./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+
+       var total = untyped __new__(Int);
+               
+       var o : Dynamic = {};
+
+       o.addThis = function(what) {
+               //DejaGnu.note("Arg0 is: " + what);
+               untyped total += what;
+       };
+       
+       o.setSum = function() {
+               // Reset untyped total as it should not be an accumulator
+               untyped total = 0;
+               var i:Int = 0;
+               while (i < untyped __arguments__.length) {
+                       untyped total += untyped __arguments__[i];
+                       i++;
+               }
+       }
+       
+       // Reset untyped total only once for addThis, because we want it to 
+       // act as an accumulator                
+       untyped total = 0;
+       
+       bcast.addListener(o);
+       Reflect.callMethod(bcast, Reflect.field(bcast, "broadcastMessage"), 
["addThis", 3]);
+       
+       if (untyped total==3) {
+               DejaGnu.pass("_root.total==3 ./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("_root.total!=3" + " " + untyped total + " 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       Reflect.callMethod(bcast, Reflect.field(bcast, "broadcastMessage"), 
["addThis", 2]);
+       
+       if (untyped total==5) {
+               DejaGnu.pass("_root.total==5 ./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("_root.total= " + untyped total + " 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       Reflect.callMethod(bcast, Reflect.field(bcast, "broadcastMessage"), 
["setSum", 1, 2, 3, 4]);
+       
+       if (untyped total==10) {
+               DejaGnu.pass("_root.total==10 ./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("_root.total= " + untyped total + " 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+       
+       Reflect.callMethod(bcast, Reflect.field(bcast, "broadcastMessage"), 
["setSum", 1, 2, 3, 4, 5, 6, 7, 8]);
+       
+       if (untyped total==36) {
+               DejaGnu.pass("_root.total==36 ./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("_root.total= " + untyped total + " 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+               
+       Reflect.callMethod(bcast, Reflect.field(bcast, "broadcastMessage"), 
["setSum", "one", "two", "three"]);
+       
+       if (untyped total=="0onetwothree") {
+               DejaGnu.pass("_root.total=='0onetwothree' 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("_root.total= " + untyped total +" 
./AsBroadcaster_as.hx: " + here.lineNumber + "]");
+       }
+
+       var A1 : Dynamic = {};
+       var B1 : Dynamic = {};
+       var o : Dynamic = {msg : ""};
+       var bobj : Dynamic = {};
+       
+       A1 = function() {};
+       B1 = function() {};
+       
+       A1.prototype.add = function(o) { 
+               o.msg += 'A'; 
+       };
+       
+       var aobj = untyped __new__(A1);
+       aobj.add(o);
+               
+       B1.prototype = untyped __new__(A1);
+       
+       B1.prototype.add = function(o) { 
+               o.msg += 'B'; 
+       };
+               
+       bobj = untyped __new__(B1);
+       
+       bobj.add(o);
+       
+       if (o.msg=="AB") {
+               DejaGnu.pass("o.msg=='AB' ./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("o.msg= " + o.msg + " ./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       }
+       
+       Reflect.setField(bcast._listeners, "length", 0);
+
+       Reflect.callMethod(bcast, Reflect.field(bcast, "addListener"), 
["bobj"]);
+       Reflect.callMethod(bcast, Reflect.field(bcast, "broadcastMessage"), 
["add", o]);
+       
+       if (o.msg=="AB") {
+               DejaGnu.pass("o.msg=='AB' ./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       } else {
+               DejaGnu.fail("o.msg= " + o.msg + " ./AsBroadcaster_as.hx: " + 
here.lineNumber + "]");
+       }
+       
 #end // flash version < 6
 
-               //call after finishing all tests
-               DejaGnu.done();
+               //call after finishing all
+                               DejaGnu.done();
        }//End main
 }//End class ASBroadcaster
 


reply via email to

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